Skip to main content
Glama
benni-os

mcp-forge

by benni-os

PyPI Python CI License: MIT mypy strict Part of Benni OS

"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 ready

No 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

app.include(memory) adds tools; you stay in control, zero forced dependencies

Strict by Default

mypy strict + ruff + 100% typed public API — no surprises in production

Testing Without a Server

ForgeTestClient calls tools directly — no sockets, no mocking, no overhead

Zero Boilerplate

@app.tool() is the entire registration API — one decorator, full MCP compliance

🚀 Quick Start

# Install
pip install mcp-forge

# Scaffold + run
mcp-forge new my-server && cd my-server
mcp-forge run --reload

Connect 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

@app.tool() — no schema files, no registration calls

🧠 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

async def and def tools work side by side — no event loop management

🔌 Contrib Routers

memory · filesystem · web — one-line include

🧪 Testing Client

ForgeTestClient — no server, no mocking, no sockets

📦 PEP 561 Typed

Ships py.typed — full mypy strict + Pyright support

📚 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

🌐 Benni OS Ecosystem

Product

Repo

Role

Status

🧠 Benni Master OS

benni-os/Benni-Master-OS

General Brain — sovereign orchestrator

🟢 Live

Benni Gravity

benni-os/Benni-gravity-0

Local operator runtime

🟢 Ativo

🔌 Operator Gateway

benni-os/benni-operator-gateway

Open-source MCP HTTP gateway

🟢 MIT

🐍 mcp-forge

benni-os/mcp-forge

FastAPI-style Python MCP framework — you are here

🟢 PyPI

benni-nexus

benni-os/benni-nexus

LLM gateway — route, balance, observe

🟢 npm

🛠️ Benni Control Plane

MCP on Railway

NEXUS v5 — persistent memory layer

🟢 Railway

🤖 JARVAS-2

benni-os/jarvas-2

Autonomous dispatch + Wave 6 billing

🔥 Hot

🛍️ Modo Operador

benni-os/modo-operador

Produto BR — R$97

🟢 Live

mcp-forgeOpen-Source Python MCP Framework by Benni OS

ZERO_BOILERPLATEAUTO_SCHEMAMULTI_TRANSPORTSTRICT_TYPINGMIT_LICENSE

Built by Benni Alencar · If mcp-forge saves you time, give it a ⭐

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Primarily to be used as a template repository for developing MCP servers with FastMCP in Python, P…

  • Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.

  • An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/benni-os/mcp-forge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server