fastmcp-forge 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Johann Schiffer / NEXUS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmcp-forge
3
+ Version: 1.0.1
4
+ Summary: Enterprise Model Context Protocol (MCP) Server Boilerplate & CLI Generator
5
+ Author: Johann Schiffer
6
+ License: MIT
7
+ Project-URL: Homepage, https://johannschiffer.github.io
8
+ Project-URL: Repository, https://github.com/johannschiffer/fastmcp-forge
9
+ Project-URL: Starter Kit, https://johanld.gumroad.com/l/genesis-starter-kit
10
+ Project-URL: Enterprise Suite, https://johanld.gumroad.com/l/genesis-enterprise-suite
11
+ Keywords: mcp,model-context-protocol,fastmcp,boilerplate,scaffolding,claude,cursor,ai-agent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest>=7; extra == "test"
17
+ Dynamic: license-file
18
+
19
+ # FastMCP Forge (Lite Edition)
20
+
21
+ <a href="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge">
22
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge/badge" alt="fastmcp-forge MCP server" />
23
+ </a>
24
+
25
+
26
+ > **Free:** [Genesis Starter Kit](https://johanld.gumroad.com/l/genesis-starter-kit) (25 `.cursorrules`/`CLAUDE.md` rulesets + MCP configs). Try the [live config builder](https://johannschiffer.github.io).
27
+ > **Full stack:** all six servers in [Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite).
28
+
29
+
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
31
+ [![Python 3.10+](https://img.shields.io/badge/Python-3.10+-brightgreen.svg)](https://python.org)
32
+ [![MCP Compliant](https://img.shields.io/badge/MCP-2024--11--05-purple.svg)](https://modelcontextprotocol.io)
33
+
34
+ **FastMCP Forge** is an ergonomic framework and CLI scaffolding engine that enables Python developers to build, test, and package compliant **Model Context Protocol (MCP)** servers in seconds.
35
+
36
+ ---
37
+
38
+ ## Run without cloning
39
+
40
+ ```bash
41
+ uvx fastmcp-forge
42
+ ```
43
+
44
+ Claude Desktop / Cursor config entry:
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "fastmcp-forge": {
50
+ "command": "uvx",
51
+ "args": [
52
+ "--from",
53
+ "git+https://github.com/johannschiffer/fastmcp-forge",
54
+ "fastmcp-forge"
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ [![CI](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml)
62
+
63
+ ## ⚡ The Problem: MCP Boilerplate Burnout
64
+
65
+ In 2026, every AI developer is building MCP servers to connect tools to **Claude Desktop**, **Cursor**, **Windsurf**, and **Antigravity**. However, writing raw JSON-RPC 2.0 handlers from scratch requires:
66
+ - Manually parsing JSON schemas for tool arguments.
67
+ - Handling error codes (-32600, -32601, -32602, -32000).
68
+ - Managing `sys.stdin` and `sys.stdout` stream buffers.
69
+ - Writing test harnesses to mock agent tool invocations.
70
+
71
+ **FastMCP Forge** gives you an intuitive `@app.tool` decorator that introspects function signatures, infers types, generates valid schemas, and creates automated test suites instantly.
72
+
73
+ ---
74
+
75
+ ## 🛠️ Code Example: Build an MCP Server in 10 Lines
76
+
77
+ ```python
78
+ from fastmcp_forge.server import FastMCP
79
+
80
+ app = FastMCP(name="math-mcp", version="1.0.0")
81
+
82
+ @app.tool(description="Multiply two numbers safely")
83
+ def multiply(a: float, b: float) -> float:
84
+ return a * b
85
+
86
+ if __name__ == "__main__":
87
+ app.run_stdio()
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 🚀 CLI Project Scaffolder
93
+
94
+ Generate a full production-ready project with tests in 1 second:
95
+
96
+ ```bash
97
+ python -m fastmcp_forge.cli new analytics-mcp
98
+ ```
99
+
100
+ Output:
101
+ ```text
102
+ [OK] Created new FastMCP project 'analytics-mcp'
103
+ Generated files:
104
+ - server.py
105
+ - tests/test_server.py
106
+ - README.md
107
+ - requirements.txt
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 🖥️ Client Configuration
113
+
114
+ Add to your `claude_desktop_config.json`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "my-server": {
120
+ "command": "python",
121
+ "args": ["server.py"],
122
+ "cwd": "/path/to/my-server"
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 💎 Need Enterprise Remote Deployment? Upgrade to FastMCP Forge Pro
131
+
132
+ Deploying MCP servers as remote team microservices, behind authentication proxies, or in production clouds?
133
+
134
+ | Feature | Lite (Open Source) | Enterprise Suite ($19) |
135
+ |---|:---:|:---:|
136
+ | **@tool Schema Introspection** | ✅ | ✅ |
137
+ | **JSON-RPC 2.0 stdio Transport** | ✅ | ✅ |
138
+ | **CLI Project Scaffolding** | ✅ | ✅ |
139
+ | **Dual Transport: stdio + Remote SSE HTTP** | ❌ | ✅ |
140
+ | **Security & Auth Middleware** *(API Keys & Bearer Tokens)* | ❌ | ✅ |
141
+ | **Token Bucket Rate Limiter** | ❌ | ✅ |
142
+ | **Structured JSON Logs with Correlation IDs** | ❌ | ✅ |
143
+ | **Multi-Stage Docker & Compose** | ❌ | ✅ |
144
+ | **Full Pytest Suite & Enterprise Architecture Blueprint** | ❌ | ✅ |
145
+
146
+ 👉 **[Get the Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite)**
147
+
148
+ ---
149
+
150
+ ## 📄 License
151
+
152
+ MIT License. See [LICENSE](LICENSE) for details.
153
+
154
+ ## Recommended Infrastructure
155
+
156
+ VPS hosting that work well with FastMCP Forge. Some links are referral links.
157
+
158
+ - [Hetzner Cloud](https://www.hetzner.com/cloud)
159
+ - [DigitalOcean](https://www.digitalocean.com/)
160
+
161
+ ## Genesis MCP Ecosystem
162
+
163
+ | Module | What it does | Repo |
164
+ |---|---|---|
165
+ | **CrawlEngine MCP** | Anti-bot web scraping, clean Markdown, proxy rotation and TLS evasion | [GitHub](https://github.com/johannschiffer/crawlengine-mcp) |
166
+ | **BrowserBridge MCP** | Deterministic headless browser automation with cryptographic action receipts | [GitHub](https://github.com/johannschiffer/browserbridge-mcp) |
167
+ | **PgSafe MCP** | Zero-trust PostgreSQL/SQLite guard, live PII masking, zero-downtime migration checks | [GitHub](https://github.com/johannschiffer/pgsafe-mcp) |
168
+ | **OmniBridge MCP** | Multi-channel notification and webhook bus with a persistent SQLite WAL queue | [GitHub](https://github.com/johannschiffer/omnibridge-mcp) |
169
+ | **SysFlow MCP** | Safe Linux administration plane: systemd, port audit, isolated execution | [GitHub](https://github.com/johannschiffer/sysflow-mcp) |
170
+ | **FastMCP Forge** (this repo) | Production MCP server scaffolder: stdio, SSE and auth middleware | [GitHub](https://github.com/johannschiffer/fastmcp-forge) |
171
+
172
+ [Live config builder](https://johannschiffer.github.io) | [Starter Kit, free](https://johanld.gumroad.com/l/genesis-starter-kit) | [Enterprise Suite, $19](https://johanld.gumroad.com/l/genesis-enterprise-suite)
@@ -0,0 +1,154 @@
1
+ # FastMCP Forge (Lite Edition)
2
+
3
+ <a href="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge">
4
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge/badge" alt="fastmcp-forge MCP server" />
5
+ </a>
6
+
7
+
8
+ > **Free:** [Genesis Starter Kit](https://johanld.gumroad.com/l/genesis-starter-kit) (25 `.cursorrules`/`CLAUDE.md` rulesets + MCP configs). Try the [live config builder](https://johannschiffer.github.io).
9
+ > **Full stack:** all six servers in [Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite).
10
+
11
+
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
13
+ [![Python 3.10+](https://img.shields.io/badge/Python-3.10+-brightgreen.svg)](https://python.org)
14
+ [![MCP Compliant](https://img.shields.io/badge/MCP-2024--11--05-purple.svg)](https://modelcontextprotocol.io)
15
+
16
+ **FastMCP Forge** is an ergonomic framework and CLI scaffolding engine that enables Python developers to build, test, and package compliant **Model Context Protocol (MCP)** servers in seconds.
17
+
18
+ ---
19
+
20
+ ## Run without cloning
21
+
22
+ ```bash
23
+ uvx fastmcp-forge
24
+ ```
25
+
26
+ Claude Desktop / Cursor config entry:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "fastmcp-forge": {
32
+ "command": "uvx",
33
+ "args": [
34
+ "--from",
35
+ "git+https://github.com/johannschiffer/fastmcp-forge",
36
+ "fastmcp-forge"
37
+ ]
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ [![CI](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml)
44
+
45
+ ## ⚡ The Problem: MCP Boilerplate Burnout
46
+
47
+ In 2026, every AI developer is building MCP servers to connect tools to **Claude Desktop**, **Cursor**, **Windsurf**, and **Antigravity**. However, writing raw JSON-RPC 2.0 handlers from scratch requires:
48
+ - Manually parsing JSON schemas for tool arguments.
49
+ - Handling error codes (-32600, -32601, -32602, -32000).
50
+ - Managing `sys.stdin` and `sys.stdout` stream buffers.
51
+ - Writing test harnesses to mock agent tool invocations.
52
+
53
+ **FastMCP Forge** gives you an intuitive `@app.tool` decorator that introspects function signatures, infers types, generates valid schemas, and creates automated test suites instantly.
54
+
55
+ ---
56
+
57
+ ## 🛠️ Code Example: Build an MCP Server in 10 Lines
58
+
59
+ ```python
60
+ from fastmcp_forge.server import FastMCP
61
+
62
+ app = FastMCP(name="math-mcp", version="1.0.0")
63
+
64
+ @app.tool(description="Multiply two numbers safely")
65
+ def multiply(a: float, b: float) -> float:
66
+ return a * b
67
+
68
+ if __name__ == "__main__":
69
+ app.run_stdio()
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 🚀 CLI Project Scaffolder
75
+
76
+ Generate a full production-ready project with tests in 1 second:
77
+
78
+ ```bash
79
+ python -m fastmcp_forge.cli new analytics-mcp
80
+ ```
81
+
82
+ Output:
83
+ ```text
84
+ [OK] Created new FastMCP project 'analytics-mcp'
85
+ Generated files:
86
+ - server.py
87
+ - tests/test_server.py
88
+ - README.md
89
+ - requirements.txt
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 🖥️ Client Configuration
95
+
96
+ Add to your `claude_desktop_config.json`:
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "my-server": {
102
+ "command": "python",
103
+ "args": ["server.py"],
104
+ "cwd": "/path/to/my-server"
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 💎 Need Enterprise Remote Deployment? Upgrade to FastMCP Forge Pro
113
+
114
+ Deploying MCP servers as remote team microservices, behind authentication proxies, or in production clouds?
115
+
116
+ | Feature | Lite (Open Source) | Enterprise Suite ($19) |
117
+ |---|:---:|:---:|
118
+ | **@tool Schema Introspection** | ✅ | ✅ |
119
+ | **JSON-RPC 2.0 stdio Transport** | ✅ | ✅ |
120
+ | **CLI Project Scaffolding** | ✅ | ✅ |
121
+ | **Dual Transport: stdio + Remote SSE HTTP** | ❌ | ✅ |
122
+ | **Security & Auth Middleware** *(API Keys & Bearer Tokens)* | ❌ | ✅ |
123
+ | **Token Bucket Rate Limiter** | ❌ | ✅ |
124
+ | **Structured JSON Logs with Correlation IDs** | ❌ | ✅ |
125
+ | **Multi-Stage Docker & Compose** | ❌ | ✅ |
126
+ | **Full Pytest Suite & Enterprise Architecture Blueprint** | ❌ | ✅ |
127
+
128
+ 👉 **[Get the Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite)**
129
+
130
+ ---
131
+
132
+ ## 📄 License
133
+
134
+ MIT License. See [LICENSE](LICENSE) for details.
135
+
136
+ ## Recommended Infrastructure
137
+
138
+ VPS hosting that work well with FastMCP Forge. Some links are referral links.
139
+
140
+ - [Hetzner Cloud](https://www.hetzner.com/cloud)
141
+ - [DigitalOcean](https://www.digitalocean.com/)
142
+
143
+ ## Genesis MCP Ecosystem
144
+
145
+ | Module | What it does | Repo |
146
+ |---|---|---|
147
+ | **CrawlEngine MCP** | Anti-bot web scraping, clean Markdown, proxy rotation and TLS evasion | [GitHub](https://github.com/johannschiffer/crawlengine-mcp) |
148
+ | **BrowserBridge MCP** | Deterministic headless browser automation with cryptographic action receipts | [GitHub](https://github.com/johannschiffer/browserbridge-mcp) |
149
+ | **PgSafe MCP** | Zero-trust PostgreSQL/SQLite guard, live PII masking, zero-downtime migration checks | [GitHub](https://github.com/johannschiffer/pgsafe-mcp) |
150
+ | **OmniBridge MCP** | Multi-channel notification and webhook bus with a persistent SQLite WAL queue | [GitHub](https://github.com/johannschiffer/omnibridge-mcp) |
151
+ | **SysFlow MCP** | Safe Linux administration plane: systemd, port audit, isolated execution | [GitHub](https://github.com/johannschiffer/sysflow-mcp) |
152
+ | **FastMCP Forge** (this repo) | Production MCP server scaffolder: stdio, SSE and auth middleware | [GitHub](https://github.com/johannschiffer/fastmcp-forge) |
153
+
154
+ [Live config builder](https://johannschiffer.github.io) | [Starter Kit, free](https://johanld.gumroad.com/l/genesis-starter-kit) | [Enterprise Suite, $19](https://johanld.gumroad.com/l/genesis-enterprise-suite)
@@ -0,0 +1,8 @@
1
+ """
2
+ FastMCP Forge (Lite Edition)
3
+ The Enterprise Model Context Protocol (MCP) Server Boilerplate & CLI Generator.
4
+ """
5
+
6
+ __version__ = "1.0.0"
7
+ __author__ = "Johann Schiffer / NEXUS"
8
+ __license__ = "MIT"
@@ -0,0 +1,11 @@
1
+ """Upgrade notice. Printed to stderr so MCP stdio traffic on stdout is never affected."""
2
+ import os
3
+ import sys
4
+
5
+ NOTICE = '[Genesis MCP Ecosystem] Free Starter Kit (25+ .cursorrules & Blueprints): https://johanld.gumroad.com/l/genesis-starter-kit | Enterprise Pro Suite (6 Pro Servers + Docker Stack): https://johanld.gumroad.com/l/genesis-enterprise-suite | Config Builder: https://johannschiffer.github.io/'
6
+
7
+
8
+ def print_upgrade_notice():
9
+ if os.environ.get("GENESIS_NO_NOTICE") == "1":
10
+ return
11
+ print(NOTICE, file=sys.stderr)
@@ -0,0 +1,55 @@
1
+ """
2
+ FastMCP Forge CLI.
3
+ Commands:
4
+ python -m fastmcp_forge new my-server
5
+ """
6
+ import argparse
7
+ import json
8
+ import sys
9
+ from .scaffolder import ProjectScaffolder
10
+
11
+ def main():
12
+ from ._genesis import NOTICE
13
+ parser = argparse.ArgumentParser(
14
+ prog="fastmcp-forge",
15
+ description="FastMCP Forge: CLI code generator for MCP servers",
16
+ epilog=NOTICE,
17
+ formatter_class=argparse.RawDescriptionHelpFormatter
18
+ )
19
+ parser.add_argument("-v", "--version", action="version", version="%(prog)s 1.0.1")
20
+
21
+ subparsers = parser.add_subparsers(dest="command", help="Sub-commands")
22
+
23
+ new_parser = subparsers.add_parser("new", help="Scaffold a new FastMCP server project")
24
+ new_parser.add_argument("name", help="Project name (e.g. 'analytics-mcp')")
25
+ new_parser.add_argument("--dir", default=".", help="Target directory (default: current directory)")
26
+
27
+ args = parser.parse_args()
28
+
29
+ if args.command == "new":
30
+ res = ProjectScaffolder.create_project(args.name, target_dir=args.dir)
31
+ print(f"[OK] Created new FastMCP project '{res['project_name']}' at: {res['path']}")
32
+ print("Generated files:")
33
+ for f in res["files"]:
34
+ print(f" - {f}")
35
+ print("\nNext steps:")
36
+ print(f" cd {res['project_name']}")
37
+ print(" pip install -r requirements.txt")
38
+ print(" pytest tests/")
39
+ else:
40
+ parser.print_help()
41
+
42
+
43
+
44
+ _main_impl = main
45
+
46
+
47
+ def main():
48
+ from ._genesis import print_upgrade_notice
49
+ try:
50
+ return _main_impl()
51
+ finally:
52
+ print_upgrade_notice()
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,118 @@
1
+ """
2
+ Project Scaffolder Engine.
3
+ Generates complete, production-ready FastMCP projects with decorators, schemas, and tests.
4
+ """
5
+ import os
6
+ from pathlib import Path
7
+ from typing import Dict, Any
8
+
9
+ SERVER_TEMPLATE = """\"\"\"
10
+ {project_name} MCP Server
11
+ Generated by FastMCP Forge.
12
+ \"\"\"
13
+ from fastmcp_forge.server import FastMCP
14
+
15
+ app = FastMCP(
16
+ name="{project_name}",
17
+ version="1.0.0",
18
+ description="Production-ready Model Context Protocol server"
19
+ )
20
+
21
+ @app.tool(description="Calculate mathematical operations safely")
22
+ def calculate(a: float, b: float, operation: str = "add") -> float:
23
+ \"\"\"Perform arithmetic operations.\"\"\"
24
+ if operation == "add":
25
+ return a + b
26
+ elif operation == "subtract":
27
+ return a - b
28
+ elif operation == "multiply":
29
+ return a * b
30
+ elif operation == "divide":
31
+ if b == 0:
32
+ raise ValueError("Division by zero")
33
+ return a / b
34
+ else:
35
+ raise ValueError(f"Unknown operation: {{operation}}")
36
+
37
+ @app.tool(description="Get server health and status")
38
+ def healthcheck() -> dict:
39
+ return {{"status": "healthy", "server": "{project_name}"}}
40
+
41
+ if __name__ == "__main__":
42
+ app.run_stdio()
43
+ """
44
+
45
+ TEST_TEMPLATE = """\"\"\"
46
+ Unit tests for {project_name}.
47
+ \"\"\"
48
+ import pytest
49
+ from server import app
50
+
51
+ def test_tool_registration():
52
+ tools = app.get_tools_definition()
53
+ names = [t["name"] for t in tools]
54
+ assert "calculate" in names
55
+ assert "healthcheck" in names
56
+
57
+ def test_calculate_tool():
58
+ res = app.call_tool("calculate", {{"a": 10.0, "b": 5.0, "operation": "add"}})
59
+ assert res == 15.0
60
+
61
+ def test_calculate_div_zero():
62
+ with pytest.raises(ValueError, match="Division by zero"):
63
+ app.call_tool("calculate", {{"a": 10.0, "b": 0.0, "operation": "divide"}})
64
+ """
65
+
66
+ README_TEMPLATE = """# {project_name}
67
+
68
+ Model Context Protocol (MCP) server generated with **FastMCP Forge**.
69
+
70
+ ## 🚀 Quickstart
71
+
72
+ 1. Install dependencies:
73
+ ```bash
74
+ pip install -r requirements.txt
75
+ ```
76
+
77
+ 2. Run tests:
78
+ ```bash
79
+ pytest tests/
80
+ ```
81
+
82
+ 3. Add to Claude Desktop (`claude_desktop_config.json`):
83
+ ```json
84
+ {{
85
+ "mcpServers": {{
86
+ "{project_name}": {{
87
+ "command": "python",
88
+ "args": ["server.py"],
89
+ "cwd": "/path/to/{project_name}"
90
+ }}
91
+ }}
92
+ }}
93
+ ```
94
+ """
95
+
96
+ class ProjectScaffolder:
97
+ @staticmethod
98
+ def create_project(project_name: str, target_dir: str = ".") -> Dict[str, Any]:
99
+ clean_name = project_name.replace(" ", "-").lower()
100
+ root = Path(target_dir) / clean_name
101
+ root.mkdir(parents=True, exist_ok=True)
102
+ (root / "tests").mkdir(exist_ok=True)
103
+
104
+ # Write server.py
105
+ (root / "server.py").write_text(SERVER_TEMPLATE.format(project_name=clean_name), encoding="utf-8")
106
+ # Write tests/test_server.py
107
+ (root / "tests" / "test_server.py").write_text(TEST_TEMPLATE.format(project_name=clean_name), encoding="utf-8")
108
+ # Write README.md
109
+ (root / "README.md").write_text(README_TEMPLATE.format(project_name=clean_name), encoding="utf-8")
110
+ # Write requirements.txt
111
+ (root / "requirements.txt").write_text("pytest>=8.0.0\n", encoding="utf-8")
112
+
113
+ return {
114
+ "success": True,
115
+ "project_name": clean_name,
116
+ "path": str(root.resolve()),
117
+ "files": ["server.py", "tests/test_server.py", "README.md", "requirements.txt"]
118
+ }
@@ -0,0 +1,185 @@
1
+ """
2
+ FastMCP Server Engine (Lite Edition).
3
+ Implements official Model Context Protocol (2024-11-05) over JSON-RPC 2.0 stdio
4
+ with an ergonomic @tool decorator pattern and automatic schema generation.
5
+ """
6
+
7
+ import sys
8
+ import json
9
+ import inspect
10
+ import logging
11
+ from typing import Callable, Dict, Any, List, Optional
12
+
13
+ logging.basicConfig(
14
+ level=logging.INFO,
15
+ format="%(asctime)s [%(levelname)s] [FastMCP] %(message)s",
16
+ stream=sys.stderr
17
+ )
18
+ logger = logging.getLogger("FastMCPServer")
19
+
20
+ class FastMCP:
21
+ def __init__(self, name: str = "fastmcp-server", version: str = "1.0.0", description: str = ""):
22
+ self.name = name
23
+ self.version = version
24
+ self.description = description
25
+ self.tools: Dict[str, Dict[str, Any]] = {}
26
+
27
+ def tool(self, name: Optional[str] = None, description: Optional[str] = None):
28
+ """Decorator to register a Python function as an MCP tool."""
29
+ def decorator(func: Callable):
30
+ tool_name = name or func.__name__
31
+ tool_desc = description or (func.__doc__.strip() if func.__doc__ else f"Tool {tool_name}")
32
+
33
+ # Introspect parameters and type hints
34
+ sig = inspect.signature(func)
35
+ properties = {}
36
+ required = []
37
+
38
+ type_map = {
39
+ str: "string",
40
+ int: "integer",
41
+ float: "number",
42
+ bool: "boolean",
43
+ list: "array",
44
+ dict: "object"
45
+ }
46
+
47
+ for param_name, param in sig.parameters.items():
48
+ if param_name in ("self", "cls"):
49
+ continue
50
+
51
+ schema_type = type_map.get(param.annotation, "string") if param.annotation != inspect.Parameter.empty else "string"
52
+ properties[param_name] = {
53
+ "type": schema_type,
54
+ "description": f"Parameter {param_name}"
55
+ }
56
+ if param.default == inspect.Parameter.empty:
57
+ required.append(param_name)
58
+
59
+ self.tools[tool_name] = {
60
+ "name": tool_name,
61
+ "description": tool_desc,
62
+ "inputSchema": {
63
+ "type": "object",
64
+ "properties": properties,
65
+ "required": required
66
+ },
67
+ "func": func
68
+ }
69
+ return func
70
+ return decorator
71
+
72
+ def get_tools_definition(self) -> List[Dict[str, Any]]:
73
+ return [
74
+ {
75
+ "name": t["name"],
76
+ "description": t["description"],
77
+ "inputSchema": t["inputSchema"]
78
+ }
79
+ for t in self.tools.values()
80
+ ]
81
+
82
+ def call_tool(self, name: str, arguments: Dict[str, Any]) -> Any:
83
+ if name not in self.tools:
84
+ raise KeyError(f"Tool not found: '{name}'")
85
+ func = self.tools[name]["func"]
86
+ return func(**arguments)
87
+
88
+ def handle_request(self, request: Dict[str, Any]) -> Optional[Dict[str, Any]]:
89
+ req_id = request.get("id")
90
+ method = request.get("method")
91
+ params = request.get("params", {})
92
+
93
+ if req_id is None:
94
+ if method == "notifications/initialized":
95
+ logger.info("Client initialization handshake confirmed.")
96
+ return None
97
+
98
+ if method == "initialize":
99
+ return {
100
+ "jsonrpc": "2.0",
101
+ "id": req_id,
102
+ "result": {
103
+ "protocolVersion": "2024-11-05",
104
+ "capabilities": {"tools": {}},
105
+ "serverInfo": {
106
+ "name": self.name,
107
+ "version": self.version
108
+ }
109
+ }
110
+ }
111
+
112
+ elif method == "ping":
113
+ return {"jsonrpc": "2.0", "id": req_id, "result": {}}
114
+
115
+ elif method == "tools/list":
116
+ return {
117
+ "jsonrpc": "2.0",
118
+ "id": req_id,
119
+ "result": {"tools": self.get_tools_definition()}
120
+ }
121
+
122
+ elif method == "tools/call":
123
+ tool_name = params.get("name")
124
+ tool_args = params.get("arguments", {})
125
+ try:
126
+ result = self.call_tool(tool_name, tool_args)
127
+ formatted_text = result if isinstance(result, str) else json.dumps(result, indent=2, ensure_ascii=False)
128
+ return {
129
+ "jsonrpc": "2.0",
130
+ "id": req_id,
131
+ "result": {
132
+ "content": [{"type": "text", "text": formatted_text}],
133
+ "isError": False
134
+ }
135
+ }
136
+ except KeyError as e:
137
+ return {
138
+ "jsonrpc": "2.0",
139
+ "id": req_id,
140
+ "error": {"code": -32601, "message": str(e)}
141
+ }
142
+ except TypeError as e:
143
+ return {
144
+ "jsonrpc": "2.0",
145
+ "id": req_id,
146
+ "error": {"code": -32602, "message": f"Invalid params: {str(e)}"}
147
+ }
148
+ except Exception as e:
149
+ logger.error(f"Error calling tool {tool_name}: {e}")
150
+ return {
151
+ "jsonrpc": "2.0",
152
+ "id": req_id,
153
+ "error": {"code": -32000, "message": str(e)}
154
+ }
155
+ else:
156
+ return {
157
+ "jsonrpc": "2.0",
158
+ "id": req_id,
159
+ "error": {"code": -32601, "message": f"Method not found: {method}"}
160
+ }
161
+
162
+ def run_stdio(self):
163
+ """Standard IO event loop reading JSON-RPC lines from stdin."""
164
+ logger.info(f"Starting {self.name} v{self.version} stdio listener...")
165
+ for line in sys.stdin:
166
+ line = line.strip()
167
+ if not line:
168
+ continue
169
+ try:
170
+ request = json.loads(line)
171
+ response = self.handle_request(request)
172
+ if response is not None:
173
+ sys.stdout.write(json.dumps(response) + "\n")
174
+ sys.stdout.flush()
175
+ except json.JSONDecodeError as e:
176
+ logger.error(f"JSON parse error: {e}")
177
+ err_resp = {
178
+ "jsonrpc": "2.0",
179
+ "id": None,
180
+ "error": {"code": -32700, "message": "Parse error"}
181
+ }
182
+ sys.stdout.write(json.dumps(err_resp) + "\n")
183
+ sys.stdout.flush()
184
+ except Exception as e:
185
+ logger.error(f"Unexpected stdio exception: {e}")
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmcp-forge
3
+ Version: 1.0.1
4
+ Summary: Enterprise Model Context Protocol (MCP) Server Boilerplate & CLI Generator
5
+ Author: Johann Schiffer
6
+ License: MIT
7
+ Project-URL: Homepage, https://johannschiffer.github.io
8
+ Project-URL: Repository, https://github.com/johannschiffer/fastmcp-forge
9
+ Project-URL: Starter Kit, https://johanld.gumroad.com/l/genesis-starter-kit
10
+ Project-URL: Enterprise Suite, https://johanld.gumroad.com/l/genesis-enterprise-suite
11
+ Keywords: mcp,model-context-protocol,fastmcp,boilerplate,scaffolding,claude,cursor,ai-agent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest>=7; extra == "test"
17
+ Dynamic: license-file
18
+
19
+ # FastMCP Forge (Lite Edition)
20
+
21
+ <a href="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge">
22
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@johannschiffer/fastmcp-forge/badge" alt="fastmcp-forge MCP server" />
23
+ </a>
24
+
25
+
26
+ > **Free:** [Genesis Starter Kit](https://johanld.gumroad.com/l/genesis-starter-kit) (25 `.cursorrules`/`CLAUDE.md` rulesets + MCP configs). Try the [live config builder](https://johannschiffer.github.io).
27
+ > **Full stack:** all six servers in [Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite).
28
+
29
+
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
31
+ [![Python 3.10+](https://img.shields.io/badge/Python-3.10+-brightgreen.svg)](https://python.org)
32
+ [![MCP Compliant](https://img.shields.io/badge/MCP-2024--11--05-purple.svg)](https://modelcontextprotocol.io)
33
+
34
+ **FastMCP Forge** is an ergonomic framework and CLI scaffolding engine that enables Python developers to build, test, and package compliant **Model Context Protocol (MCP)** servers in seconds.
35
+
36
+ ---
37
+
38
+ ## Run without cloning
39
+
40
+ ```bash
41
+ uvx fastmcp-forge
42
+ ```
43
+
44
+ Claude Desktop / Cursor config entry:
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "fastmcp-forge": {
50
+ "command": "uvx",
51
+ "args": [
52
+ "--from",
53
+ "git+https://github.com/johannschiffer/fastmcp-forge",
54
+ "fastmcp-forge"
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ [![CI](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/johannschiffer/fastmcp-forge/actions/workflows/ci.yml)
62
+
63
+ ## ⚡ The Problem: MCP Boilerplate Burnout
64
+
65
+ In 2026, every AI developer is building MCP servers to connect tools to **Claude Desktop**, **Cursor**, **Windsurf**, and **Antigravity**. However, writing raw JSON-RPC 2.0 handlers from scratch requires:
66
+ - Manually parsing JSON schemas for tool arguments.
67
+ - Handling error codes (-32600, -32601, -32602, -32000).
68
+ - Managing `sys.stdin` and `sys.stdout` stream buffers.
69
+ - Writing test harnesses to mock agent tool invocations.
70
+
71
+ **FastMCP Forge** gives you an intuitive `@app.tool` decorator that introspects function signatures, infers types, generates valid schemas, and creates automated test suites instantly.
72
+
73
+ ---
74
+
75
+ ## 🛠️ Code Example: Build an MCP Server in 10 Lines
76
+
77
+ ```python
78
+ from fastmcp_forge.server import FastMCP
79
+
80
+ app = FastMCP(name="math-mcp", version="1.0.0")
81
+
82
+ @app.tool(description="Multiply two numbers safely")
83
+ def multiply(a: float, b: float) -> float:
84
+ return a * b
85
+
86
+ if __name__ == "__main__":
87
+ app.run_stdio()
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 🚀 CLI Project Scaffolder
93
+
94
+ Generate a full production-ready project with tests in 1 second:
95
+
96
+ ```bash
97
+ python -m fastmcp_forge.cli new analytics-mcp
98
+ ```
99
+
100
+ Output:
101
+ ```text
102
+ [OK] Created new FastMCP project 'analytics-mcp'
103
+ Generated files:
104
+ - server.py
105
+ - tests/test_server.py
106
+ - README.md
107
+ - requirements.txt
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 🖥️ Client Configuration
113
+
114
+ Add to your `claude_desktop_config.json`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "my-server": {
120
+ "command": "python",
121
+ "args": ["server.py"],
122
+ "cwd": "/path/to/my-server"
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 💎 Need Enterprise Remote Deployment? Upgrade to FastMCP Forge Pro
131
+
132
+ Deploying MCP servers as remote team microservices, behind authentication proxies, or in production clouds?
133
+
134
+ | Feature | Lite (Open Source) | Enterprise Suite ($19) |
135
+ |---|:---:|:---:|
136
+ | **@tool Schema Introspection** | ✅ | ✅ |
137
+ | **JSON-RPC 2.0 stdio Transport** | ✅ | ✅ |
138
+ | **CLI Project Scaffolding** | ✅ | ✅ |
139
+ | **Dual Transport: stdio + Remote SSE HTTP** | ❌ | ✅ |
140
+ | **Security & Auth Middleware** *(API Keys & Bearer Tokens)* | ❌ | ✅ |
141
+ | **Token Bucket Rate Limiter** | ❌ | ✅ |
142
+ | **Structured JSON Logs with Correlation IDs** | ❌ | ✅ |
143
+ | **Multi-Stage Docker & Compose** | ❌ | ✅ |
144
+ | **Full Pytest Suite & Enterprise Architecture Blueprint** | ❌ | ✅ |
145
+
146
+ 👉 **[Get the Genesis Enterprise Suite ($19)](https://johanld.gumroad.com/l/genesis-enterprise-suite)**
147
+
148
+ ---
149
+
150
+ ## 📄 License
151
+
152
+ MIT License. See [LICENSE](LICENSE) for details.
153
+
154
+ ## Recommended Infrastructure
155
+
156
+ VPS hosting that work well with FastMCP Forge. Some links are referral links.
157
+
158
+ - [Hetzner Cloud](https://www.hetzner.com/cloud)
159
+ - [DigitalOcean](https://www.digitalocean.com/)
160
+
161
+ ## Genesis MCP Ecosystem
162
+
163
+ | Module | What it does | Repo |
164
+ |---|---|---|
165
+ | **CrawlEngine MCP** | Anti-bot web scraping, clean Markdown, proxy rotation and TLS evasion | [GitHub](https://github.com/johannschiffer/crawlengine-mcp) |
166
+ | **BrowserBridge MCP** | Deterministic headless browser automation with cryptographic action receipts | [GitHub](https://github.com/johannschiffer/browserbridge-mcp) |
167
+ | **PgSafe MCP** | Zero-trust PostgreSQL/SQLite guard, live PII masking, zero-downtime migration checks | [GitHub](https://github.com/johannschiffer/pgsafe-mcp) |
168
+ | **OmniBridge MCP** | Multi-channel notification and webhook bus with a persistent SQLite WAL queue | [GitHub](https://github.com/johannschiffer/omnibridge-mcp) |
169
+ | **SysFlow MCP** | Safe Linux administration plane: systemd, port audit, isolated execution | [GitHub](https://github.com/johannschiffer/sysflow-mcp) |
170
+ | **FastMCP Forge** (this repo) | Production MCP server scaffolder: stdio, SSE and auth middleware | [GitHub](https://github.com/johannschiffer/fastmcp-forge) |
171
+
172
+ [Live config builder](https://johannschiffer.github.io) | [Starter Kit, free](https://johanld.gumroad.com/l/genesis-starter-kit) | [Enterprise Suite, $19](https://johanld.gumroad.com/l/genesis-enterprise-suite)
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ fastmcp_forge/__init__.py
5
+ fastmcp_forge/_genesis.py
6
+ fastmcp_forge/cli.py
7
+ fastmcp_forge/scaffolder.py
8
+ fastmcp_forge/server.py
9
+ fastmcp_forge.egg-info/PKG-INFO
10
+ fastmcp_forge.egg-info/SOURCES.txt
11
+ fastmcp_forge.egg-info/dependency_links.txt
12
+ fastmcp_forge.egg-info/entry_points.txt
13
+ fastmcp_forge.egg-info/requires.txt
14
+ fastmcp_forge.egg-info/top_level.txt
15
+ tests/test_genesis_entrypoints.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fastmcp-forge = fastmcp_forge.cli:main
@@ -0,0 +1,3 @@
1
+
2
+ [test]
3
+ pytest>=7
@@ -0,0 +1 @@
1
+ fastmcp_forge
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fastmcp-forge"
7
+ version = "1.0.1"
8
+ description = "Enterprise Model Context Protocol (MCP) Server Boilerplate & CLI Generator"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Johann Schiffer"}
14
+ ]
15
+ keywords = ["mcp", "model-context-protocol", "fastmcp", "boilerplate", "scaffolding", "claude", "cursor", "ai-agent"]
16
+ dependencies = []
17
+
18
+ [project.optional-dependencies]
19
+ test = ["pytest>=7"]
20
+
21
+ [project.scripts]
22
+ fastmcp-forge = "fastmcp_forge.cli:main"
23
+
24
+ [tool.setuptools.packages.find]
25
+ include = ["fastmcp_forge*"]
26
+
27
+ [project.urls]
28
+ Homepage = "https://johannschiffer.github.io"
29
+ Repository = "https://github.com/johannschiffer/fastmcp-forge"
30
+ "Starter Kit" = "https://johanld.gumroad.com/l/genesis-starter-kit"
31
+ "Enterprise Suite" = "https://johanld.gumroad.com/l/genesis-enterprise-suite"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,25 @@
1
+ import importlib
2
+ import io
3
+ import os
4
+ import sys
5
+
6
+
7
+ def test_script_target_is_callable():
8
+ mod = importlib.import_module('fastmcp_forge.cli')
9
+ assert callable(getattr(mod, 'main'))
10
+
11
+
12
+ def test_upgrade_notice_goes_to_stderr(capsys, monkeypatch):
13
+ monkeypatch.delenv('GENESIS_NO_NOTICE', raising=False)
14
+ from fastmcp_forge._genesis import print_upgrade_notice
15
+ print_upgrade_notice()
16
+ out = capsys.readouterr()
17
+ assert out.out == ''
18
+ assert 'gumroad.com' in out.err
19
+
20
+
21
+ def test_upgrade_notice_can_be_silenced(capsys, monkeypatch):
22
+ monkeypatch.setenv('GENESIS_NO_NOTICE', '1')
23
+ from fastmcp_forge._genesis import print_upgrade_notice
24
+ print_upgrade_notice()
25
+ assert capsys.readouterr().err == ''