GitHub MCP サーバーのカスタム構築
上級
これはEngineering, Building Blocks, AI分野の自動化ワークフローで、19個のノードを含みます。主にSet, Github, Switch, Aggregate, HttpRequestなどのノードを使用、AI技術を活用したスマート自動化を実現。 カスタム GitHub MCP サーバーの構築
前提条件
- •GitHub Personal Access Token
- •ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"meta": {
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "b0224d75-763d-4f06-8aa3-3f1b4c5ca96d",
"name": "別ワークフローから実行時",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
800,
500
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "operation"
},
{
"name": "repo"
},
{
"name": "issueNumber"
},
{
"name": "text"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "dd0e2ff0-af31-4503-a276-65682a3009a8",
"name": "操作",
"type": "n8n-nodes-base.switch",
"position": [
980,
500
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "getLatestIssues",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "81b134bc-d671-4493-b3ad-8df9be3f49a6",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.operation }}",
"rightValue": "getLatestIssues"
}
]
},
"renameOutput": true
},
{
"outputKey": "getIssueComments",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8d57914f-6587-4fb3-88e0-aa1de6ba56c1",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.operation }}",
"rightValue": "getIssueComments"
}
]
},
"renameOutput": true
},
{
"outputKey": "addIssueComment",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7c38f238-213a-46ec-aefe-22e0bcb8dffc",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.operation }}",
"rightValue": "addIssueComment"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "bc35f181-e3a4-4aa4-8132-26cd4a6ced8a",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
120
],
"parameters": {
"color": 7,
"width": 680,
"height": 660,
"content": "## 1. Set up an MCP Server Trigger\n[Read more about the MCP Server Trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger)"
},
"typeVersion": 1
},
{
"id": "e4c8d338-08ad-4c47-935b-b5ea53dc59d7",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
700,
120
],
"parameters": {
"color": 7,
"width": 560,
"height": 300,
"content": "## 2. Build Simple Support Tools with Github Node\n[Read more about the Github Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.github)\n\nWhilst it may be easier to just let the Agent provide the full raw SQL statement,\nit may expose you or your organisation to a real security risk where in the worst\ncase, data may be unknowingly leaked or deleted.\n\nForcing the agent to provide only the parameters of the query\nmeans we can guard somewhat against this risk and also allows\nuse of query parameters as best practice against SQL injection attacks.\n"
},
"typeVersion": 1
},
{
"id": "5d6a5f6d-24e8-48ed-8409-8cd24cc2e668",
"name": "付箋3",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 5,
"width": 380,
"height": 100,
"content": "### Always Authenticate Your Server!\nBefore going to production, it's always advised to enable authentication on your MCP server trigger."
},
"typeVersion": 1
},
{
"id": "fd11a97d-cd3d-4356-81d3-4266f65ef606",
"name": "Github MCPサーバー",
"type": "@n8n/n8n-nodes-langchain.mcpTrigger",
"position": [
160,
300
],
"webhookId": "61848df7-3619-4ccf-831b-d6408e0d6519",
"parameters": {
"path": "61848df7-3619-4ccf-831b-d6408e0d6519"
},
"typeVersion": 1
},
{
"id": "b8fd8431-71fa-44d1-abdb-b50e6a8a940f",
"name": "最新のIssueを取得",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
160,
540
],
"parameters": {
"name": "getLatestIssues",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"description": "Retrieves the latest issues from the github respository.",
"workflowInputs": {
"value": {
"repo": "n8n-io/n8n",
"text": "null",
"operation": "getLatestIssues",
"issueNumber": "null"
},
"schema": [
{
"id": "operation",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "operation",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "repo",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "repo",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "issueNumber",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "issueNumber",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "text",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.1
},
{
"id": "a11f7b8a-aaa9-41de-a693-6d0463e48d10",
"name": "Issueコメントを追加",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
480,
540
],
"parameters": {
"name": "addIssueComment",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"description": "Call this tool to add a comment to the github issue.",
"workflowInputs": {
"value": {
"repo": "n8n-io/n8n",
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('text', ``, 'string') }}",
"operation": "addIssueComment",
"issueNumber": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('issueNumber', ``, 'string') }}"
},
"schema": [
{
"id": "operation",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "operation",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "repo",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "repo",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "issueNumber",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "issueNumber",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "text",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.1
},
{
"id": "57e8370b-caf0-4632-98e3-78316b2cb262",
"name": "Issueを簡略化",
"type": "n8n-nodes-base.set",
"position": [
1500,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6d5eb037-7e52-4595-a2da-bb183674ea2a",
"name": "issue_number",
"type": "number",
"value": "={{ $json.number }}"
},
{
"id": "3d365039-f012-444c-a383-c6c70fb93e9d",
"name": "title",
"type": "string",
"value": "={{ $json.title }}"
},
{
"id": "20a1b658-c56c-4578-9b1f-350b454da2d2",
"name": "url",
"type": "string",
"value": "={{ $json.url }}"
},
{
"id": "0eb6930d-2ea9-4a83-bab7-5f673e79c1d1",
"name": "reported_by",
"type": "string",
"value": "={{ $json.user.login }}"
},
{
"id": "2d71c6de-ab54-4721-9e1c-5193350a5110",
"name": "state",
"type": "string",
"value": "={{ $json.state }}"
},
{
"id": "474166aa-4bfa-4230-bce4-28df2de47bed",
"name": "created_at",
"type": "string",
"value": "={{ $json.created_at }}"
},
{
"id": "e4784fc1-4438-4d7a-a2f5-86be077ae7ae",
"name": "updated_at",
"type": "string",
"value": "={{ $json.updated_at }}"
},
{
"id": "e0639b60-4a08-406a-be8e-c3565a519f0c",
"name": "body",
"type": "string",
"value": "={{ $json.body }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "632b1286-7e4a-457b-8544-6ca8f2affb9f",
"name": "結果を集計",
"type": "n8n-nodes-base.aggregate",
"position": [
1680,
320
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "response"
},
"typeVersion": 1
},
{
"id": "447327bc-0b42-47ec-80c0-14d6f521d047",
"name": "Issueコメントを取得",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
320,
600
],
"parameters": {
"name": "getIssueComments",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"description": "Retrieves the issue and associated comments and discussion",
"workflowInputs": {
"value": {
"repo": "n8n-io/n8n",
"text": "null",
"operation": "getIssueComments",
"issueNumber": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('issueNumber', ``, 'string') }}"
},
"schema": [
{
"id": "operation",
"type": "string",
"display": true,
"required": false,
"displayName": "operation",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "repo",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "repo",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "issueNumber",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "issueNumber",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "text",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.1
},
{
"id": "f5c59a05-54e4-4aa5-bef3-192e07adffb0",
"name": "コメントを取得",
"type": "n8n-nodes-base.httpRequest",
"position": [
1500,
500
],
"parameters": {
"url": "={{ $json.comments_url }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "githubApi"
},
"credentials": {
"githubApi": {
"id": "kA70YRmLeHDqZbXA",
"name": "GitHub account"
}
},
"typeVersion": 4.2
},
{
"id": "3fe80456-9fb5-47bb-80d9-484123571a8f",
"name": "コメントを簡略化",
"type": "n8n-nodes-base.set",
"position": [
1680,
500
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6e09ed44-a72c-4915-84f4-0796b45158a7",
"name": "id",
"type": "number",
"value": "={{ $json.id }}"
},
{
"id": "76c34251-7f40-42bc-bb98-17e7fe52d9ed",
"name": "issue_url",
"type": "string",
"value": "={{ $json.issue_url }}"
},
{
"id": "1094dd36-d18d-4ada-ac49-5347f0f245ae",
"name": "user",
"type": "string",
"value": "={{ $json.user.login }}"
},
{
"id": "59b50536-4e0a-46bc-919b-685066253f45",
"name": "author_association",
"type": "string",
"value": "={{ $json.author_association }}"
},
{
"id": "6253bae9-aaff-4a88-9e5a-64126ed80cc4",
"name": "body",
"type": "string",
"value": "={{ $json.body }}"
},
{
"id": "3944598d-8204-45a0-9e0b-448d3cfa5a87",
"name": "created_at",
"type": "string",
"value": "={{ $json.created_at }}"
},
{
"id": "3f395b51-6e57-4d07-9cf9-9a03e7a40c51",
"name": "updated_at",
"type": "string",
"value": "={{ $json.updated_at }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7926ae2d-5408-4b10-88f3-e6ebfe5f9619",
"name": "コメントを集計",
"type": "n8n-nodes-base.aggregate",
"position": [
1860,
500
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "response"
},
"typeVersion": 1
},
{
"id": "af2b4c0f-4a83-44a2-bae8-b3c45861d820",
"name": "複数Issueを取得",
"type": "n8n-nodes-base.github",
"position": [
1320,
320
],
"webhookId": "e08dcf3e-66bb-4ba5-a868-d8c41a98bc95",
"parameters": {
"limit": 10,
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[0] }}"
},
"resource": "repository",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[1] }}"
},
"getRepositoryIssuesFilters": {
"sort": "created"
}
},
"credentials": {
"githubApi": {
"id": "kA70YRmLeHDqZbXA",
"name": "GitHub account"
}
},
"typeVersion": 1.1
},
{
"id": "50568171-5f46-4338-a799-a1854ebc425e",
"name": "単一Issueを取得",
"type": "n8n-nodes-base.github",
"position": [
1320,
500
],
"webhookId": "e08dcf3e-66bb-4ba5-a868-d8c41a98bc95",
"parameters": {
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[0] }}"
},
"operation": "get",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[1] }}"
},
"issueNumber": "={{ $json.issueNumber }}"
},
"credentials": {
"githubApi": {
"id": "kA70YRmLeHDqZbXA",
"name": "GitHub account"
}
},
"typeVersion": 1.1
},
{
"id": "1a12fadd-e436-4731-ad66-b9d9cdb9c61c",
"name": "コメントを作成",
"type": "n8n-nodes-base.github",
"position": [
1320,
680
],
"webhookId": "e08dcf3e-66bb-4ba5-a868-d8c41a98bc95",
"parameters": {
"body": "={{ $json.text }}",
"owner": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[0] }}"
},
"operation": "createComment",
"repository": {
"__rl": true,
"mode": "name",
"value": "={{ $json.repo.split('/')[1] }}"
},
"issueNumber": "={{ $json.issueNumber }}"
},
"credentials": {
"githubApi": {
"id": "kA70YRmLeHDqZbXA",
"name": "GitHub account"
}
},
"typeVersion": 1.1
},
{
"id": "b90acf56-c871-49de-95d0-1c6ceb1799f7",
"name": "応答を取得",
"type": "n8n-nodes-base.set",
"position": [
1500,
680
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "65631bfa-7448-4188-8cc1-b812361ae9b1",
"name": "response",
"type": "string",
"value": "ok"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "da360f61-4251-4f0f-8081-3b502e9981c9",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-460,
-480
],
"parameters": {
"width": 440,
"height": 1260,
"content": "## Try It Out!\n### This n8n demonstrates how to build your own Github MCP server to personalise it to your organisation's repositories, issues and pull requests.\n\nThis n8n implementation, though not as fully featured as the official MCP server offered by Github, allows you to control precisely what access and/or functionality is granted to users which can make MCP use simpler and in some cases, more secure. The use-case in this template is to simply view and comment on issues within a specific repository but can be extended to meet the needs of your team.\n\nThis MCP example is based off an official MCP reference implementation which can be found here https://github.com/modelcontextprotocol/servers/tree/main/src/github\n\n### How it works\n* A MCP server trigger is used and connected to 3 custom workflow tools. We're using custom workflow tools as there is quite a few nodes required for each task.\n* Behind these tools are regular Github nodes although preconfigured with credentials and targeted repository.\n* The \"Get Issue Comments\" and \"Create Issue Comment\" tools depend on obtaining an Issue Number first. The agent should call the \"Get Latest Issues\" tool for this.\n\n### How to use\n* This Github MCP server allows any compatible MCP client to view and comment on Github Issues. You will need to have a Github account and repository access available before you can use this server.\n* Connect your MCP client by following the n8n guidelines here - https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger/#integrating-with-claude-desktop\n* Try the following queries in your MCP client:\n * \"Can you get me the latest issues about MCP?\"\n * \"What is the current progress on Issue 12345?\"\n * \"Please can you add a comment to Issue 12345 that they should try installing the latest version and see if that works?\"\n\n### Requirements\n* Github for account and repository access. The repository need not be your own but you'll still need to ensure you have the correct permissions.\n* MCP Client or Agent for usage such as Claude Desktop - https://claude.ai/download\n\n### Customising this workflow\n* Extend this template to interactive with pull requests or workflows within your own company's Github repositories. Alternatively, pull in metrics and generate reports for programme managers.\n* Remember to set the MCP server to require credentials before going to production and sharing this MCP server with others!"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"dd0e2ff0-af31-4503-a276-65682a3009a8": {
"main": [
[
{
"node": "af2b4c0f-4a83-44a2-bae8-b3c45861d820",
"type": "main",
"index": 0
}
],
[
{
"node": "50568171-5f46-4338-a799-a1854ebc425e",
"type": "main",
"index": 0
}
],
[
{
"node": "1a12fadd-e436-4731-ad66-b9d9cdb9c61c",
"type": "main",
"index": 0
}
]
]
},
"f5c59a05-54e4-4aa5-bef3-192e07adffb0": {
"main": [
[
{
"node": "3fe80456-9fb5-47bb-80d9-484123571a8f",
"type": "main",
"index": 0
}
]
]
},
"1a12fadd-e436-4731-ad66-b9d9cdb9c61c": {
"main": [
[
{
"node": "b90acf56-c871-49de-95d0-1c6ceb1799f7",
"type": "main",
"index": 0
}
]
]
},
"af2b4c0f-4a83-44a2-bae8-b3c45861d820": {
"main": [
[
{
"node": "57e8370b-caf0-4632-98e3-78316b2cb262",
"type": "main",
"index": 0
}
]
]
},
"57e8370b-caf0-4632-98e3-78316b2cb262": {
"main": [
[
{
"node": "632b1286-7e4a-457b-8544-6ca8f2affb9f",
"type": "main",
"index": 0
}
]
]
},
"50568171-5f46-4338-a799-a1854ebc425e": {
"main": [
[
{
"node": "f5c59a05-54e4-4aa5-bef3-192e07adffb0",
"type": "main",
"index": 0
}
]
]
},
"a11f7b8a-aaa9-41de-a693-6d0463e48d10": {
"ai_tool": [
[
{
"node": "fd11a97d-cd3d-4356-81d3-4266f65ef606",
"type": "ai_tool",
"index": 0
}
]
]
},
"b8fd8431-71fa-44d1-abdb-b50e6a8a940f": {
"ai_tool": [
[
{
"node": "fd11a97d-cd3d-4356-81d3-4266f65ef606",
"type": "ai_tool",
"index": 0
}
]
]
},
"3fe80456-9fb5-47bb-80d9-484123571a8f": {
"main": [
[
{
"node": "7926ae2d-5408-4b10-88f3-e6ebfe5f9619",
"type": "main",
"index": 0
}
]
]
},
"447327bc-0b42-47ec-80c0-14d6f521d047": {
"ai_tool": [
[
{
"node": "fd11a97d-cd3d-4356-81d3-4266f65ef606",
"type": "ai_tool",
"index": 0
}
]
]
},
"b0224d75-763d-4f06-8aa3-3f1b4c5ca96d": {
"main": [
[
{
"node": "dd0e2ff0-af31-4503-a276-65682a3009a8",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
上級 - エンジニアリング, ビルディングブロック, 人工知能
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
API MCP サーバーのカスタム構築
カスタム API MCP サーバーの構築
If
Set
Filter
+
If
Set
Filter
25 ノードJimleuk
エンジニアリング
YouTube MCP サーバーのカスタム構築
カスタム YouTube MCP サーバーの構築
Set
Switch
Aggregate
+
Set
Switch
Aggregate
20 ノードJimleuk
ビルディングブロック
カスタムQdrantベクタース토アMCPサーバーを構築
カスタムQdrantベクターストアMCPサーバーを構築する
If
Set
Code
+
If
Set
Code
44 ノードJimleuk
ビルディングブロック
Google Drive MCP サーバーのカスタム構築
カスタム Google Drive MCP サーバーの構築
Set
Switch
Google Drive
+
Set
Switch
Google Drive
17 ノードJimleuk
ビルディングブロック
カスタムn8nワーキ Flow MCPサーバー
カスタムn8nワークフローMCPサーバーを構築する
If
N8n
Set
+
If
N8n
Set
46 ノードJimleuk
その他
ChatGPTとAirtableの対話やデータ分析のAIアシスタント
Airtableと対話しながらデータを分析するAIアシスタント
If
Set
Merge
+
If
Set
Merge
41 ノードMark Shcherbakov
エンジニアリング
ワークフロー情報
難易度
上級
ノード数19
カテゴリー3
ノードタイプ9
作成者
Jimleuk
@jimleukFreelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk
外部リンク
n8n.ioで表示 →
このワークフローを共有