Skip to main content

mcpsmith

Turn an OpenAPI/Swagger file, or a website session you recorded in the browser, into a curated, tested MCP server project. An LLM designs the tools; you get ordinary Python code you own.

Most generators mirror every endpoint as a tool and hand the model raw JSON, or stop at an OpenAPI spec or API client. mcpsmith designs a few workflow-level tools with plain argument names, descriptions that say when to call what next, and compact output. The input is an OpenAPI file or a HAR recording, so sites with no public API work too. The output is a server project with tests, CI, a PyPI + MCP Registry publish workflow and a Claude Code plugin.

Quickstart: OpenAPI

uvx mcpsmith inspect https://petstore3.swagger.io/api/v3/openapi.json   # .mcpsmith/source.json + digest.md
uvx mcpsmith draft --name petstore-mcp                                  # heuristic .mcpsmith/plan.yaml, no LLM
# redesign plan.yaml (your coding agent does this, or use `design`, see below)
uvx mcpsmith validate
uvx mcpsmith generate -o petstore-mcp
cd petstore-mcp && uv run pytest
uvx mcpsmith check .                                                    # call every tool live
claude mcp add petstore-mcp -- uv run --directory "$PWD" petstore-mcp

A spec read from a local file may only have a relative server URL; validate then asks you to set an absolute base_url in the plan.

Quickstart: a website without an API

pip install "mcpsmith[capture]" && playwright install chromium
mcpsmith capture https://example.com -o site.har --host example.com   # browse, then close the tab
mcpsmith inspect site.har --host example.com
mcpsmith draft --name example-mcp
# redesign plan.yaml, then validate, generate, check as above

While recording, do each thing you want as a tool: search, open a detail page, paginate, apply a filter. Anything you do not click is not in the capture. --host (repeatable) keeps only the hosts you list. A DevTools "Save all as HAR" export works in place of capture. The recording browser uses HTTPS_PROXY when it is set.

A HAR holds everything the browser sent and received, including cookies and your personal data: keep it out of git and delete it after inspect. inspect scrubs what it keeps: an API key or token becomes an auth env var with its value dropped, other secret-looking headers and query params are dropped, and emails, phone numbers, JWTs and values under secret or personal field names are masked in examples and test fixtures. This is pattern-based, so read tests/fixtures/ before you publish a generated server. If a key is a public one the site sends to every visitor (a search or maps key), you may put it in the tool's fixed values.

Use it from your agent

No API key needed: your coding agent is the designer.

  • Claude Code plugin (skills + MCP server): /plugin marketplace add sepehr071/mcpsmith, then /plugin install mcpsmith@mcpsmith.
  • MCP server only, any client:
    {"mcpServers": {"mcpsmith": {"command": "uvx", "args": ["mcpsmith", "mcp"]}}}
    
    Tools: smith_guide, smith_inspect, smith_draft, smith_validate, smith_generate, smith_check (paths absolute).
  • Skills: skills/build-mcp-server (the whole workflow) and skills/design-mcp-tools (design checklist). AGENTS.md points other agents (Codex, Cursor, Gemini CLI) at them.

Then ask: "Build an MCP server for this OpenAPI file; users should be able to find pets and check stock."

Let mcpsmith call an LLM

uvx mcpsmith design --goal "find products, compare prices, read reviews" --provider anthropic

Providers: anthropic (ANTHROPIC_API_KEY), openai (OPENAI_API_KEY), openrouter (OPENROUTER_API_KEY), ollama (no key). --model picks the model; MCPSMITH_MODEL and MCPSMITH_BASE_URL override the model and endpoint. The result is the same plan.yaml; review it before generate.

How it works

openapi.yaml | site.har --inspect--> source.json + digest.md
                        --draft----> plan.yaml     (heuristic starting point)
   your agent edits plan.yaml, or `design` ------> plan.yaml
                        --validate-> issues
                        --generate-> <name>/       (server project)
                        --check----> live report per tool

Source is what the API offers; Plan is the server to build; code generation reads the plan plus captured responses for test fixtures. A plan, trimmed:

name: shop-mcp
description: Search products and compare prices on Example Shop.
prefix: shop
base_url: https://example.com/api
env_prefix: SHOP_MCP
instructions: Search first, then fetch details with the id. Prices are in toman.
tools:
  - name: shop_search
    title: Search products
    description: Returns matching products with price and stock. Use shop_product for full details.
    endpoint: GET /v2/search
    args:
      - {name: query, type: string, required: true, description: "Search words, e.g. 'laptop'", to: query.q}
      - {name: max_price, type: integer, description: "Upper price limit in toman, e.g. 20000000", to: query.price_max}
      - {name: sort, description: "Result order.", map: {cheapest: price_asc, newest: date_desc}, default: cheapest, to: query.o}
    output:
      root: data.products
      fields: {id: id, title: title_fa, price: price.selling_price, in_stock: stock.available}
      max_items: 10
    example: {query: laptop}

Argument targets (to:): path.<n>, query.<n>, header.<n>, cookie.<n>, body, body.<a.b.c>. Output paths use dots, a number indexes a list (images.0.url), [] maps over a list (tags[].name). map turns friendly values the model sees into the cryptic ones the API wants.

What you get

<name>/
  pyproject.toml  server.json  README.md  LICENSE  .gitignore  mcpsmith.yaml
  src/<package>/server.py        # tools, built on mcpsmith.runtime
  tests/                         # replay captured responses; one -m live test per tool
  .github/workflows/             # ci.yml, publish.yml (PyPI + MCP Registry)
  .claude-plugin/plugin.json     # Claude Code plugin
  skills/<name>/SKILL.md         # skill for the generated server

mcpsmith.yaml is the plan, so you can regenerate. To publish: add a PyPI trusted publisher (workflow publish.yml, environment pypi), bump the version in pyproject.toml and server.json, tag v*.

Runtime features

Generated servers import mcpsmith.runtime, so a fix there reaches every server on upgrade.

  • Retries on network errors, timeouts, 429 and 5xx (writes only on 429, so they are never sent twice); Retry-After honoured and capped; jitter; concurrency cap.
  • GET response cache, host allowlist, 5 MB body cap.
  • Proxy support: <P>_PROXY takes one URL or a comma list (pool). <P>_BASE_URL overrides the base URL. System proxy env vars are ignored on purpose.
  • Chrome TLS fingerprint for sites that block plain clients: pip install "mcpsmith[stealth]" and impersonate: true in the plan. Without the extra it falls back to plain httpx with one warning.
  • Compact output: shape() keeps only the planned fields, caps lists (reports the total count), clips long strings, drops nulls.
  • Actionable errors: a 403 suggests setting <P>_PROXY, a 401 names the auth env var, 404/429/5xx say what to do next.
  • Auth: bearer, header, query, cookie or basic, read from an env var.

Drift check

mcpsmith check <project> [--json] calls every tool with its example arguments and reports errors, output size in characters and output fields that came back empty. Run it nightly in CI to see when an API or site changes. It makes real calls, so tools marked read_only: false are skipped unless you pass --writes.

Comparison

Input Output Tool design Response shaping Drift check Open source
mcpsmith OpenAPI, HAR Python MCP project LLM-designed plan per-tool root/fields/max_items mcpsmith check yes
FastMCP from_openapi OpenAPI runtime proxy one tool per endpoint; manual route maps / transforms raw JSON no yes
openapi-mcp-generator OpenAPI TypeScript server one tool per endpoint; x-mcp to pick raw JSON no yes
Speakeasy / Gram OpenAPI TypeScript or hosted manual toolsets experimental no Gram yes
Stainless OpenAPI npm package code mode (search + execute) n/a no no
mitmproxy2swagger, har-to-openapi HAR / traffic OpenAPI spec none none no yes
Integuru, reverse-api-engineer HAR / browsing API client code, not MCP none none no yes
Supergood, Wire site walkthrough hosted API / MCP managed managed vendor claims no

Compiled from each project's public docs in October 2026; check them before relying on a cell. FastMCP's own docs say curated servers clearly beat auto-converted ones.

Limitations

  • No browser per call: JS challenges and captchas are out of scope. Sites that need them will fail at check.
  • A tool maps to one request. Multi-call workflow tools need hand edits to the generated server.py, and regenerating overwrites them.
  • The generated project is Python only.
  • A HAR only contains what you did while recording; unrecorded features are not in the plan.
  • Request bodies are sent as JSON; endpoints that only accept application/x-www-form-urlencoded or multipart need a hand edit.
  • The plan is trusted input: its text ends up in server instructions and the skill, and mcpsmith check runs the generated code. Review a plan written by an LLM from third-party content before you generate and publish it.
  • Alpha (0.1).

Develop

uv sync
uv run pytest
uv run ruff check .

License

MIT

Metadata

Release files for mcpsmith 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcpsmith 0.1.0
File Size Uploaded Provenance
mcpsmith-0.1.0.tar.gz 178.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcpsmith 0.1.0
File Interpreter ABI Platform
mcpsmith-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 243.9 kB

Release files / mcpsmith-0.1.0.tar.gz

Download URL mcpsmith-0.1.0.tar.gz
Size 178.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a02cb6aaded39e7018ab1564454cceaf9d6db7e10c4f15b0ba8e28f834e3060
BLAKE2b-256 checksum
How to use checksums
350fa2b6d51b678f6615f5b03498a8b71ab704fff4b05c48450bf0a1359dcf67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / mcpsmith-0.1.0-py3-none-any.whl

Download URL mcpsmith-0.1.0-py3-none-any.whl
Size 65.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
855cecebb97ef25faf0f6105f11019884cfb34de99cc31ac7e8ebf59ec80f192
BLAKE2b-256 checksum
How to use checksums
748ba316d3631a9ac6b162404ebee493513240c227b3a71df9d0140deece8cfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for mcpsmith 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcpsmith-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page