FastMCP Server Template
A production-ready MCP (Model Context Protocol) server template with dynamic tool/resource loading, YAML-based prompts, and seamless OpenShift deployment.
Features
🔧 Dynamic tool/resource loading via decorators
📝 YAML prompts with automatic JSON schema injection
🚀 One-command OpenShift deployment
🔄 Hot-reload for local development
🧪 Local STDIO and OpenShift HTTP transports
🔐 JWT authentication (optional) with scope-based authorization
✅ Full test suite with pytest
Quick Start
Local Development
Deploy to OpenShift
Project Structure
Development
Adding Tools
Create a Python file in src/tools/
:
Adding Resources
Create a file in src/resources/
:
Creating Prompts
Add YAML file to prompts/
:
For structured output, add a matching JSON schema file (same base name).
Testing
Local Testing (STDIO)
OpenShift Testing (HTTP)
See TESTING.md for detailed testing instructions.
Environment Variables
Local Development
MCP_TRANSPORT=stdio
- Use STDIO transportMCP_HOT_RELOAD=1
- Enable hot-reload
OpenShift Deployment
MCP_TRANSPORT=http
- Use HTTP transport (set automatically)MCP_HTTP_HOST=0.0.0.0
- HTTP server hostMCP_HTTP_PORT=8080
- HTTP server portMCP_HTTP_PATH=/mcp/
- HTTP endpoint path
Optional Authentication
MCP_AUTH_JWT_SECRET
- JWT secret for symmetric signingMCP_AUTH_JWT_PUBLIC_KEY
- JWT public key for asymmetricMCP_REQUIRED_SCOPES
- Comma-separated required scopes
Available Commands
Prompt Schema Injection
If a prompt contains {output_schema}
, the system automatically injects a minified JSON schema:
Architecture
The server uses FastMCP 2.x with:
Dynamic component loading at startup
Hot-reload in development mode
Automatic prompt registration with schema injection
Support for both STDIO (local) and HTTP (OpenShift) transports
See ARCHITECTURE.md for detailed architecture information.
Requirements
Python 3.11+
OpenShift CLI (
oc
) for deploymentcmcp for local testing:
pip install cmcp
License
MIT
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A production-ready MCP server template that enables developers to quickly build and deploy MCP servers with dynamic tool/resource loading, YAML-based prompts, and seamless OpenShift deployment. Supports both local development with hot-reload and production HTTP deployment with optional JWT authentication.