Sandbox
@gabrielekarra/mcp-anything

CLI for generating MCP servers from codebases

MCP-Anything reads either a plain-language brief or an existing codebase or API spec, then builds a complete MCP server package. It groups operations into tools, writes the server implementation, and includes agent-facing docs and evaluation files so the result is ready to connect to an agent.

43 stars4 forksPythonUpdated 1mo ago
Who it's for

Builders who want to expose an app or API to Claude Code, Codex, Cursor, or any MCP-capable agent.

What it delivers

You can turn a codebase or spec into a runnable MCP server instead of building and organizing the server yourself.

What it does

Brief-driven server generation

Reads a YAML brief with domain description, use cases, auth, and data source details, then builds a full server package.

Codebase and spec scanning

Generates servers from local apps or URLs for OpenAPI, GraphQL, and gRPC without requiring a brief.

Grouped tool design

Combines related CRUD and lifecycle operations into broader tools like `manage_repository` or `manage_issue`.

Agent-facing skill file

Writes `SKILL.md` with tool usage, modes, gotchas, and anti-patterns for agent use.

Eval and conformance output

Produces `quick_queries.json`, `eval_cases.json`, and `conformance_report.json` for review and testing.

Transport options

Generates servers for stdio or HTTP so you can run locally or share a remote endpoint.

Scoping controls

Supports include/exclude globs, review mode, and reusable scope files to limit what gets exposed.

How to get it

  1. 11. Install
    pip install mcp-anything
    export ANTHROPIC_API_KEY=sk-...
  2. 23. Build
    mcp-anything build --brief my-api.yaml -o ./my-mcp-server
  3. 34. Run
    cd my-mcp-server
    pip install -e .
    python -m mcp_payments_mcp.server

README

MCP-Anything

Describe what you want. Get a production-ready MCP server.

Discord License: Apache 2.0 Python 3.10+ PyPI

mcp-anything

MCP-Anything turns any data source into a fully implemented MCP server — from a plain-language brief describing what agents should be able to do. It also works directly from codebases, OpenAPI specs, gRPC protos, and GraphQL schemas. Two modes, one tool.


Quick start

1. Install

pip install mcp-anything
export ANTHROPIC_API_KEY=sk-...

2. Write a brief — describe your domain and point at your data source

# my-api.yaml
server_name: payments-mcp
domain_description: >
  A payment API for managing customers, invoices, and subscriptions.
use_cases:
  - "Create a customer with email and name"
  - "Issue an invoice and send it to the customer"
  - "Create and cancel subscriptions"
  - "Issue refunds"
data_source_path: ./openapi.json   # local file or URL
data_source_kind: openapi          # openapi | graphql | grpc
auth_method: bearer_token
backend_target: fastmcp

3. Build

mcp-anything build --brief my-api.yaml -o ./my-mcp-server

4. Run

cd my-mcp-server
pip install -e .
python -m mcp_payments_mcp.server

That's it. You now have a running MCP server. Add it to your agent:

{
  "mcpServers": {
    "payments": { "command": "python", "args": ["-m", "mcp_payments_mcp.server"] }
  }
}

Two modes

build — brief-driven (recommended)

The LLM reads your brief, groups related operations into ergonomic tools, writes agent-optimised descriptions, and generates the full server package including a SKILL.md agent guide and an eval harness.

generate — codebase scanner (no brief required)

Point at source code or a spec URL. Static detection, no LLM needed.

# From a local codebase
mcp-anything generate /path/to/your/app

# From a URL (OpenAPI, GraphQL, gRPC)
mcp-anything generate https://api.example.com/openapi.json

What you get

Both modes produce a complete, pip-installable package:

my-mcp-server/
├── mcp_<name>/
│   ├── server.py          # FastMCP server (stdio or HTTP)
│   ├── tools/             # One file per tool, HTTP calls via httpx
│   ├── discovery.py       # GET /.well-known/mcp
│   └── telemetry.py       # Anonymised per-call logging
├── SKILL.md               # Agent-readable usage guide (recipes, gotchas, anti-patterns)
├── quick_queries.json     # Eval set derived from your use cases
├── eval_cases.json        # LLM-generated evaluation cases
├── conformance_report.json
├── Dockerfile
└── pyproject.toml

SKILL.md is the key output. It's a structured document written for AI agents — not humans — that lists every tool with its parameters, operation modes, usage recipes, gotchas, and anti-patterns. Agents read it before making any calls, which dramatically reduces hallucinations and misuse.


How tools get designed

The LLM follows 2026 MCP design rules automatically:

Group CRUD. Three or more operations on the same resource become a single manage_X(operation=...) tool. Fewer tools, broader coverage, easier for agents to use.

Full lifecycle. The tool design phase reads your use cases and maps them to full API coverage — not just the happy path. Create, read, update, delete, list, and any lifecycle transitions (confirm, capture, cancel, finalize, void) are all included.

Compact + verbose. Every tool has a verbose flag. By default it returns only the essential fields. Pass verbose=true to get the full API response with metadata.

Discovery endpoint. Every server exposes GET /.well-known/mcp listing all tools and their disclosure levels.


Concrete example: Stripe

The official Stripe agent toolkit ships 15 flat tools covering create and list operations only. No updates, no deletes, no payment intent lifecycle, no checkout sessions, no coupons.

Running mcp-anything against the Stripe OpenAPI spec with a 41-item brief:

mcp-anything build --brief stripe.yaml -o ./stripe-mcp --target fastmcp
Official Stripe toolkitmcp-anything
Tools15 flat tools13 grouped tools
Customerscreate, listcreate, read, update, delete, list
Payment intentslist onlycreate, read, list, confirm, capture, cancel
Invoicescreate, finalizecreate, read, list, send, pay, void
Subscriptionscreate, cancelcreate, read, update, cancel, resume, list
Checkout sessionscreate, retrieve, expire
Coupons & promo codesfull support

13 tools, 100% brief coverage, 10+ capabilities absent from the official toolkit.


Concrete example: GitHub

The official GitHub MCP server is a hand-built Go project. Building it took months.

mcp-anything build --brief github.yaml -o ./github-mcp
Official (hand-built)mcp-anything
Build timeMonths~30 seconds
Tools51 flat tools22 grouped tools
CoverageCurated subset100% of in-scope operations
LanguageGoPython

22 tools cover the same 51 operations — a 57% reduction in surface area with no loss of capability. The grouping (manage_repository, manage_issue, manage_pull_request, etc.) is what agents actually prefer.

See examples/github-server/ for the full generated output.


Output targets

fastmcp (default)mcp-use
LanguagePythonTypeScript
SDKFastMCPmcp-use
Transportstdio / HTTPHTTP (port 3000)
Installpip install -e .npm install && npm run dev
mcp-anything build --brief my-api.yaml --target mcp-use
mcp-anything generate /path/to/app --target mcp-use

Transport

stdio (default): server runs as a local subprocess.

{
  "mcpServers": {
    "my-app": { "command": "mcp-my-app", "args": [] }
  }
}

HTTP (recommended for shared/remote use):

mcp-anything generate /path/to/app --transport http
# server runs at http://localhost:8000/sse
{
  "mcpServers": {
    "my-app": { "url": "http://localhost:8000/sse" }
  }
}

HTTP lets you deploy once and connect from any agent session, CI pipeline, or team member.


Framework support (generate mode)

27 source types across 8 ecosystems. Static detection, no LLM required.

EcosystemFramework / Source
Pythonargparse, Click, Typer, Flask, FastAPI, Django REST Framework
Java / KotlinSpring Boot, Spring MVC, JAX-RS / Quarkus, Micronaut
JavaScript / TypeScriptExpress.js
GoGin, Echo, Chi, gorilla/mux, Fiber, net/http
RubyRails
RustActix-web, Axum, Rocket, Warp
API SpecsOpenAPI 3.x / Swagger 2.x, GraphQL SDL, gRPC / Protobuf
Protocol / IPCWebSocket (JSON-RPC), MQTT, ZeroMQ, XML-RPC, raw socket, D-Bus

Scoping

Control which capabilities get exposed without editing the generated code.

# Include / exclude by glob
mcp-anything generate ./my-app --include "/api/v2/*" --exclude "/internal/*"

# Review mode: pause after analysis, curate scope.yaml, then resume
mcp-anything generate ./my-app --review
vim mcp-my-app-server/scope.yaml
mcp-anything generate ./my-app --resume

# Reusable scope file
mcp-anything generate ./my-app --scope-file ./mcp-scope.yaml

Roadmap

See ROADMAP.md for the full roadmap. See CONTRIBUTING.md to contribute.


Star History

Star History ChartStar History Chart

Stop writing MCP servers by hand.

Files in the repo

Repository payload13 top-level entries
  • examples
  • src
  • tests
  • .gitignore
  • banner.png
  • CLAUDE.md
  • CONTRACT.md
  • CONTRIBUTING.md
  • LICENSE
  • pyproject.toml
  • README.md
  • RELEASE_NOTES.md
  • ROADMAP.md

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