Sandbox
@1mcp-app/agent

Unified MCP runtime for Claude Code and Codex

1MCP aggregates many MCP servers behind one `serve` process, so your agent tools can share one runtime instead of separate per-client setups. It also offers CLI mode and a proxy path to control what the agent sees and when it discovers tools.

501 stars58 forksTypeScriptUpdated 7d ago
Who it's for

Builders who want their agent to use one shared MCP runtime across Claude Code, Codex, Cursor, and similar clients.

What it delivers

You can centralize MCP wiring and let your agent discover and run tools through one consistent runtime.

What it does

Unified server aggregation

Runs many MCP servers behind one `1mcp serve` process.

CLI discovery flow

Uses `1mcp instructions`, `1mcp inspect`, and `1mcp run` for progressive tool discovery and execution.

Proxy mode

Provides `1mcp proxy` for stdio-compatible clients that need project context and broader compatibility.

Template server support

Creates servers from client or session context instead of loading everything at startup.

Preset and filter handling

Lets you apply presets, filters, and notification updates across the runtime.

Lazy and async loading

Supports smaller initial schemas and earlier HTTP availability when clients can handle changing capabilities.

How to get it

  1. 1Install 1MCP, add one upstream server, and start the runtime
    npm install -g @1mcp/agent
    1mcp mcp add context7 -- npx -y @upstash/context7-mcp
    1mcp serve
  2. 2In a second shell, connect your agent to CLI mode
    1mcp cli-setup --codex
    # or
    1mcp cli-setup --claude --scope repo --repo-root .
  3. 3Then verify the agent workflow
    # shell 1
    1mcp serve
    
    # shell 2
    1mcp instructions
    1mcp inspect context7
    1mcp inspect context7/query-docs
    1mcp run context7/query-docs --args '{"libraryId":"/mongodb/docs","query":"aggregation pipeline"}'

README

1MCP

NPM Version NPM Downloads CodeQl GitHub Repo stars Docs DeepWiki License

1MCP is the unified MCP runtime. 1mcp serve aggregates your MCP servers, and CLI mode adds a thinner agent-facing workflow for Codex, Claude, Cursor, and similar tool-using agents.

Why 1MCP

Most MCP setups eventually hit two kinds of sprawl:

  • Configuration sprawl: every client needs its own MCP wiring, auth choices, and filtering rules.
  • Agent sprawl: autonomous sessions carry too many tools and schemas into context up front.

1MCP addresses both:

  • 1mcp serve gives you one aggregated runtime in front of many MCP servers.
  • CLI mode lets agents discover tools progressively with instructions, inspect, and run.
  • Static servers can load at startup, while template servers are created from per-client or per-session context.
  • Presets, filters, and instruction aggregation keep the same runtime adaptable across clients and projects.
ApproachBest forTradeoff
1MCP CLI modeCodex, Claude, agent loopsRequires a running 1mcp serve instance
1MCP stdio proxyMaximum compatibility across clientsStill depends on serve, and auth-capable HTTP clients have a more direct path
Direct streamable HTTPMCP-native HTTP clientsNo project context, no .1mcprc, and a broader tool surface is exposed directly
Custom proxyingOne-off compatibility shimsYou own discovery, filtering, auth, and runtime lifecycle

Quick Start for Agent Users

This page is optimized for AI agent users. The 5-minute outcome is simple: start a real 1mcp serve runtime, connect your agent with cli-setup, then verify the instructions -> inspect -> run workflow.

Install 1MCP, add one upstream server, and start the runtime:

npm install -g @1mcp/agent
1mcp mcp add context7 -- npx -y @upstash/context7-mcp
1mcp serve

In a second shell, connect your agent to CLI mode:

1mcp cli-setup --codex
# or
1mcp cli-setup --claude --scope repo --repo-root .

Then verify the agent workflow:

# shell 1
1mcp serve

# shell 2
1mcp instructions
1mcp inspect context7
1mcp inspect context7/query-docs
1mcp run context7/query-docs --args '{"libraryId":"/mongodb/docs","query":"aggregation pipeline"}'

If you want the full walkthrough (with success criteria and off-ramps), use the Quick Start guide.

For a given agent, choose one mode only. If you switch that agent to CLI mode, remove its old direct MCP configuration first.

Why CLI Mode Exists

CLI mode is the primary workflow for agent-style sessions. It keeps MCP as the backend protocol but narrows what the agent sees at each step:

  • instructions explains the current runtime and recommended flow
  • inspect lets the agent discover only the server or tool it needs
  • run executes one selected tool after schema inspection

That gives agent loops a smaller working surface without giving up the unified runtime behind 1mcp serve.

Choose Another Path

Stdio Proxy

Use 1mcp proxy when you want the broadest client compatibility without giving up project context.

It is the recommended fallback after CLI mode because it:

  • works with the stdio transport that most AI clients already support
  • keeps project context through .1mcprc
  • supports template MCP servers resolved from project or session context
  • is easier to roll out with one-time global setup plus per-project config

Direct stdio mode is not the recommended path. It is mainly useful for debugging because 1MCP startup is slower than a thin standalone stdio setup.

Direct MCP Attachment

Direct MCP attachment is still supported for clients that want to talk to the aggregated runtime over streamable HTTP.

Examples:

{
  "mcpServers": {
    "1mcp": {
      "url": "http://127.0.0.1:3050/mcp?app=cursor"
    }
  }
}
claude mcp add -t http 1mcp "http://127.0.0.1:3050/mcp?app=claude-code"

Use this path if your client already speaks MCP natively, can work without project context, and you do not want CLI mode. For Codex, Claude, Cursor, and similar agent loops, prefer CLI mode first and proxy second.

Runtime Operators

Use the deeper docs if you are configuring or deploying the runtime itself:

Contributors

How It Works

flowchart LR
    A[User or Agent] --> B[1mcp serve]
    B --> C[Static servers loaded at startup]
    B --> D[Template servers resolved from client or session context]
    A --> E[CLI mode: instructions -> inspect -> run]
    E --> B
    F[Direct streamable HTTP client] --> B
    G[stdio-compatible client] --> H[1mcp proxy]
    H --> B

1MCP runs as an aggregated runtime behind 1mcp serve. Static servers are prepared from startup configuration, template servers are materialized when client context is known, and the runtime can use async loading for early HTTP listener availability and lazy loading for a stable tool surface. Instruction aggregation, presets, and notifications sit alongside that runtime rather than outside it.

Lazy loading is an opt-in stable tool-surface compatibility mode. It keeps the backend discovery and invocation surface at tool_list, tool_schema, and tool_invoke so capable agents can discover tools progressively without replacing their MCP tool table. Any explicitly enabled internal management tools remain directly exposed. Lazy loading reduces the initial schema payload, but it does not reduce backend connections or processes, make synchronous startup bind earlier, or repair orphaned proxy processes. See #392 for the async late-server visibility contract.

Core Capabilities

  • Unified runtime for many MCP servers behind one serve process
  • CLI mode for progressive discovery with 1mcp instructions, 1mcp inspect <server>, 1mcp inspect <server>/<tool>, and 1mcp run <server>/<tool> --args '<json>'
  • Template servers for per-client or per-session resolution
  • Opt-in async loading for early HTTP listener availability when clients can reconcile capability changes
  • Opt-in lazy loading for a stable progressive-discovery tool surface and smaller initial schemas
  • Opt-in automatic recovery for owned stdio backends, with health/status visibility and operator restart controls
  • Instruction aggregation across static and template-backed servers
  • Presets, filters, and preset change notifications
  • proxy for maximum compatibility with project context and template-server support
  • Direct streamable HTTP MCP access for native HTTP clients that do not need project context

Common Use Cases

  • Give a coding agent one stable runtime but a smaller working surface.
  • Share the same MCP inventory across Cursor, Claude Code, Codex, and internal tooling.
  • Expose context-specific template servers per repo, branch, or session.
  • Centralize auth, filtering, presets, and runtime lifecycle instead of rebuilding them in ad hoc scripts.

Contributing / License

Contributions are welcome. See CONTRIBUTING.md for the development workflow and LICENSE for the Apache 2.0 license.

Files in the repo

Repository payload47 top-level entries
  • .github
  • .husky
  • docs
  • scripts
  • src
  • test
  • web
  • .1mcprc.example
  • .dockerignore
  • .editorconfig
  • .env.example
  • .gitattributes
  • .gitignore
  • .node-version
  • .prettierignore
  • .prettierrc
  • CHANGELOG.md
  • CLAUDE.md
  • cliff-release.toml
  • cliff.toml
  • CODE_OF_CONDUCT.md
  • config.toml.example
  • CONTEXT.md
  • CONTRIBUTING.md
  • docker-compose.dev.yml
  • docker-compose.yml
  • Dockerfile
  • entitlements.plist
  • eslint.config.ts
  • glama.json
  • LICENSE
  • mcp.json.example
  • package.json
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • README.md
  • sea-config.json
  • smithery.yaml
  • tsconfig.build.json
  • tsconfig.eslint.json
  • tsconfig.json
  • tsconfig.test.json
  • vitest.admin.config.ts
  • vitest.config.ts
  • vitest.conformance-transports.config.ts
  • vitest.conformance.config.ts
  • vitest.e2e.config.ts

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k