Forge
A handy scaffolding tool for MCP servers
Installation
npx mcp-forgeAsk AI about Forge
Powered by Claude Β· Grounded in docs
I know everything about Forge. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π¨ MCP Forge
The Ultimate Scaffolding Tool for Model Context Protocol Servers
Generate production-ready MCP servers in seconds
Fast β’ Modern β’ Feature-Complete
Quick Start β’ Features β’ Documentation β’ Examples β’ Community
π― What is MCP Forge?
MCP Forge is a powerful scaffolding CLI that generates fully-featured Model Context Protocol (MCP) servers with best practices built-in. Stop writing boilerplate and start building amazing AI integrations!
# Install
pip install mcp-forge
# Create a server
mcp-forge new my-awesome-server
# That's it! π
Your server is ready with tools, resources, prompts, authentication, elicitation, sampling, and more!
β¨ Features
π Core Features
|
π₯ Advanced Capabilities
|
π Quick Start
Installation
# Using pip
pip install mcp-forge
# Using uv (recommended for generated projects)
uv tool install mcp-forge
Create Your First Server
# Interactive mode (recommended)
mcp-forge new my-server
# With options
mcp-forge new my-server \
--description "My awesome MCP server" \
--with-prompts \
--with-sampling \
--with-elicitation
Run It!
cd my-server
# Install dependencies
uv sync
# Test with interactive demo client
python demo.py
# Run automated tests
python demo.py --mode test
# Start server for Claude Desktop
python -m my_server.server --transport stdio
# Start HTTP server
python -m my_server.server --transport http --port 8000
Use with Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"my-server": {
"command": "uv",
"args": ["--directory", "/path/to/my-server", "run", "my_server.server"]
}
}
}
Restart Claude Desktop and your tools are ready! π
π What Gets Generated?
my-server/
βββ my_server/
β βββ server.py # Main entry point (all transports)
β βββ server_stdio.py # stdio-only server
β βββ server_http.py # HTTP server with auth
β βββ server_sse.py # SSE server with SSL/TLS
β βββ interfaces/ # Abstract base classes
β β βββ tool.py
β β βββ resource.py
β β βββ prompt.py
β βββ services/ # Business logic layer
β β βββ tool_service.py
β β βββ resource_service.py
β β βββ prompt_service.py
β β βββ auth_service.py # OAuth 2.1 (optional)
β β βββ root_service.py # Roots (optional)
β β βββ completion_service.py # Completions (optional)
β βββ tools/ # Tool implementations
β β βββ add_numbers.py # Basic arithmetic
β β βββ weather_tool.py # Structured outputs
β β βββ reasoning_tool.py # Sampling (optional)
β β βββ greeting_elicitation.py # Elicitation (optional)
β β βββ ...
β βββ resources/ # Resource implementations
β β βββ hello_world.py
β β βββ user_profile.py
β βββ prompts/ # Prompt implementations
β βββ code_review.py
β βββ ...
βββ demo.py # Interactive demo client
βββ completions.py # Completion handlers (optional)
βββ roots_config.py # Roots config (optional)
βββ auth_config.py # Auth config (optional)
βββ pyproject.toml # uv project config
βββ README.md # Project documentation
π‘ Examples
Adding a Simple Tool
# my_server/tools/calculator.py
from pydantic import BaseModel, Field
from my_server.interfaces.tool import Tool, ToolResponse, ToolContent
class CalculatorInput(BaseModel):
expression: str = Field(..., description="Math expression to evaluate")
class CalculatorTool(Tool):
name = "calculator"
description = "Evaluates mathematical expressions"
input_model = CalculatorInput
async def execute(self, input_data: CalculatorInput) -> ToolResponse:
try:
result = eval(input_data.expression)
return ToolResponse(
content=[ToolContent.text(f"Result: {result}")]
)
except Exception as e:
return ToolResponse(
content=[ToolContent.text(f"Error: {e}")],
is_error=True
)
Register in tools/__init__.py and server.py - that's it!
Tool with AI Collaboration
from fastmcp import Context
class ResearchTool(Tool):
name = "research"
description = "AI-powered research assistant"
input_model = ResearchInput
async def execute(self, input_data: ResearchInput, ctx: Context) -> ToolResponse:
# Call another AI for help
response = await ctx.sample(
messages=[{"role": "user", "content": input_data.query}],
system_prompt="You are a research expert.",
temperature=0.7
)
# Report progress
await ctx.report_progress(1.0, "Research complete")
return ToolResponse(content=[ToolContent.text(response.content)])
Interactive User Input (Elicitation)
class TaskTool(Tool):
name = "create_task"
description = "Creates a task with user confirmation"
input_model = TaskInput
async def execute(self, input_data: TaskInput, ctx: Context) -> ToolResponse:
# Ask user for confirmation
result = await ctx.elicit(
"Create this task?",
response_type=None # Approval only
)
if result.action == "accept":
# Create the task
return ToolResponse(content=[ToolContent.text("Task created!")])
else:
return ToolResponse(content=[ToolContent.text("Cancelled")])
Structured Output
class WeatherData(BaseModel):
temperature: float
humidity: int
condition: str
class WeatherTool(Tool):
name = "get_weather"
input_model = WeatherInput
output_model = WeatherData # Enables structured output!
async def execute(self, input_data: WeatherInput) -> ToolResponse:
weather = WeatherData(
temperature=72.5,
humidity=65,
condition="Sunny"
)
return ToolResponse.from_model(weather)
π Documentation
- π Getting Started Guide - Complete walkthrough for new users
- π Quick Reference - One-page cheat sheet for common tasks
External Resources
- π MCP Specification - Official MCP protocol docs
- π FastMCP Documentation - FastMCP framework docs
- π MCP Inspector - Official GUI testing tool
- π Pydantic - Data validation library
π¨ Project Templates
MCP Forge supports different template configurations:
| Feature | Description | Flag |
|---|---|---|
| Prompts | Reusable LLM templates | --with-prompts / --no-prompts |
| Sampling | AI-to-AI collaboration | --with-sampling / --no-sampling |
| Elicitation | Interactive user input | --with-elicitation / --no-elicitation |
| Roots | Filesystem boundaries | --with-roots / --no-roots |
| Completion | Argument autocomplete | --with-completion / --no-completion |
| Authentication | OAuth 2.1 system | --with-auth / --no-auth |
Example Configurations
# Minimal server (just tools and resources)
mcp-forge new minimal-server --no-prompts --no-sampling --no-elicitation
# Full-featured server (everything enabled)
mcp-forge new full-server \
--with-prompts \
--with-sampling \
--with-elicitation \
--with-auth
# API integration server (auth + completion)
mcp-forge new api-server --with-auth --with-completion
π§ͺ Testing Your Server
Generated servers include multiple testing options:
1. Interactive Demo Client
python demo.py
Features:
- Menu-driven interface
- Browse and execute all tools
- Read resources
- Generate prompts
- Automated test suite
2. MCP Inspector (Official GUI)
npx @modelcontextprotocol/inspector uv run -m my_server.server
Browser-based GUI for:
- Visual tool execution
- Schema inspection
- Resource browsing
- Config export
3. Manual Testing
# Start server
python -m my_server.server --transport http --port 8000
# Test with curl
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
π Deployment
Docker
FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install uv && uv sync
EXPOSE 8000
CMD ["uv", "run", "python", "-m", "my_server.server", "--transport", "sse", "--port", "8000"]
Systemd
[Unit]
Description=My MCP Server
After=network.target
[Service]
Type=simple
User=mcp
WorkingDirectory=/opt/my-server
ExecStart=/usr/local/bin/uv run python -m my_server.server --transport sse --port 8443
Restart=always
[Install]
WantedBy=multi-user.target
Cloud Platforms
- Railway: One-click deploy from GitHub
- Fly.io:
fly launchand deploy - DigitalOcean: Docker container on App Platform
- AWS/GCP/Azure: Container services or serverless
π Showcase
Built something cool with MCP Forge? We'd love to see it!
Share your projects:
- π¬ Discord Community
- π GitHub Discussions
- π¦ Twitter with
#MCPForge
π€ Community & Support
π¬ Join Our Community
Get help, share projects, and connect with other MCP developers!
β€οΈ Support Development
If MCP Forge saved you time and effort, consider supporting its development:
Your support helps maintain and improve MCP Forge for everyone! π
π οΈ Contributing
We love contributions! Here's how you can help:
Ways to Contribute
- π Report Bugs: Open an issue with detailed reproduction steps
- π‘ Suggest Features: Share your ideas in GitHub Discussions
- π Improve Docs: Fix typos, add examples, clarify explanations
- π§ Submit PRs: Add features, fix bugs, improve templates
- β Star the Repo: Show your support and help others discover MCP Forge
Development Setup
# Clone the repository
git clone https://github.com/KennyVaneetvelde/mcp-forge.git
cd mcp-forge
# Install dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint code
ruff check .
# Format code
ruff format .
Contribution Guidelines
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- β Code follows project style (ruff)
- β Tests pass
- β Documentation is updated
- β Commit messages are clear
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Anthropic - For creating the Model Context Protocol
- FastMCP - For the excellent Python MCP framework
- MCP Community - For advancing AI integration standards
- All Contributors - Thank you for making MCP Forge better!
π Contact
- π¬ Discord: Join our server
- π GitHub: Issues β’ Discussions
- π§ Email: support@example.com (if applicable)
- π¦ Twitter: @MCPForge (if applicable)
Made with β€οΈ by the MCP Forge Team
β Star us on GitHub β’ π¬ Join Discord β’ β€οΈ Support on PayPal
