Skip to main content

Generate MCP servers instantly from any OpenAPI, GraphQL, codebase, CLI or website

Project description

mcp-forge

Generate production-ready MCP servers instantly from any source — OpenAPI spec, GraphQL schema, codebase, CLI tool, or website.

pip install mcp-forge
mcp-forge https://petstore3.swagger.io/api/v3/openapi.json

What it does

mcp-forge analyses your source, extracts all callable operations, optionally enriches them with an LLM, and writes a fully working MCP server (server.py + requirements.txt) ready to plug into Claude Desktop or any MCP client.

Supported sources

Source Example
OpenAPI / Swagger mcp-forge https://api.example.com/openapi.json
GraphQL mcp-forge https://countries.trevorblades.com/graphql
Codebase (20+ languages) mcp-forge ./my-project
CLI application mcp-forge git
Website mcp-forge https://docs.example.com

Supported languages for codebase analysis: Python, JavaScript, TypeScript, Go, Rust, Java, C/C++, C#, PHP, Ruby, Kotlin, Swift, Scala, Dart, Elixir, R, Fortran, Bash, PowerShell, Groovy, Julia, Lua, COBOL.

Installation

pip install mcp-forge

Requires Python 3.11+.

For website scraping support:

playwright install chromium

Quick start

# From an OpenAPI URL
mcp-forge https://petstore3.swagger.io/api/v3/openapi.json

# From a local GraphQL schema
mcp-forge ./schema.graphql --type graphql

# From a codebase
mcp-forge ./my-python-project

# From a CLI tool
mcp-forge ffmpeg --type cli_app

# Specify output directory and server name
mcp-forge https://api.example.com/openapi.json --output ~/mcp-servers --name my_api

The generated server is written to ../mcp-forge-output/<server_name>/ by default (outside the project directory).

Options

mcp-forge [SOURCE] [OPTIONS]

Arguments:
  SOURCE    URL, OpenAPI file, GraphQL schema, CLI command, or directory

Options:
  --mode, -m        auto | semi | guided  (default: auto)
  --output, -o      Output directory      (default: ../mcp-forge-output)
  --type, -t        Force source type: openapi | graphql | codebase | cli_app | website
  --name, -n        Server name           (default: inferred from source)
  --name-style, -ns short | exhaustive    (default: short)
  --no-llm          Skip LLM enrichment
  --smoke-test      Run smoke test after generation
  --functional-test Run functional MCP test after generation
  --config, -c      Path to mcp-forge.yaml config file
  --api-key         Anthropic API key (or set ANTHROPIC_API_KEY)

Modes

Mode Description
auto Fully automatic — no prompts, JSON output on stdout
semi Confirms key decisions, interactive where needed
guided Step-by-step with full control over every tool

LLM enrichment

By default, mcp-forge uses Claude (Anthropic) to improve tool names and descriptions. Set your API key:

export ANTHROPIC_API_KEY=sk-ant-...
mcp-forge https://api.example.com/openapi.json

To skip enrichment:

mcp-forge https://api.example.com/openapi.json --no-llm

Config file

Create mcp-forge.yaml in your project root (see mcp-forge.example.yaml):

source: https://api.example.com/openapi.json
mode: auto
output: ../mcp-servers
name_style: short
no_llm: false
functional_test: true

Run with:

mcp-forge --config mcp-forge.yaml

Testing generated servers

# Smoke test — checks import and mcp object
mcp-forge smoke-test ../mcp-forge-output/my_server

# Functional test — starts server, MCP handshake, calls every tool
mcp-forge functional-test ../mcp-forge-output/my_server

Connecting the generated server to an AI agent

Once mcp-forge has generated your server, you need to register it in your AI client so it can call the tools.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "my_api": {
      "command": "uv",
      "args": ["run", "--with", "mcp", "mcp", "run", "server.py"],
      "cwd": "/path/to/mcp-forge-output/my_api"
    }
  }
}

Restart Claude Desktop — your tools appear automatically in the conversation.

Claude Code (CLI)

claude mcp add my_api uv -- run --with mcp mcp run server.py \
  --cwd /path/to/mcp-forge-output/my_api

Or edit .mcp.json at the root of your project:

{
  "mcpServers": {
    "my_api": {
      "command": "uv",
      "args": ["run", "--with", "mcp", "mcp", "run", "server.py"],
      "cwd": "/path/to/mcp-forge-output/my_api"
    }
  }
}

Cursor

Open Settings > MCP > Add new global MCP server and paste:

{
  "my_api": {
    "command": "uv",
    "args": ["run", "--with", "mcp", "mcp", "run", "server.py"],
    "cwd": "/path/to/mcp-forge-output/my_api"
  }
}

VS Code (Copilot / Continue)

In .vscode/mcp.json at the root of your workspace:

{
  "servers": {
    "my_api": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--with", "mcp", "mcp", "run", "server.py"],
      "cwd": "/path/to/mcp-forge-output/my_api"
    }
  }
}

Windsurf

Open Windsurf Settings > Cascade > MCP servers > Add Server:

{
  "my_api": {
    "command": "uv",
    "args": ["run", "--with", "mcp", "mcp", "run", "server.py"],
    "cwd": "/path/to/mcp-forge-output/my_api"
  }
}

Any MCP-compatible client (generic)

All clients that implement the MCP spec accept a STDIO transport. The pattern is always the same:

command : uv
args    : run --with mcp mcp run server.py
cwd     : /path/to/mcp-forge-output/<server_name>
env     : { "MY_API_KEY": "..." }   ← optional, for authenticated APIs

Tip — authenticated APIs: if your server was generated from an API that requires authentication, set the relevant environment variable in the env block. The generated server.py reads credentials from environment variables — no secrets are hardcoded.


CI/CD integration

GitHub Actions, Jenkins and GitLab CI pipeline templates are included in the ci/ directory and generated alongside each server.

Example GitHub Actions step:

- name: Generate MCP server
  run: |
    pip install mcp-forge
    mcp-forge https://api.example.com/openapi.json --mode auto --no-llm

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vulcai_mcp_forge_cli-0.1.6-py3-none-any.whl (121.1 kB view details)

Uploaded Python 3

File details

Details for the file vulcai_mcp_forge_cli-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: vulcai_mcp_forge_cli-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 121.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vulcai_mcp_forge_cli-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f13211841203af30e1b887390e039d30c2e4603522513df015bcfb63a5ebfa64
MD5 b95e135687b3aefa336e1f060798d6da
BLAKE2b-256 d73427e972d9cdf8ae0fc8329c55ed5ab5c3becded898a6673c547a697fd3e69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page