GitHub Copilot's Agent mode in VS Code supports remote MCP servers through .vscode/mcp.json (workspace) or the user-level settings.json → mcp.servers block.
Prerequisites
- VS Code 1.93 or newer with the GitHub Copilot Chat extension.
- Copilot Agent mode enabled (chat dropdown → Agent).
- A MCP Bearer MCP token with mcp_access_enabled.
Workspace config (recommended)
Create .vscode/mcp.json at the root of the workspace:
{ "inputs": [ { "type": "promptString", "id": "apilayer-token", "description": "APILayer MCP Bearer token", "password": true } ], "servers": { "apilayer": { "type": "http", "url": "https://mcp.apilayer.com/mcp", "headers": { "Authorization": "Bearer ${input:apilayer-token}" } } } } |
VS Code prompts for the token the first time the server starts and stores it in the OS keychain. Committing this file to source control is safe — the token is not part of it.
User-level config (alternative)
To make the server available across every workspace, open Settings (JSON) and add:
{ "mcp": { "servers": { "apilayer": { "type": "http", "url": "https://mcp.apilayer.com/mcp", "headers": { "Authorization": "Bearer ${input:apilayer-token}" } } }, "inputs": [ { "type": "promptString", "id": "apilayer-token", "description": "APILayer MCP Bearer token", "password": true } ] } } |
Verify Integration
- Open Copilot Chat, switch to Agent.
- Click the 🛠 tool icon — apilayer should be listed with all three ipstack_* tools.
Once configured. Examples:
- "What country and city is the IP address 8.8.8.8 located in?" (uses ipstack_lookup)
- “Get location details for {IP_ADDRESS}.” (uses ipstack_lookup)
- “What region does IP {IP_ADDRESS} belong to?”
You should see ipstack_lookup fire and return country / city / lat / lng.
Troubleshooting
Server entry missing or "Failed to start".
- View → Output → "GitHub Copilot Chat — MCP" for connection diagnostics.
- The Command Palette command "MCP: List Servers" shows status and restart options.
- Confirm the URL ends with /mcp exactly.
Token prompt loops on each VS Code start. The token was rejected. Re-mint from the IPStack portal, ensure it carries the portal:<IPStack> scope, and run "MCP: Reset Cached Tool Inputs".
Agent mode option missing in the chat dropdown. Update VS Code and the Copilot Chat extension; remote MCP needs VS Code 1.93+ and the latest Copilot Chat build.
Tool Catalog
| Tool | Description |
|---|---|
| ipstack_lookup | Geolocation + security for a single IP. |
| ipstack_check | Geolocation + security for the caller's own IP. |
| ipstack_bulk_lookup | Geolocation + security for a comma-separated list of IPs. |