MCPlexer
A tiny MCP proxy for running multiple labeled instances of the same MCP server without tool-name collisions.
README
<div align="center"> <img src="https://raw.githubusercontent.com/OzTamir/mcplexer/main/assets/mcplexer.svg" alt="MCPlexer logo" width="128" height="128"> <h1>MCPlexer</h1> <p> <a href="https://www.npmjs.com/package/@oztamir/mcplexer"> <img alt="npm package" src="https://img.shields.io/npm/v/%40oztamir%2Fmcplexer?logo=npm&label=npm&color=cb3837"> </a> </p> </div>
MCPlexer is a tiny MCP proxy for running multiple labeled instances of the same MCP server without tool-name collisions.
If an upstream server exposes get-calendar-events, MCPlexer can expose it as:
personal:get-calendar-eventswork:get-calendar-events
It also appends a label note to every tool description, for example:
Note: this is one of multiple instances of this MCP, labeled "Personal".
Install from npm
Install MCPlexer globally when you want to use it from .mcp.json files:
npm install --global @oztamir/mcplexer
The installed command is mcplexer:
mcplexer --help
If you prefer pnpm for global packages:
pnpm add --global @oztamir/mcplexer
Configure your MCP client
Use mcplexer as the MCP server command. Put the upstream local MCP command after --.
{
"mcpServers": {
"google-personal": {
"command": "mcplexer",
"args": [
"--prefix",
"personal",
"--label",
"Personal",
"--",
"npx",
"-y",
"@example/google-workspace-mcp"
],
"env": {
"GOOGLE_ACCOUNT": "personal"
}
},
"google-work": {
"command": "mcplexer",
"args": [
"--prefix",
"work",
"--label",
"Work",
"--",
"npx",
"-y",
"@example/google-workspace-mcp"
],
"env": {
"GOOGLE_ACCOUNT": "work"
}
}
}
}
The wrapper passes its environment through to the upstream command, so per-account .mcp.json env values still work.
For remote MCP endpoints, pass --url. By default MCPlexer tries Streamable HTTP first and falls back to legacy SSE.
For hosted MCPs that use a normal user OAuth flow, such as Notion MCP, use browser OAuth:
{
"mcpServers": {
"notion-work": {
"command": "mcplexer",
"args": [
"--prefix",
"work",
"--label",
"Work Notion",
"--url",
"https://mcp.notion.com/mcp",
"--oauth-flow",
"browser"
]
}
}
}
On first use, MCPlexer prints the authorization URL to stderr and opens it in your browser. After you approve access, it receives the local callback on 127.0.0.1, stores the OAuth tokens under ~/.config/mcplexer/oauth/, and reconnects automatically. The downstream agent only sees the prefixed MCP tools.
The callback port is not tied to Notion. By default MCPlexer picks a deterministic high loopback port from the upstream URL and prefix, so multiple labeled instances do not all fight for one fixed port. If your OAuth provider or pre-registered client requires an exact redirect URI, set it explicitly with --oauth-callback-port. If the provider requires a known public client ID, pass it with --oauth-client-id. If you cannot open a browser automatically, add --oauth-no-open and open the printed URL manually. Use --oauth-store when you need a custom token cache path.
If you already have an OAuth access token, let MCPlexer pass it through the MCP SDK auth provider:
{
"mcpServers": {
"calendar-work-remote": {
"command": "mcplexer",
"args": [
"--prefix",
"work",
"--label",
"Work",
"--url",
"https://mcp.example.com/mcp",
"--oauth-bearer-env",
"WORK_MCP_TOKEN"
],
"env": {
"WORK_MCP_TOKEN": "replace-me"
}
}
}
}
For machine-to-machine OAuth, use client credentials:
{
"mcpServers": {
"calendar-work-remote": {
"command": "mcplexer",
"args": [
"--prefix",
"work",
"--label",
"Work",
"--url",
"https://mcp.example.com/mcp",
"--oauth-client-id",
"your-client-id",
"--oauth-client-secret-env",
"WORK_MCP_CLIENT_SECRET",
"--oauth-scope",
"calendar.read calendar.write"
],
"env": {
"WORK_MCP_CLIENT_SECRET": "replace-me"
}
}
}
}
For non-OAuth remote authentication, you can still pass static headers with --header or --header-env. Do not combine OAuth options with an Authorization header.
You can force a remote transport when needed:
mcplexer --prefix work --url https://mcp.example.com/mcp --transport http
mcplexer --prefix legacy --url https://mcp.example.com/sse --transport sse
Other ways to run MCPlexer
Run with npx
You can also run MCPlexer through npx without a global install:
npx -y @oztamir/mcplexer --help
For .mcp.json, use npx as the command and put MCPlexer arguments after the package name:
{
"mcpServers": {
"google-personal": {
"command": "npx",
"args": [
"-y",
"@oztamir/mcplexer",
"--prefix",
"personal",
"--label",
"Personal",
"--",
"npx",
"-y",
"@example/google-workspace-mcp"
]
}
}
}
Link a local checkout
From a local checkout of this repo:
pnpm install
pnpm build
pnpm link --global
Agent skill
This repo exposes an agent skill that teaches AI coding agents when and how to use MCPlexer — adding a second labeled instance of an MCP server, and migrating an existing MCP entry to a prefixed setup.
Install it with npx skills:
npx skills add OzTamir/mcplexer
Or install it as a Claude Code plugin:
/plugin marketplace add OzTamir/mcplexer
/plugin install mcplexer@mcplexer
CLI reference
mcplexer --prefix <name> [--label <label>] -- <command> [args...]
mcplexer --prefix <name> [--label <label>] --url <mcp-url> [--transport auto|http|sse]
Options:
--prefix <name>: tool-name prefix. Must contain only letters, numbers,_, or-.--label <label>: human label used in the description note. Defaults to the prefix.--separator <text>: separator between prefix and tool name. Defaults to:.--note <text>: custom note appended to every tool description.--url <url>: remote upstream MCP endpoint.--transport <mode>:stdio,auto,http, orsse.--header <name: value>: literal remote header. Repeatable.--header-env <name=ENV>: remote header whose value is read from an environment variable. Repeatable.--oauth-bearer-env <ENV>: remote OAuth bearer token read from an environment variable.--oauth-flow browser: remote OAuth authorization-code flow with a local browser callback.--oauth-callback-port <port>: local browser OAuth callback port. Defaults to a deterministic high port based on upstream URL and prefix.--oauth-store <path>: OAuth token/client cache path for browser flow.--oauth-no-open: print the OAuth URL without trying to open a browser.--oauth-client-id <id>: OAuth client ID. In browser flow, use this for a pre-registered public client. Inclient_credentials, pair it with--oauth-client-secret-env.--oauth-client-secret-env <ENV>: OAuthclient_credentialsclient secret environment variable.--oauth-scope <scope>: optional OAuth scope forclient_credentials.--oauth-client-name <name>: optional OAuth client display name for metadata.
How it works
MCPlexer is itself a stdio MCP server. It connects to one upstream MCP server, lists upstream tools, rewrites each tool name and description, then forwards tools/call requests by stripping the configured prefix before calling upstream.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。