Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
An open-source platform to generate, configure, test, and deploy production-ready MCP servers from API specifications, with built-in security reviews, automated builds, and an interactive playground.
Jump to setup instructionsFetched from the repository for this visit.
Turn OpenAPI and Swagger specifications into production-ready Model Context Protocol (MCP) servers with an interactive testing Playground and real-time protocol trace streaming.
MCP Server Generator (mcp-forge) is a local-first, security-hardened developer tool that bridges existing REST APIs into the AI agent ecosystem. Both the Next.js web application and the Typer CLI share a single deterministic compilation engine.
The Model Context Protocol (MCP) provides an open standard for connecting AI applications—such as Claude Desktop, Cursor, and autonomous agent frameworks—to external data sources and tools. Manually writing an MCP server for an enterprise REST API is repetitive and error-prone, requiring schema translation, input validation, rate limiting, and credential handling.
MCP Server Generator automates this transition safely:
tools.json manifest and pairs it with an audited static runtime engine. It avoids unconstrained LLM code generation for tool dispatch.ast.parse) to guarantee no dynamic execution primitives (eval, exec, os.system, subprocess) can slip into generated projects.POST, PUT, DELETE) are disabled by default. AI agents receive read access only until an authorized engineer explicitly enables writing operations.The system is organized into clean functional layers sharing a single core engine:
flowchart TD
subgraph Client ["Client Interfaces"]
UI["Next.js 16 Web UI\n(App Router + Tailwind)"]
CLI["Typer CLI (forge)\n(Headless CI / Local)"]
end
subgraph API ["FastAPI Service (Port 8080)"]
ROUTER["API Routers\n(Projects, Specs, Builds, Playground)"]
AUTH["Security Middleware\n(Host Allowlist, CSRF, Auth Token)"]
DB[(SQLite 3 WAL\n+ Async SQLAlchemy)]
end
subgraph Core ["Deterministic Core Engine"]
INGEST["Ingest & SSRF Guard\n(Socket Pinning, DNS Rebinding Defense)"]
PARSE["Parser & Validator\n(OAS 3.x, Swagger 2.0, Depth Limits)"]
IR["IR Normalizer (IRApi)\n(Deterministic Operation Extraction)"]
MAP["Tool Mapper\n(Regex Identifier Gate, Safe Defaults)"]
REVIEW["Review Engine\n(SEC-001..006, QUAL-001..006)"]
RENDER["Jinja2 & AST Verifier\n(Blocks eval, exec, os.system)"]
end
subgraph Playground ["Testing Runtime"]
MGR["Session Manager\n(Process-Local Concurrency Limits)"]
SB["Process-Isolated Sandbox\n(Scrubbed Env, Pipe Drain)"]
MOCK["In-Process Mock Server\n(Starlette + Dynamic Generator)"]
TRACE["SSE Trace Bus\n(JSON-RPC 2.0 Frames)"]
end
subgraph Output ["Generated Artifacts"]
SRV["MCP Server Package\n(server.py + tools.json + Runtime)"]
ZIP["Deterministic ZIP\n(Fixed Timestamps, SHA256)"]
end
UI --> AUTH
CLI --> Core
AUTH --> ROUTER
ROUTER --> DB
ROUTER --> Core
INGEST --> PARSE --> IR --> MAP --> REVIEW --> RENDER
RENDER --> SRV --> ZIP
ROUTER --> MGR
MGR --> SB
MGR --> MOCK
SB --> TRACE
MOCK --> SB
TRACE --> UI
backend/src/mcp_forge/core): Pure-function pipeline that parses, validates, normalizes, reviews, and renders server code.mcp_forge/core/security/ssrf.py): Socket-level network backend that pins verified IP addresses to eliminate DNS rebinding / TOCTOU windows while preserving TLS SNI and certificate validation.mcp_forge/core/review): Static analyzer executing 12 automated checks for security vulnerabilities (unauthenticated mutations, prompt injection patterns, homoglyphs) and quality defects.mcp_forge/playground/sandbox.py): Spawns isolated server processes with scrubbed environment variables, bounded stderr ring-buffers to prevent OS pipe buffer deadlocks, and process-tree termination.flowchart LR
A["1. Ingest Spec\n(Upload, URL, Sample)"] --> B["2. Validate & Normalize\n(SSRF Check, Size Limit)"]
B --> C["3. Review Findings\n(Security & Quality Rules)"]
C --> D["4. Select Tools\n(Safe Read-Only Defaults)"]
D --> E["5. Generate & Package\n(AST Audit, ZIP Archive)"]
E --> F["6. Test in Playground\n(Mock / Live, Real-Time Trace)"]
F --> G["7. Connect AI Client\n(Claude Desktop, Cursor)"]
169.254.169.254) destinations.Content-Length headers safely.$ref resolution with circular reference cycle breaking and schema depth limits (20 levels).IRApi).^[a-z][a-z0-9_]{0,63}$.GET operations enabled; POST, PUT, DELETE disabled until approved.tools.json, executed by an audited runtime client.ast.parse) inspection rejecting any forbidden calls (eval, exec, os.system, subprocess).claude_desktop_config.json).mcp.json).uv run python server.py).| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16 (App Router), React 19, Tailwind CSS v4, TanStack Query | Reactive web interface, interactive playground, and real-time trace streaming |
| Backend API | FastAPI 0.115+, Uvicorn, Pydantic v2, Typer | High-performance asynchronous REST API and CLI tool |
| Database & ORM | SQLite 3 (WAL mode), SQLAlchemy 2.0 (asyncio), Alembic | Local-first relational persistence for projects, spec revisions, and audit findings |
| Core Parser | openapi-spec-validator, jsonschema, referencing, PyYAML | Specification validation, schema resolution, and YAML safety |
| MCP Runtime | Official Model Context Protocol SDK (mcp v2), HTTPX, httpcore | Client-server JSON-RPC communication and socket-pinned HTTP client |
| Testing & Quality | Pytest, Hypothesis, Respx, Vitest, Testing Library, Ruff, Mypy (Strict) | Property-based fuzzing, integration testing, static typing, and formatting |
| Deployment | Docker (multi-stage builds), Docker Compose, GitHub Actions | Containerized execution and automated CI/CD verification |
pnpm (v9 or v10)uv (recommended for Python packaging) and gitgit clone https://github.com/varunahuja70/MCP-Server-Generator.git
cd MCP-Server-Generator
make dev
This runs the FastAPI backend on http://127.0.0.1:8080 and the Next.js frontend on http://127.0.0.1:3000 with hot reloading.
cd backend
uv sync --extra dev
uv run uvicorn mcp_forge.api.app:create_app --factory --reload --port 8080
cd frontend
pnpm install --frozen-lockfile
pnpm dev
http://localhost:3000 in your browser.MCP Server Generator is configured via environment variables or a .env file in the working directory:
| Variable | Mode | Default | Description |
|---|---|---|---|
ENV | All | production | Environment mode (development or production). |
FORGE_MODE | All | local | Operating mode: local (loopback only) or exposed (requires token). |
FORGE_HOST | All | 127.0.0.1 | Network interface to bind. Non-loopback addresses are rejected in local mode. |
FORGE_PORT | All | 8080 | Port for the backend API. |
FORGE_PUBLIC_HOST | Exposed | None | Expected hostname for reverse-proxy Host allowlisting. |
FORGE_ACCESS_TOKEN | Exposed | None | Secret token required in exposed mode (minimum 16 characters). |
FORGE_DATA_DIR | All | ./data | Directory for SQLite database (forge.sqlite3) and build artifacts. |
DATABASE_URL | All | Derived | Async SQLAlchemy connection string (sqlite+aiosqlite:///data/forge.sqlite3). |
MAX_SPEC_BYTES | All | 10485760 | Maximum specification upload size in bytes (10 MB). |
PIPELINE_TIMEOUT_S | All | 30 | Maximum wall-clock execution time for parsing and generation pipelines. |
PLAYGROUND_ENABLED | All | true (local) | Whether to permit launching interactive playground server processes. |
PLAYGROUND_MAX_SESSIONS | All | 3 | Maximum concurrent active playground sessions. |
PLAYGROUND_IDLE_TIMEOUT_S | All | 900 | Session idle timeout in seconds before automatic cleanup (15 minutes). |
TRACE_RETENTION_DAYS | All | 7 | Retention period for recorded trace events. |
ALLOW_PRIVATE_SPEC_URLS | All | false | When true, permits fetching specs from private RFC 1918 subnets (trusted dev only). |
LOG_LEVEL | All | info | Structured logging verbosity (debug, info, warning, error). |
forge)The CLI provides headless validation, review, and generation for automated scripts and CI pipelines:
cd backend
# Validate an OpenAPI specification
uv run forge check samples/bookshop.openapi.yaml
# Run security and quality audit
uv run forge review samples/bookshop.openapi.yaml
# Generate an MCP server with safe read-only defaults
uv run forge generate samples/bookshop.openapi.yaml -o ./dist/bookshop-mcp
# Generate with specific tools enabled and JSON output for CI pipelines
uv run forge generate samples/bookshop.openapi.yaml -o ./dist/bookshop-mcp --select listBooks --json
# Seed bundled sample projects into local database
uv run forge samples --seed
Every generated project is completely self-contained and ready to execute:
bookshop-mcp/
├── runtime/
│ ├── auth.py # API Key, Bearer Token, and Basic Auth handling
│ ├── client.py # Resilient HTTP client with retry and timeout policies
│ ├── config.py # Environment variable settings
│ ├── logging.py # Structured JSON logging to stderr with redaction
│ ├── rate_limit.py # Token-bucket rate limiting
│ ├── request_builder.py # Path, query, and header parameter assembly
│ └── response.py # Response size limits and error normalization
├── server.py # Main Model Context Protocol server entry point
├── tools.json # Canonical schema-validated tools manifest
├── pyproject.toml # Standalone Python packaging metadata
├── Dockerfile # Production container build definition
├── .env.example # Environment configuration template
└── README.md # Quick-start instructions and client configs
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"bookshop": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/bookshop-mcp", "python", "server.py"],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_KEY": "your-api-key-here"
}
}
}
}
MCP-Server-Generator/
├── .github/
│ ├── workflows/ci.yml # CI pipeline (lint, strict types, pytest, vitest, build, audit)
│ ├── workflows/release.yml # Tagged release wheel and container publication
│ └── dependabot.yml # Automated dependency update configuration
├── backend/
│ ├── src/mcp_forge/
│ │ ├── api/ # FastAPI routes, middleware, dependencies, schemas
│ │ ├── cli/ # Typer CLI application (check, review, generate, serve, samples)
│ │ ├── core/ # Ingest, parser, IR normalizer, tool mapper, review, render
│ │ ├── db/ # SQLAlchemy models, SQLite WAL session management, Alembic migrations
│ │ ├── mock_api/ # In-process mock API server for Playground testing
│ │ ├── playground/ # Session manager, sandbox launcher, SSE trace bus
│ │ ├── services/ # Build management, deterministic ZIP packaging
│ │ └── templates/ # Jinja2 templates and runtime code for generated servers
│ ├── tests/ # 193 automated unit, security, integration, and performance tests
│ ├── Dockerfile # Backend container build definition
│ └── pyproject.toml # Python packaging configuration and dependency lockfile
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js 16 App Router pages (Projects, Review, Builds, Playground)
│ │ ├── components/ # Reusable UI components (Navbar, SchemaForm, CodeViewer, FileTree)
│ │ ├── lib/ # API client, React Query hooks, query cache management
│ │ ├── styles/ # Tailwind CSS stylesheet and design tokens
│ │ └── test/ # Frontend smoke, component, and schema form unit tests
│ ├── Dockerfile # Frontend Next.js production build definition
│ └── package.json # Node.js dependencies and build scripts
├── samples/ # Bundled OpenAPI 3.0/3.1 and Swagger 2.0 specifications
├── docs/ # Architecture, PRD, security model, and deployment guides
├── docker-compose.yml # Production container composition
├── docker-compose.dev.yml # Development container composition
├── Makefile # Unified development and testing commands
├── SECURITY.md # Private vulnerability disclosure guidelines
├── CONTRIBUTING.md # Contributor setup and coding standards
└── LICENSE # MIT License
All changes are verified through strict automated checks across backend and frontend:
pytest with 86% coverage, including 12 dedicated security test suites).vitest with Testing Library).# Backend checks
cd backend
uv run ruff check . # Lint check
uv run ruff format --check . # Code format check
uv run mypy src tests # Strict type checking (137 source files, 0 errors)
uv run pytest --cov=mcp_forge # Complete test suite with coverage
uv run pip-audit # Dependency vulnerability audit
# Frontend checks
cd frontend
pnpm lint # ESLint validation
pnpm tsc --noEmit # TypeScript static type check
pnpm test # Vitest test execution
pnpm build # Next.js production compilation
pnpm audit --prod --audit-level=high # Production dependency audit
tools.json and runtime request data. No user-supplied text is ever interpolated into Python executable code.eval, exec, __import__, subprocess, os.system) are present.FORGE_ACCESS_TOKEN, DATABASE_URL) are omitted, and critical runtime variables cannot be overridden by user input.X-Forge-Request: 1 header and validate Origin and Host headers (including bracketed IPv6 representations).1 uvicorn worker). Multi-worker deployments (e.g., uvicorn -w 4) are not supported for interactive playground sessions without an external process supervisor.$ref Resolution: Resolving $ref targets across remote HTTP endpoints is disabled by default (ALLOW_REMOTE_REFS=false) to prevent blind server-side requests and supply-chain vulnerabilities.Please report security vulnerabilities privately via GitHub Security Advisories. We acknowledge valid reports within 48 hours.
We welcome contributions! Please review CONTRIBUTING.md for local workspace setup, code standards, and branch conventions. All submissions are governed by the Contributor Covenant Code of Conduct.
This project is licensed under the MIT License — see the LICENSE file for details.
GitHub checked 16h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.