mcp-forge
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-forgescaffold a new MCP server project with a hello world tool"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
"The FastAPI moment for MCP servers."
⭐ What Is mcp-forge?
mcp-forge eliminates MCP server boilerplate entirely. You write a typed Python function. The framework derives the JSON Schema from your type hints, validates inputs at runtime, and exposes the tool over STDIO, HTTP, or SSE — without changing a single line of your logic.
Every MCP server starts the same way: hand-craft JSON Schema, wire a transport loop, handle notifications/initialized, redirect stderr, copy-paste validation logic. mcp-forge does all of that for you.
from mcp_forge import Forge
app = Forge(name="my-server", version="1.0.0")
@app.tool(description="Search the knowledge base")
async def search(query: str, limit: int = 10) -> list[dict]:
"""Returns ranked results for the given query."""
... # your logic here
if __name__ == "__main__":
app.run() # STDIO — Claude Desktop / Cursor / VS Code readyNo JSON Schema by hand. No transport boilerplate. No config files.
Related MCP server: Berry MCP Server
⚡ Core Doctrine
These are not features. These are design laws.
☔ Principle | 🔧 Implementation |
Schema is Derived, Never Written | Pydantic v2 generates full draft-07 JSON Schema from type hints — automatically |
Transport is a Runtime Concern | STDIO · HTTP · SSE — switch with one flag, tool code never changes |
Contrib is Opt-In |
|
Strict by Default | mypy strict + ruff + 100% typed public API — no surprises in production |
Testing Without a Server |
|
Zero Boilerplate |
|
🚀 Quick Start
# Install
pip install mcp-forge
# Scaffold + run
mcp-forge new my-server && cd my-server
mcp-forge run --reloadConnect to Claude Desktop in 30 seconds:
{
"mcpServers": {
"my-server": {
"command": "python",
"args": ["-m", "my_server"]
}
}
}Switch to HTTP transport with one flag:
mcp-forge run --transport http --port 8080✨ Features
Feature | Description |
🏗️ Declarative Tools |
|
🧠 Auto JSON Schema | Pydantic v2 under the hood — full draft-07 generated from type hints |
✅ Runtime Validation | Inputs validated before execution — errors as proper MCP-spec responses |
🚀 Multi-Transport | STDIO · HTTP · SSE — switch at runtime, logic unchanged |
⏳ Async-First |
|
🔌 Contrib Routers |
|
🧪 Testing Client |
|
📦 PEP 561 Typed | Ships |
📚 Examples
Minimal server
from mcp_forge import Forge
app = Forge(name="calculator")
@app.tool()
def add(a: float, b: float) -> float:
"""Add two numbers."""
return a + b
app.run()With contrib tools
from mcp_forge import Forge
from mcp_forge.contrib import memory, filesystem, web
app = Forge(name="agent-tools")
app.include(memory) # remember(), recall(), forget(), list_memory()
app.include(filesystem) # read_file(), write_file(), list_dir(), delete_file()
app.include(web) # fetch_url()
app.run()Unit testing — no server needed
from mcp_forge.testing import ForgeTestClient
client = ForgeTestClient(app)
def test_add():
result = client.call("add", {"a": 2, "b": 3})
assert result == 5📁 Architecture
mcp-forge/
├── core/
│ ├── forge.py ← Forge class — declarative app entrypoint
│ ├── schema.py ← Auto JSON Schema from Pydantic v2
│ ├── validator.py ← Input/output validation engine
│ ├── config.py ← ForgeConfig dataclass
│ └── exceptions.py ← MCP-aligned exception hierarchy
├── transports/
│ ├── stdio.py ← STDIO — MCP spec 2024-11-05 compliant
│ ├── http.py ← HTTP — FastAPI-based REST transport
│ └── sse.py ← SSE — Server-Sent Events streaming
├── cli/
│ └── main.py ← Typer CLI — new, run, validate, build
└── contrib/
├── memory.py ← Scoped in-process memory store
├── filesystem.py ← Safe filesystem tools with path sandboxing
└── web.py ← HTTP fetch with timeout and error handling📦 Installation
# Core only (STDIO transport)
pip install mcp-forge
# With HTTP + SSE transports
pip install "mcp-forge[http]"
# Everything
pip install "mcp-forge[all]"Requires: Python 3.11+ · pydantic>=2.0
🌍 Ecosystem Compatibility
Client | Transport | Status |
Claude Desktop | STDIO | ✅ Tested |
Cursor | STDIO | ✅ Tested |
VS Code (GitHub Copilot) | STDIO · HTTP | ✅ Tested |
Continue.dev | HTTP · SSE | ✅ Tested |
Custom LLM agents | HTTP · SSE | ✅ Tested |
🤝 Contributing
Contributions are welcome. See CONTRIBUTING.md for the full guide.
git clone https://github.com/benni-os/mcp-forge
cd mcp-forge
pip install -e ".[dev]"
pytest🐛 Found a bug? → Open an issue
💡 Have an idea? → Start a discussion
📜 See what's planned → ROADMAP.md
🌐 Benni OS Ecosystem
Product | Repo | Role | Status |
🧠 Benni Master OS | General Brain — sovereign orchestrator | 🟢 Live | |
⚡ Benni Gravity | Local operator runtime | 🟢 Ativo | |
🔌 Operator Gateway | Open-source MCP HTTP gateway | 🟢 MIT | |
🐍 mcp-forge | FastAPI-style Python MCP framework — you are here | 🟢 PyPI | |
⚡ benni-nexus | LLM gateway — route, balance, observe | 🟢 npm | |
🛠️ Benni Control Plane | MCP on Railway | NEXUS v5 — persistent memory layer | 🟢 Railway |
🤖 JARVAS-2 | Autonomous dispatch + Wave 6 billing | 🔥 Hot | |
🛍️ Modo Operador | Produto BR — R$97 | 🟢 Live |
mcp-forge — Open-Source Python MCP Framework by Benni OS
ZERO_BOILERPLATE • AUTO_SCHEMA • MULTI_TRANSPORT • STRICT_TYPING • MIT_LICENSE
Built by Benni Alencar · If mcp-forge saves you time, give it a ⭐
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Primarily to be used as a template repository for developing MCP servers with FastMCP in Python, P…
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceA production-ready MCP server built with FastAPI, providing an enhanced tool registry for creating, managing, and documenting AI tools for Large Language Models (LLMs).34-
- AlicenseNot gradedqualityDmaintenanceA universal framework for creating and deploying custom Model Context Protocol (MCP) tool servers with decorator-based tool registration, supporting multiple transports and automatic JSON schema generation for AI assistants.1MIT
- AlicenseBqualityDmaintenanceA Python library to build MCP servers with decorators, auto-generating JSON Schema from type hints and including built-in filesystem and HTTP servers.3MIT
- FlicenseNot gradedqualityDmaintenanceA Python-based MCP server that exposes tools over streamable HTTP using FastAPI, enabling connection to AI assistants like Cursor. Supports multiple servers mounted in a single FastAPI app.-