@yan-sheng-li/mcp-center
v1.0.15
Published
MCP Server management tool that aggregates multiple MCP servers
Downloads
729
Maintainers
Readme
MCP Center
MCP Center is a local MCP gateway with a built-in Web UI. It manages multiple child MCP servers, keeps their configuration in one place, and exposes a single Streamable HTTP MCP endpoint for your MCP client to connect to.
MCP Center can aggregate capabilities from:
- HTTP MCP servers
- local stdio MCP servers
- WebSocket bridge clients that connect back to MCP Center
It currently republishes these MCP capabilities through the main endpoint:
- tools
- resources
- resource templates
- prompts
WebSocket bridge clients currently contribute tools only. Resources, resource templates, and prompts from WebSocket bridge clients are not exposed.
To avoid collisions, every exposed capability is prefixed with the child server name:
- tool:
exa_web_search_exa - resource:
filesystem_file:///tmp/a.txt - prompt:
docs_summarize - WebSocket bridge tool:
my_agent_search
Usage Model
Run MCP Center directly with npx, then connect your MCP client to the HTTP endpoint it starts:
- Start
mcp-centerwithnpx @yan-sheng-li/mcp-center - Open the Web UI to add or edit HTTP/stdio child MCP servers
- Optionally let remote/local agents connect as WebSocket bridge clients
- Point your MCP client at
http://localhost:3000/mcp
Quick Start
1. Start MCP Center
npx @yan-sheng-li/mcp-centerThis command executes the package's CLI entry directly. No global install is required.
By default it uses ~/.mcp-center/mcp.json. If the file does not exist, it will be created automatically as:
{
"servers": []
}You can also pass a custom config path:
npx @yan-sheng-li/mcp-center --config /path/to/mcp.jsonOr:
npx @yan-sheng-li/mcp-center /path/to/mcp.json2. Open the Web UI
Open:
http://localhost:3000/uiFrom the UI you can:
- add HTTP or stdio child MCP servers
- edit server config
- enable or disable a configured server
- delete a configured server
- probe a server before saving to inspect tools/resources/templates/prompts
- selectively enable only part of a configured server's capabilities
- view connection status and loaded capabilities
- view connected WebSocket bridge clients as read-only, auto-registered servers
3. Connect your MCP client to MCP Center
Use this endpoint:
http://localhost:3000/mcpYour MCP client must support Streamable HTTP transport.
Server Profiles
MCP Center supports server profiles for scene-based switching. Create profiles to define which servers are enabled for different use cases:
- Create a profile with a subset of servers (e.g., "Writing" profile with only docs/search tools)
- Quickly switch between profiles without manually toggling individual servers
- Useful when you need different server combinations for different tasks
Profile Operations
From the Web UI (http://localhost:3000/ui):
- Click "+ New Profile" to create a profile and select which servers to include
- Click "Manage Profiles" to edit, delete, or activate/deactivate profiles
- Click the profile dropdown to quickly switch between profiles
Profile API
GET /api/profiles- list all profiles and active profilePOST /api/profiles- create a new profilePUT /api/profiles/:name- update a profileDELETE /api/profiles/:name- delete a profilePOST /api/profiles/activate- activate a profile (enables only selected servers)POST /api/profiles/deactivate- deactivate profile (enable all servers)
Backup & Restore
MCP Center supports exporting and restoring your configuration and usage data:
- Export a ZIP backup containing
mcp.jsonandstats.db - Import a backup ZIP to restore configuration
- Useful for migrating to a new machine or backing up before major changes
Backup Operations
From the Web UI (http://localhost:3000/ui):
- Click "Backup" to download a timestamped ZIP backup
- Click "Restore" to upload and restore from a backup ZIP
Backup API
GET /api/backup/export- download backup ZIPPOST /api/backup/import- upload and restore from ZIP
Statistics Dashboard
MCP Center tracks tool usage and provides a visual dashboard:
- Overview of total calls, unique tools, and active servers
- Per-tool usage statistics and call counts
- Timeline chart showing usage over time
- Recent call history
Access Dashboard
Open http://localhost:3000/dashboard to view the statistics dashboard with ECharts visualizations.
Stats API
GET /api/stats/overview- overview statistics (total calls, unique tools, active servers)GET /api/stats/tools- per-tool usage statisticsGET /api/stats/timeline- usage over timeGET /api/stats/recent- recent call history- Optional
?period=24h|7d|30dquery parameter (default: 24h)
WebSocket Bridge
MCP Center also starts a WebSocket bridge server on the same port:
ws://localhost:3000/ws/:serverNameA WebSocket bridge client connects to this URL and behaves like a lightweight MCP server over a JSON-RPC WebSocket connection. MCP Center performs an MCP-style handshake, lists the client's tools, auto-registers the connected client as a server, and exposes those tools through the normal Streamable HTTP MCP endpoint at /mcp.
This is useful when a tool provider cannot be launched by MCP Center as stdio and cannot be reached as an HTTP MCP server, for example:
- a browser extension or desktop app that can open an outbound WebSocket connection
- a remote worker behind NAT/firewall that can connect out to MCP Center
- a long-running app that wants to dynamically publish tools while it is connected
Bridge lifecycle
- Start MCP Center.
- A bridge client connects to
ws://localhost:3000/ws/<serverName>. - MCP Center sends
initializeto the bridge client. - MCP Center sends
tools/listto discover tools. - The bridge client appears in the Web UI as a
WSBRIDGEserver. - Tools are exposed to MCP clients with the same server-name prefix rule, for example
agent1_echo. - When an MCP client calls that tool through
/mcp, MCP Center forwards atools/callrequest over the WebSocket. - When the WebSocket disconnects, the bridge server is removed from the loaded capability list.
If another WebSocket connects with the same serverName, the previous connection for that name is closed and replaced.
Bridge protocol
The bridge connection uses JSON-RPC 2.0 messages over WebSocket.
After the WebSocket upgrade, MCP Center sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {
"name": "mcp-center",
"version": "1.0.0"
}
}
}The bridge client should return a JSON-RPC result, for example:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-03-26",
"capabilities": {
"tools": {}
},
"serverInfo": {
"name": "my-agent",
"version": "1.0.0"
}
}
}MCP Center then sends tools/list:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}The bridge client should return tools in normal MCP shape:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"tools": [
{
"name": "echo",
"description": "Echo input text",
"inputSchema": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"required": ["text"]
}
}
]
}
}When an MCP client calls the exposed tool, for example my_agent_echo, MCP Center forwards the original tool name to the bridge client:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "echo",
"arguments": {
"text": "hello"
}
}
}The bridge client should return a normal MCP tool result:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "hello"
}
]
}
}If a request fails, return a JSON-RPC error:
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32000,
"message": "Something went wrong"
}
}Minimal bridge client example
Install ws in your client project, then run this script while MCP Center is running:
import WebSocket from 'ws';
const serverName = 'demo-agent';
const ws = new WebSocket(`ws://localhost:3000/ws/${encodeURIComponent(serverName)}`);
const tools = [
{
name: 'echo',
description: 'Echo input text',
inputSchema: {
type: 'object',
properties: {
text: { type: 'string' }
},
required: ['text']
}
}
];
ws.on('open', () => {
console.log(`Connected to MCP Center as ${serverName}`);
});
ws.on('message', (data) => {
const msg = JSON.parse(data.toString());
if (!msg || msg.jsonrpc !== '2.0' || msg.id == null) return;
if (msg.method === 'initialize') {
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: msg.id,
result: {
protocolVersion: msg.params?.protocolVersion || '2025-03-26',
capabilities: { tools: {} },
serverInfo: { name: serverName, version: '1.0.0' }
}
}));
return;
}
if (msg.method === 'tools/list') {
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: msg.id,
result: { tools }
}));
return;
}
if (msg.method === 'tools/call') {
const { name, arguments: args = {} } = msg.params || {};
if (name === 'echo') {
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: msg.id,
result: {
content: [
{ type: 'text', text: String(args.text ?? '') }
]
}
}));
} else {
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: msg.id,
error: { code: -32601, message: `Unknown tool: ${name}` }
}));
}
}
});
ws.on('close', () => console.log('Disconnected from MCP Center'));
ws.on('error', (err) => console.error('WebSocket error:', err));After the script connects, open http://localhost:3000/ui. You should see demo-agent with type WSBRIDGE. MCP clients connected to http://localhost:3000/mcp can call the tool as:
demo-agent_echoWebSocket bridge notes and limits
- Bridge servers are not stored in
mcp.json; they are auto-registered while connected. - Bridge servers are shown in the UI as read-only entries.
- Only tools are loaded from bridge clients.
- Tool calls over the bridge time out after 60 seconds.
- Handshake/list requests time out after 15 seconds.
- MCP Center sends WebSocket ping frames every 30 seconds as keepalive.
- Server names are taken from the URL path and sanitized only when constructing aggregated tool names: characters outside
[a-zA-Z0-9_-]become_. - There is no authentication or authorization on
/ws/:serverNamein the current implementation. If exposing MCP Center beyond localhost, put it behind a trusted network boundary or reverse proxy that enforces access control.
