π§ GitHub Copilot + MCP Gateway¶
Super-charge Copilot (or any VS Code chat agent that speaks MCP) with tools, prompts and resources from your own MCP Gateway.
With Copilot β MCP you can:
- π§ call custom / enterprise tools from chat
- π pull live resources (configs, docs, snippets)
- π§© render prompts or templates directly inside the IDE
Copilot supports SSE streams out-of-the-box; for environments that forbid long-lived HTTP or require local stdio, you can insert the bundled mcpgateway.wrapper
bridge.
π Prerequisites¶
- VS Code β₯ 1.99
"chat.mcp.enabled": true
in your settings.json- An MCP Gateway running (
make serve
, Docker, or container image) - A JWT or Basic credentials (
admin
/changeme
in dev)
π Option 1 - Direct SSE (best for prod / remote)¶
1 - Create .vscode/mcp.json
¶
{
"servers": {
"mcp-gateway": {
"type": "sse",
"url": "https://mcpgateway.example.com/servers/UUID_OF_SERVER_1/sse",
"headers": {
"Authorization": "Bearer <YOUR_JWT_TOKEN>"
}
}
}
}
Tip - generate a token
π Option 2 - Streamable HTTP (best for prod / remote)¶
2 - Create .vscode/mcp.json
¶
{
"servers": {
"mcp-gateway": {
"type": "http",
"url": "https://mcpgateway.example.com/servers/UUID_OF_SERVER_1/mcp/",
"headers": {
"Authorization": "Bearer <YOUR_JWT_TOKEN>"
}
}
}
}
π Option 3 - Local stdio bridge (mcpgateway.wrapper
)¶
Perfect when:
- the IDE cannot add HTTP headers, or
- you're offline / behind a corp proxy.
1 - Install the wrapper (one-liner)¶
pipx install --include-deps mcp-contextforge-gateway # isolates in ~/.local/pipx/venvs
# - or -
uv pip install mcp-contextforge-gateway # inside any uv/venv you like
2 - Create .vscode/mcp.json
¶
{
"servers": {
"mcp-wrapper": {
"type": "stdio",
"command": "python3",
"args": ["-m", "mcpgateway.wrapper"],
"env": {
"MCP_SERVER_URL": "http://localhost:4444/servers/UUID_OF_SERVER_1/mcp",
"MCP_AUTH": "Bearer <YOUR_JWT_TOKEN>",
"MCP_TOOL_CALL_TIMEOUT": "120"
}
}
}
}
That's it - VS Code spawns the stdio process, pipes JSON-RPC, and you're ready to roll.
π³ Docker alternative
π§ͺ Verify inside Copilot¶
- Open Copilot Chat β switch to Agent mode.
- Click Tools - your Gateway tools should list.
- Try:
Copilot routes the call β Gateway β tool, and prints the reply.
π Good to know¶
- Use SSE for production, stdio for local/offline.
- You can manage servers, tools and prompts from the Gateway Admin UI (
/admin
). - Need a bearer quickly?
export MCP_AUTH=$(python3 -m mcpgateway.utils.create_jwt_token -u admin --secret my-test-key)
π Further Reading¶
- Gateway GitHub β ibm/mcp-context-forge
- MCP Spec β https://modelcontextprotocol.io/
- Copilot docs β features/copilot