Skip to main content
Glama
Lufeezhang

MCP BMI Server Template

by Lufeezhang

MCP BMI Server Template (FastAPI + SSE)

A minimal Model Context Protocol (MCP) server exposing a single tool: bmiCalculator.

  • Discovery endpoint (SSE): GET /mcp

  • Invocation endpoint: POST /invoke

  • Health check: GET /healthz

Quick Start (local)

pip install -r requirements.txt
export API_KEY=changeme   # optional
uvicorn main:app --host 0.0.0.0 --port 10000

Test:

# Discover tools (SSE)
curl -N -H "Accept: text/event-stream" -H "x-api-key: changeme" http://localhost:10000/mcp

# Invoke tool
curl -X POST http://localhost:10000/invoke \
  -H "Content-Type: application/json" \
  -H "x-api-key: changeme" \
  -d '{"tool":"bmiCalculator","params":{"weight":70,"height":175,"unit":"cm"}}'

Related MCP server: MCP Server Template

Docker

docker build -t mcp-bmi .
docker run -p 10000:10000 -e API_KEY=changeme mcp-bmi

Deploy to Render (example)

  • Create a new Web Service from this repo

  • Set environment variable API_KEY (optional but recommended)

  • The service will start with the Dockerfile

Your base URL will look like:

https://<your-service>.onrender.com

Use the MCP SSE endpoint:

https://<your-service>.onrender.com/mcp

MCP Host config example

{
  "mcpServers": {
    "bmiAgent": {
      "url": "https://<your-service>.onrender.com/mcp",
      "headers": {
        "x-api-key": "changeme"
      }
    }
  }
}

Project structure

.
├── main.py
├── requirements.txt
├── Dockerfile
├── .gitignore
└── README.md

Notes

  • SSE (text/event-stream) is used for discovery. If your host requires WebSocket, add a /ws endpoint.

  • Extend by adding more tools in MCPHello.tools and dispatching in /invoke.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal Model Context Protocol server built with FastAPI that provides a basic "Hello World" resource and tool. Serves as a starting point for building and validating MCP client integrations with richer resources and tools.
    -
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A minimal FastMCP server template for quick deployment to Render with streamable HTTP transport. Provides a foundation for building custom MCP servers with easy local development and one-click deployment capabilities.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A FastMCP server template with full MCP authentication via Descope, designed for easy deployment on Render. It provides a foundation for building secure, authenticated MCP servers with scope-based access control.
    3
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    A simple remote MCP server that exposes a greeting tool (say_hello) and demonstrates custom icon advertising per MCP spec, ready to deploy on Render.
    -