Learn how to create your own MCP servers from scratch using NetworkChuck's MCP Builder Prompt.
MCP servers are Docker containers that expose tools to AI assistants. You can build servers for:
- API integrations (weather, stocks, databases)
- System tools (file management, network utilities)
- Custom business logic
- Automation workflows
Before using the prompt, gather:
- Service name - What will you call your server?
- API documentation - Links to any APIs you'll use
- Tool list - What specific functions do you need?
- Authentication - API keys, OAuth requirements
- Example usage - How will users interact with it?
- Open
mcp-builder-prompt/mcp-builder-prompt.md - Copy the entire prompt
- Add your requirements at the indicated section
- Paste into Claude, ChatGPT, or your preferred AI
The AI will create 5 files:
Dockerfile- Container configurationrequirements.txt- Python dependencies[name]_server.py- Main server codereadme.txt- DocumentationCLAUDE.md- Integration guide
I want to build a weather MCP server that:
- Gets current weather for any city
- Gets 5-day forecast
- Converts between Celsius and Fahrenheit
- Uses the OpenWeatherMap API
@mcp.tool()
async def get_weather(city: str = "") -> str:
"""Get current weather for a city."""
# API call to OpenWeatherMap
# Return formatted weather datamkdir weather-mcp-server
cd weather-mcp-serverSave all 5 files from the AI output
docker build -t weather-mcp-server .docker mcp secret set OPENWEATHER_API_KEY="your-key-here"Add to ~/.docker/mcp/catalogs/custom.yaml
Add to ~/.docker/mcp/registry.yaml
Update Claude/Cursor configuration
Restart client and test your new tools!
Client (Claude/Cursor)
↓
Docker MCP Gateway
↓
Your MCP Server Container
↓
External APIs/Services
- One tool per function
- Clear, single-line docstrings
- Comprehensive error handling
- Informative return messages
- Never hardcode credentials
- Use Docker secrets for API keys
- Validate all inputs
- Run as non-root user
- Add timeouts to API calls
- Cache responses when appropriate
- Use async operations
- Handle rate limits gracefully
async with httpx.AsyncClient() as client:
response = await client.get(url, headers=headers)
response.raise_for_status()
return format_response(response.json())try:
with open(filename, 'r') as f:
content = f.read()
return f"✅ File read successfully"
except FileNotFoundError:
return f"❌ File not found: {filename}"result = subprocess.run(
command,
capture_output=True,
text=True,
timeout=10
)
return result.stdout if result.returncode == 0 else result.stderrCombine related tools in one server:
- Database operations (create, read, update, delete)
- Project management (tasks, projects, time tracking)
- DevOps tools (deploy, monitor, scale)
While MCP is stateless, you can:
- Use external databases
- Write to files
- Maintain sessions via IDs
Chain tools together:
- Fetch data from API
- Process/transform data
- Store results
- Send notifications
# Run server directly
python your_server.py
# Test MCP protocol
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | python your_server.py# View container logs
docker logs $(docker ps -a | grep your-server | awk '{print $1}')- Import errors: Check requirements.txt
- Tool not found: Verify @mcp.tool() decorator
- Auth failures: Check secret names match
- Start/stop timers
- View time entries
- Track projects
- API authentication with tokens
- Network scanning (nmap)
- Web testing (nikto, dirb)
- Security assessments
- Running system commands safely
- Start with a simple API integration
- Add error handling and validation
- Implement multiple related tools
- Share your creation with the community!
Remember: The MCP Builder Prompt does the heavy lifting - you just need to describe what you want!