Mcpx
A self-hosted MCP Gateway for enterprise environments. Secure AI agent connections to MCP servers with tool governance, multi-tenant isolation, and full observability. Built with Rust and Vue.
Installation
npx mcpxAsk AI about Mcpx
Powered by Claude · Grounded in docs
I know everything about Mcpx. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
mcpx
mcpx is a command line tool that turns remote MCP servers into an agent-friendly command surface.
It keeps MCP server registrations in a global user registry, discovers tool schemas, handles OAuth where possible, and exposes each MCP server as a root command:
mcpx posthog projects-get
mcpx sentry search-issues --input '{"query":"is:unresolved"}'
mcpx is designed for agents. The command surface is intentionally schema-first,
stable, and explicit: tool calls pass input through --input, while mcpx's own
control commands live under the @ namespace.
Requirements
- Bun
- macOS, Linux, or any environment that can run Bun executables
Install
Install the latest release:
curl -fsSL https://raw.githubusercontent.com/AIGC-Hackers/mcpx/main/install.sh | bash
By default, the installer downloads the executable JS bundle from GitHub Releases
and installs it to ~/.local/bin/mcpx.
Set MCPX_INSTALL_DIR to choose another install directory.
Add MCP Servers
Register a remote MCP server globally:
mcpx @add --name posthog --url https://mcp.posthog.com/mcp
mcpx @add --name sentry --url https://mcp.sentry.dev/mcp
mcpx @add --name cf-docs --url https://docs.mcp.cloudflare.com/mcp
mcpx @add --name cf-bindings --url https://bindings.mcp.cloudflare.com/mcp
mcpx @add --name cf-observability --url https://observability.mcp.cloudflare.com/mcp
mcpx stores server configuration in:
~/.agents/mcpx/servers.json
OAuth tokens and client secrets are stored separately in the global token cache:
~/.agents/mcpx/tokens.json
Project directories do not need MCP config files. A project should decide which global servers are relevant by using schema selectors or a generated skill.
Call Tools
Call tools through the server command:
mcpx <server> <tool> --input '<json-or-json5>'
Examples:
mcpx posthog projects-get --input '{}'
mcpx sentry whoami --input '{}'
For complex payloads, use @- with a heredoc to keep the input readable:
mcpx cf-graphql graphql_query --input @- <<'JSON'
{
"query": "query GetWorkerAnalytics($accountTag: String!, $scriptName: String!, $since: Time!, $until: Time!) { viewer { accounts(filter: {accountTag: $accountTag}) { workersInvocationsAdaptive(limit: 1000, filter: {scriptName: $scriptName, datetime_geq: $since, datetime_leq: $until}, orderBy: [datetimeHour_ASC]) { dimensions { datetimeHour scriptName status } sum { requests subrequests errors duration } quantiles { cpuTimeP50 cpuTimeP99 } } } } }",
"operationName": "GetWorkerAnalytics",
"variables": {
"accountTag": "abc123def456",
"scriptName": "my-worker",
"since": "2026-04-20T00:00:00Z",
"until": "2026-04-27T00:00:00Z"
}
}
JSON
--input is the primary input path. It accepts inline JSON/JSON5, @file, and
@- stdin inputs.
Discover Schemas
Print the command schema for agents:
mcpx --schema
Focus on one server:
mcpx --schema=.posthog
Focus on a set of servers:
mcpx --schema='.{posthog,sentry}'
Focus on an internal mcpx command:
mcpx --schema='.["@add"]'
Control Commands
mcpx control commands use the @ namespace so they do not collide with server
names:
mcpx @add --name <server> --url <mcp-url>
mcpx @remove --name <server>
mcpx @skill
Server names cannot start with @.
Authentication
When @add detects OAuth, mcpx tries to complete authentication immediately.
For OAuth servers that support dynamic client registration, mcpx registers a
client automatically.
For OAuth servers that do not support dynamic client registration, such as
Slack, mcpx prompts for a manual client_id and client_secret. These providers
usually require a preconfigured redirect URL. mcpx uses:
http://127.0.0.1:65245/callback
Add and save that exact Redirect URL in the provider app settings before continuing the prompt.
When an OAuth token is close to expiry, mcpx refreshes it before calling the MCP tool and then continues the original command.
Output
mcpx optimizes output for humans and agents by default:
- text MCP content is printed directly
- JSON text content is rendered as TOON
- non-text content is saved to a temporary file and printed as
file saved <path>
Use --raw to preserve raw server text output:
mcpx posthog projects-get --raw
Project Skills
Generate a project-local skill that tells agents which global MCP servers to use:
mcpx @skill --server posthog --server sentry
This writes:
.agents/skills/mcpx/SKILL.md
The generated skill instructs agents to discover tools with focused schema selectors and call MCP tools through mcpx.
License
MIT
