Skip to content

Client Setup & Integration Overview ​

The Model Context Gateway (MCG) enables AI coding assistants, IDEs, autonomous agents, and custom software to securely connect to downstream MCP servers through standardized, authenticated endpoints.


🔌 Connection Endpoints & Routing Modes ​

MCG provides three primary routing paths for connecting MCP clients:

Route PathModeDescriptionRecommended For
/sseUnified Meta-ModeExposes only search_tools and execute_tool. Searches the catalog dynamically on demand to minimize context saturation.All AI Assistants & IDEs (Cursor, Claude Desktop, Cline, Antigravity)
/{targetServerId}Target Server ProxyBypasses Meta-Mode, proxying 100% of the tools, resources, and prompts from a specific server (e.g. /docker, /homeassistant).Dedicated agents, single-purpose workflows, or clients requiring direct tool schemas.
/admin/sseAdmin Management ModeExposes the complete suite of gateway administration tools (manage_servers, manage_appkeys, manage_policies).Autonomous DevOps agents and admin scripts.

🎛️ Dynamic Client Configuration Generator ​

The Client Setup Guide card (available on both the Overview and App Keys & Security tabs) features an interactive configuration generator:

Dynamic Client Configuration Generator

  1. Select Target Route: Choose Unified Meta-Mode (/sse) for aggregated discovery, or choose a specific downstream server (e.g. /docker).
  2. Select Client Tool: Choose your AI environment (Cursor, Claude Desktop, Cline / VS Code, Antigravity CLI, or SDKs).
  3. Include Key: Check the box to auto-fill your active AppKey into the generated JSON or bash snippet.
  4. Copy & Paste: Click Copy and paste directly into your client configuration file.

🔐 Client Authentication ​

All client requests must authenticate using an authorized AppKey:

  • HTTP Header (Standard):
    http
    Authorization: Bearer mcp-usr-Xk9L2mPq-7vN3wZ8aB1cE4fG9
  • Query Parameter Fallback: If your client or proxy environment cannot send custom HTTP headers during the initial SSE handshake, MCG accepts:
    http
    http://localhost:8080/sse?apiKey=mcp-usr-Xk9L2mPq-7vN3wZ8aB1cE4fG9

📚 Dedicated Client Configuration Guides ​

Follow the step-by-step guide for your preferred AI client:


💻 Programmatic SDK Integration ​

For custom software, scripts, or autonomous agent frameworks, use the official MCP SDKs:

1. TypeScript SDK (@modelcontextprotocol/sdk) ​

typescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";

const transport = new SSEClientTransport(
  new URL("http://localhost:8080/sse"),
  {
    requestInit: {
      headers: {
        "Authorization": "Bearer mcp-usr-Xk9L2mPq-7vN3wZ8aB1cE4fG9"
      }
    }
  }
);

const client = new Client({ name: "custom-ts-agent", version: "1.0.0" }, { capabilities: {} });
await client.connect(transport);

// In Meta-Mode, search for relevant tools dynamically
const searchResult = await client.callTool({
  name: "search_tools",
  arguments: { query: "restart container" }
});
console.log("Discovered tools:", searchResult);

2. Python SDK (mcp) ​

python
import asyncio
from mcp import ClientSession
from mcp.client.sse import sse_client

async def main():
    headers = {"Authorization": "Bearer mcp-usr-Xk9L2mPq-7vN3wZ8aB1cE4fG9"}
    async with sse_client("http://localhost:8080/sse", headers=headers) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print("Connected! Available bootstrap tools:", [t.name for t in tools.tools])

asyncio.run(main())

Released under the Apache 2.0 License.