Skip to main content
Glama

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

# Install and run locally make install make run-local # Test with cmcp (in another terminal) cmcp ".venv/bin/python -m src.main" tools/list

Deploy to OpenShift

# One-command deployment make deploy # Or deploy to specific project make deploy PROJECT=my-project

Project Structure

โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ core/ # Core server components โ”‚ โ”œโ”€โ”€ tools/ # Tool implementations โ”‚ โ””โ”€โ”€ resources/ # Resource implementations โ”œโ”€โ”€ prompts/ # YAML prompt definitions โ”œโ”€โ”€ tests/ # Test suite โ”œโ”€โ”€ Containerfile # Container definition โ”œโ”€โ”€ openshift.yaml # OpenShift manifests โ”œโ”€โ”€ deploy.sh # Deployment script โ”œโ”€โ”€ requirements.txt # Python dependencies โ””โ”€โ”€ Makefile # Common tasks

Development

Adding Tools

Create a Python file in src/tools/:

from src.core.app import mcp @mcp.tool() def my_tool(param: str) -> str: """Tool description""" return f"Result: {param}"

Adding Resources

Create a file in src/resources/:

from src.core.app import mcp @mcp.resource("resource://my-resource") async def get_my_resource() -> str: return "Resource content"

Creating Prompts

Add YAML file to prompts/:

name: my_prompt description: Purpose of this prompt prompt: | Your prompt text with {variable_name} placeholders

For structured output, add a matching JSON schema file (same base name).

Testing

Local Testing (STDIO)

# Run server make run-local # Test with cmcp make test-local # Run unit tests make test

OpenShift Testing (HTTP)

# Deploy make deploy # Test with MCP Inspector npx @modelcontextprotocol/inspector https://<route-url>/mcp/

See TESTING.md for detailed testing instructions.

Environment Variables

Local Development

  • MCP_TRANSPORT=stdio - Use STDIO transport

  • MCP_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 host

  • MCP_HTTP_PORT=8080 - HTTP server port

  • MCP_HTTP_PATH=/mcp/ - HTTP endpoint path

Optional Authentication

  • MCP_AUTH_JWT_SECRET - JWT secret for symmetric signing

  • MCP_AUTH_JWT_PUBLIC_KEY - JWT public key for asymmetric

  • MCP_REQUIRED_SCOPES - Comma-separated required scopes

Available Commands

make help # Show all available commands make install # Install dependencies make run-local # Run locally with STDIO make test # Run test suite make deploy # Deploy to OpenShift make clean # Clean up OpenShift deployment

Prompt Schema Injection

If a prompt contains {output_schema}, the system automatically injects a minified JSON schema:

prompts/ summarize.yaml # Contains {output_schema} placeholder summarize.json # Schema to inject

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 deployment

  • cmcp for local testing: pip install cmcp

License

MIT

-
security - not tested
-
license - not tested
-
quality - not tested

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/rdwj/fda-mcp'

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