Skip to main content
Glama
bankszach

Hello World MCP FastAPI Endpoint

by bankszach

Hello World MCP FastAPI Endpoint

This project exposes a minimal Model Context Protocol server backed by FastAPI. It registers both a resource and a tool that respond with a “Hello World” message so you can validate your MCP client integration end-to-end.

Setup

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Related MCP server: MCP Server Boilerplate

Running the server

uvicorn app:app --reload --port 8080

The readiness probe is available at http://127.0.0.1:8080/, the health endpoint at http://127.0.0.1:8080/healthz, and the MCP streamable HTTP endpoint is mounted at http://127.0.0.1:8080/mcp.

Trying it from an MCP client

Point your MCP-compatible LLM or SDK at http://127.0.0.1:8080/mcp. You should see:

  • resource://hello returning "Hello from the Model Context Protocol!"

  • say_hello tool returning a greeting.

These serve as a starting point for wiring up richer resources and tools.

Run with Docker (single command)

docker compose up --build

The server will be reachable on http://127.0.0.1:8080/ (and /healthz) after the build completes.

MCP (Streamable HTTP)

  • Endpoint: https://<service>/mcp

  • CORS: Exposes Mcp-Session-Id header for browser clients (Agent Builder).

Tools

  • ping() -> "pong"

  • server_time(fmt?: string) -> string (UTC)

  • echo(text: string) -> string

Quick checks

# 1) Handshake (should return Mcp-Session-Id)
curl -i https://<service>/mcp

# 2) List tools (replace $SID with header from step 1)
SID=<paste-session-id>
curl -s -H "Content-Type: application/json" -H "Mcp-Session-Id: $SID" \
  -X POST --data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
  https://<service>/mcp

Agent Builder

  • MCP node URL: https://<service>/mcp

  • Auth: None

  • After connect, tools ping, server_time, echo should be selectable.

MCP (Streamable HTTP)

Endpoint: https://<service>/mcp (no trailing slash required)

Tools

  • ping() -> "pong"

  • server_time(fmt?: string) -> string (UTC)

  • echo(text: string) -> string

  • date_math(expr: string) -> string (UTC). Examples: "+2h", "-15m", "+1d 30m"

Verify via curl

# 1) Handshake — should return Mcp-Session-Id header
curl -i https://<service>/mcp

# 2) Save session id and list tools
SID=$(curl -sI https://<service>/mcp | awk -F': ' '/^Mcp-Session-Id:/ {print $2}' | tr -d '\r')

curl -s -H "Content-Type: application/json" -H "Mcp-Session-Id: $SID" \
  -X POST --data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
  https://<service>/mcp | jq .

# 3) Call a tool
curl -s -H "Content-Type: application/json" -H "Mcp-Session-Id: $SID" \
  -X POST --data '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"date_math","arguments":{"expr":"+2h"}}}' \
  https://<service>/mcp | jq .

Agent Builder

  • Node type: MCP

  • URL: https://<service>/mcp

  • Transport: Streamable HTTP

  • Auth: None

  • Click Connect → tools should list: ping, server_time, echo, date_math

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

  • Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server

  • POC MCP server. Tool say_hello returns 'Welcome' (agent -> MCP -> API path).

  • An MCP server that provides an API to LLMs to manage their JumpCloud resources.

  • The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    This server provides a minimal template for creating AI assistant tools using the ModelContextProtocol, featuring a simple 'hello world' tool example and development setups for building custom MCP tools.
    1
    89
    14
    The Unlicense
  • F
    license
    D
    quality
    D
    maintenance
    A ready-to-use starter implementation of the Model Context Protocol (MCP) server that enables applications to provide standardized context for LLMs with sample resources, tools, and prompts.
    2
    0
    1
  • F
    license
    B
    quality
    D
    maintenance
    A basic starter project for building Model Context Protocol (MCP) servers that enables standardized interactions between AI systems and various data sources through secure, controlled tool implementations.
    2
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server implementation built with FastAPI that enables AI agent interactions. Provides a structured foundation for building AI-powered applications with proper data validation and modern Python tooling.

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/mcp-date-and-time'

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