Guides
Aggregate Remote MCP Servers
Connect to other MCP servers and access all their tools through your single Kyew connection. Instead of configuring multiple MCP servers in your AI client, you connect them to Kyew once and access everything through one endpoint.
What Is MCP Aggregation?
Most AI clients support connecting to one or a few MCP servers. If you use tools from multiple servers (GitHub, Slack, a company internal server), you'd normally need to configure each one separately in every client.
With Kyew's MCP aggregation, you connect remote servers to Kyew, and Kyew proxies their tools. Your AI client only needs the single Kyew connection, but gains access to tools from every connected server.
┌──────────────┐
│ Your AI │ ┌──────────────────┐
│ Client │──────▶│ Kyew │
│ │ │ │──────▶ GitHub MCP Server
└──────────────┘ │ (single │──────▶ Slack MCP Server
│ connection) │──────▶ Internal Tools Server
└──────────────────┘
Each remote server becomes a single gateway tool in Kyew, keeping your tool list compact regardless of how many tools the remote server exposes.
Step 1: Add a Remote Server
Register a remote MCP server with Kyew:
mcp(action="add",
server_url="https://mcp.github-tools.example.com/mcp",
name="GitHub Tools",
tool_prefix="github")
Kyew connects to the server, discovers all available tools, and caches them. The tool_prefix determines the gateway tool name your AI will use.
Step 2: Add Auth (If Needed)
Many remote servers require authentication. You have two options:
Option A: Use a Kyew Connection
If you already have a connection set up (see Connect a Service):
mcp(action="add",
server_url="https://mcp.github-tools.example.com/mcp",
name="GitHub Tools",
tool_prefix="github",
connection_id="conn_abc123")
Kyew resolves the connection's token and passes it as the Authorization header on every request to the remote server.
Option B: Raw Headers
Pass authentication headers directly:
mcp(action="add",
server_url="https://mcp.github-tools.example.com/mcp",
name="GitHub Tools",
tool_prefix="github",
headers={ Authorization: "Bearer ghp_xxxxxxxxxxxx" })
Connection vs. raw headers
Using a connection_id is preferred for OAuth2 connections since Kyew handles token refresh automatically. Raw headers work for static tokens that don't expire.
Step 3: Use the Gateway Tool
Once added, the remote server's tools are available through a single gateway tool named after your tool_prefix. The gateway has three actions:
List All Tools
See everything the remote server offers:
github(action="tools")
Returns a summary of each tool with its name and description.
Search for a Specific Tool
Find tools by keyword and get the full input schema:
github(action="search", query="create issue")
This returns matching tools with their complete inputSchema, so your AI knows exactly what parameters to pass. This progressive discovery approach means your AI only loads schemas for tools it actually needs.
Call a Tool
Execute a specific tool on the remote server:
github(action="call",
tool_name="create_issue",
args={
repo: "my-org/my-repo",
title: "Fix login redirect",
body: "The login page redirects to the wrong URL after auth.",
labels: ["bug"]
})
Kyew proxies the request to the remote server and returns the result.
Managing Remote Servers
List Connected Servers
See all remote servers and their status:
mcp(action="list")
Shows each server's URL, tool prefix, status, number of cached tools, and last refresh time.
Refresh Tool Cache
Tool caches refresh automatically every 24 hours. If a remote server adds new tools and you want them immediately:
mcp(action="refresh", server_id="srv_abc123")
Discover Tools Directly
List all tools on a server without going through the gateway:
mcp(action="discover", server_id="srv_abc123")
Remove a Server
Disconnect a remote server and remove its gateway tool:
mcp(action="remove", server_id="srv_abc123")
Example: Connecting Multiple Servers
Here's what a setup with three remote servers looks like:
mcp(action="add",
server_url="https://github-mcp.example.com/mcp",
name="GitHub",
tool_prefix="gh",
connection_id="conn_github")
mcp(action="add",
server_url="https://slack-mcp.example.com/mcp",
name="Slack",
tool_prefix="slack",
connection_id="conn_slack")
mcp(action="add",
server_url="https://internal.company.com/mcp",
name="Internal Tools",
tool_prefix="internal",
headers={ "X-API-Key": "key_xxxx" })
Your AI now has three gateway tools: gh, slack, and internal. Each one is a single tool that gives access to all the tools on that server.
gh(action="call", tool_name="create_pr", args={ ... })
slack(action="call", tool_name="send_message", args={ channel: "#eng", text: "PR ready" })
internal(action="call", tool_name="deploy", args={ env: "staging" })
Next Steps
- mcp Reference — Complete parameter reference for all MCP aggregation actions
- Connect a Service — Set up connections for authenticating with remote servers