FastAPI MCP Server
A minimal MCP server that provides current time functionality with optional formatting. Designed for production deployment on Google Cloud Run with proper JSON-RPC 2.0 implementation.
README
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/listandtools/callimplemented 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
Endpoints
POST /— JSON‑RPC 2.0 endpoint fortools/listandtools/callGET /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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.