Skip to main content
Glama
bankszach

FastAPI MCP Server

by bankszach

FastAPI MCP Server (Single Tool)

A minimal, production-ready MCP server implemented with FastAPI and deployable to Google Cloud Run. It exposes a single tool get_time via the OpenAI Model Context Protocol (MCP) using JSON‑RPC 2.0 over HTTP.

Features

  • tools/list and tools/call implemented exactly to spec

  • Returns content (text for humans) and structuredContent (JSON for machines)

  • Proper JSON‑RPC error codes and input validation with jsonschema

  • CORS enabled (dev) + optional API key auth via x-api-key

  • Health check (/healthz) and simple request logging

  • Dockerfile and one‑command Cloud Run deploy

Related MCP server: Utility MCP Server

Endpoints

  • POST / — JSON‑RPC 2.0 endpoint for tools/list and tools/call

  • GET /healthz — returns { "ok": true }

Tool

get_time

Description: Returns the current UTC timestamp, optionally formatted.

Input schema:

{
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "description": "strftime format, e.g. %Y-%m-%dT%H:%M:%SZ"
    }
  },
  "required": []
}

Output structuredContent:

{
  "iso": "2025-01-01T00:00:00Z",
  "formatted": "optional if format passed"
}

Local Dev

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --reload --port 8000

Test:

curl -s localhost:8000/ -H 'content-type: application/json'   -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | jq

curl -s localhost:8000/ -H 'content-type: application/json'   -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_time","arguments":{"format":"%Y-%m-%dT%H:%M:%SZ"}}}' | jq

If you set API_KEY=secret, include a header: -H 'x-api-key: secret'

Deploy to Google Cloud Run

Option 1 — from source (simplest):

./deploy.sh
# Set PROJECT_ID, REGION, SERVICE (or export them)

Option 2 — via Cloud Build pipeline:

gcloud builds submit --project $PROJECT_ID --substitutions=_REGION=us-central1,_SERVICE=mcp-clock

Wire into OpenAI Agent Builder

  • Add a new MCP Server to your agent

  • Server URL: your Cloud Run URL (e.g. https://mcp-clock-xxxx-uc.a.run.app)

  • Label: clock

  • Allowed tools: get_time (or leave empty to allow all)

License

MIT

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    A minimal MCP server that provides current time information with configurable timezone support set on the client side.
  • F
    license
    A
    quality
    D
    maintenance
    A general-purpose MCP server providing time-related utilities such as fetching current time, Unix timestamps, and formatting services. It supports both local stdio and remote SSE communication modes for versatile AI client integration.
    3
  • A
    license
    A
    quality
    F
    maintenance
    MCP server providing various date/time functions including current time, timezone conversion, and relative time calculations. Supports both local stdio and remote HTTP access via Cloudflare Workers.
    6
    322
    2
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    A simple MCP server that returns the current date and time with timezone information in ISO 8601, Unix timestamp, and human-readable formats.
    1

View all related MCP servers

Related MCP Connectors

  • Time MCP server via HTTP

  • MCP (Model Context Protocol) server for Appwrite

  • Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.

View all MCP Connectors

Latest Blog Posts

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/bankszach/fastapi-mcp'

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