Client Integrations
Claude Code Integration - CLI and VS Code
Connect Claude Code (CLI/VS Code) to RouterMCP using HTTP transport.
Claude Code
Claude Code supports MCP servers via HTTP Streamable transport. This works with both the CLI version and the VS Code extension.
Prerequisites
- Claude Code installed
- A RouterMCP project (Cloud) or CLI running in HTTP mode
Server URL Format
{base_url}/v1/mcp/{project_slug}/requestExamples:
- Local:
http://localhost:8787/v1/mcp/my-project/request - Production:
https://gateway.routermcp.com/v1/mcp/my-project/request
The URL must include /v1/ (not just /1/) and end with /request.
Setup Methods
Without Authentication
claude mcp add routermcp \
--type streamable-http \
--url https://gateway.routermcp.com/v1/mcp/my-project/requestWith API Key
claude mcp add routermcp \
--type streamable-http \
--url https://gateway.routermcp.com/v1/mcp/my-project/request \
--header "Authorization: Bearer rmc_your_api_key"Remove Server
claude mcp remove routermcpAdd to your Claude config file:
Without Authentication
{
"mcpServers": {
"routermcp": {
"type": "streamable-http",
"url": "https://gateway.routermcp.com/v1/mcp/my-project/request"
}
}
}With API Key
{
"mcpServers": {
"routermcp": {
"type": "streamable-http",
"url": "https://gateway.routermcp.com/v1/mcp/my-project/request",
"headers": {
"Authorization": "Bearer rmc_your_api_key"
}
}
}
}Verify Connection
Test the connection with cURL:
curl -i -X POST 'https://gateway.routermcp.com/v1/mcp/my-project/request' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer rmc_your_api_key' \
-H 'mcp-protocol-version: 2025-03-26' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {"name": "curl", "version": "0"}
}
}'Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| 404 Not Found | Wrong URL path | Use /v1/mcp/ prefix and /request suffix |
| 401 Unauthorized | Missing or invalid API key | Add Authorization: Bearer {key} header |
| Connection refused | Wrong host | Use the Worker API URL, not the Dashboard URL |
Claude Code calls initialize first, then tools/list. If the initialize succeeds but tools/list fails, check your project has servers configured.