home / mcp / hello world mcp server

Hello World MCP Server

A minimal Python FastAPI MCP server exposing a hello resource and hello tool for end-to-end MCP client validation.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bankszach-mcp-date-and-time": {
      "url": "http://127.0.0.1:8080/mcp"
    }
  }
}

You run a minimal Model Context Protocol (MCP) server backed by FastAPI. It exposes a resource and a tool that respond with a simple Hello World message so you can validate your MCP client integration end-to-end. You can run locally with FastAPI via Uvicorn, verify health, and connect your MCP client to exercise a basic workflow before wiring up richer resources and tools.

How to use

Connect your MCP client to the HTTP MCP streamable endpoint to start validating resource and tool interactions. Point your MCP client at the endpoint you run locally, or at a hosted instance if you deploy it. When connected, you should see a resource://hello response with a Hello World message and a say_hello tool that returns a greeting. Use this setup as a baseline to wire up more complex resources and tools in your MCP server.

How to install

# Create a virtual environment
python -m venv .venv
# Activate the virtual environment (bash/zsh)
source .venv/bin/activate
# Install requirements
pip install -r requirements.txt

Additional sections

Run the server locally using FastAPI with Uvicorn. The server exposes a readiness probe at the root URL, a health check at /healthz, and the MCP streamable HTTP endpoint mounted at /mcp. You can also run the server via Docker Compose to simplify local development and testing.

uvicorn app:app --reload --port 8080

Docker quickstart

If you prefer a containerized setup, you can build and run the server with a single command. After the build completes, the server is reachable at the root URL and at /healthz.

docker compose up --build

MCP (Streamable HTTP) details you can use in your client

The MCP streamable HTTP endpoint is available at the /mcp path. It supports a small set of tools that you can invoke after establishing a session. The following tools are available for quick validation and time-related operations.

Tools available for quick checks

- ping β†’ returns pong to verify connectivity.

- server_time(fmt?: string) β†’ returns the current UTC time, optionally formatted.

- echo(text: string) β†’ echoes back the provided text.

- date_math(expr: string) β†’ computes a date-time in UTC using expressions like +2h, -15m, or +1d 30m.

Agent Builder notes

When you connect with an MCP client, the node URL is https://<service>/mcp. After a successful handshake, tools ping, server_time, echo, and date_math should be selectable. Use these tools to validate end-to-end tool invocation and basic time calculations.

Available tools

ping

Checks connectivity by returning a simple 'pong' response to confirm the MCP streamable HTTP path is reachable.

server_time

Returns the current UTC time, optionally formatted with a given pattern.

echo

Echoes back the provided text, useful for validating payload transmission.

date_math

Calculates a UTC timestamp based on expressions like +2h, -15m, or +1d 30m for quick timing calculations.