hello-mcp-server
Enables MCP clients to perform multilingual greetings, echo text, retrieve server time, and add decimal numbers accurately, while also exposing prompts and resources over stdio or HTTP.
README
hello-mcp-python
A hello-world Model Context Protocol server in Python, plus a console chat client that drives its tools with a small local LLM.
It is deliberately small, but it is not a toy. It uses the official Python MCP SDK, serves both transports (stdio and streamable HTTP), is covered by 29 automated tests including real protocol round-trips over a real pipe, and handles the things that actually break MCP servers in practice.
New to MCP? Start with GETTING-STARTED.md — it builds this entire project from an empty directory, one step at a time, explaining every dependency and every file.
Quick start
Prerequisites: Python 3.14 or newer.
git clone https://github.com/kuldeepcodes/hello-mcp-python.git
cd hello-mcp-python
python -m venv .venv
source .venv/bin/activate # Windows: .\.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
python -m pytest # 29 tests
# Works with no model at all, using deterministic keyword routing
python -m hello_mcp.chat --provider none --ask "hello Kuldeep"
For real conversation, install Ollama and pull a small model:
ollama pull phi3 # ~2.2 GB, works with the prompt planner
python -m hello_mcp.chat --ask "what is 17.5 plus 24.25?"
Server tools
| Tool | Description |
|---|---|
say_hello |
Greets someone by name in 10 languages: en, es, fr, de, it, pt, hi, ja, zh, ar. |
echo |
Returns a message verbatim; useful for connection checks. |
get_server_time |
Returns structured utc, local, timeZone, utcOffset and human fields. |
add |
Adds two numbers with decimal formatting, so 0.1 + 0.2 is 0.3. |
The server also exposes prompts (friendly_greeting, summarize_capabilities) and resources (hello://server/info, plus templated hello://greetings/{language}).
Running the server
# stdio, for local MCP clients
.\.venv\Scripts\python.exe -m hello_mcp.server
# streamable HTTP, endpoint /mcp and liveness /healthz
.\.venv\Scripts\python.exe -m hello_mcp.server --http --port 5099
In stdio mode, stdout is reserved for JSON-RPC. All logging is deliberately sent to stderr.
MCP client configuration
VS Code or Claude Desktop-style stdio config. Use absolute paths — the client does not run from your project directory:
{
"mcpServers": {
"hello-mcp-python": {
"command": "/absolute/path/to/hello-mcp-python/.venv/bin/python",
"args": ["-m", "hello_mcp.server"],
"cwd": "/absolute/path/to/hello-mcp-python"
}
}
}
On Windows the interpreter is ...\\.venv\\Scripts\\python.exe, and backslashes must be escaped
in JSON.
HTTP clients can connect to http://127.0.0.1:5099/mcp after starting the server with --http.
Chat strategies
| Strategy | When chosen | How it works |
|---|---|---|
| Native tool calling | The model accepts a probe request with a tools array. |
The model emits tool calls directly. |
| Prompt planner | The model is reachable but rejects tools, as phi3 does in Ollama. |
The app shows tool names, descriptions, and JSON schemas, asks for one JSON decision, executes it, then asks the model to phrase the result. |
| Offline routing | No model is reachable, or --provider none is used. |
Deterministic keyword rules support hello NAME, what time is it, add 2 and 3, and echo .... |
The selected strategy and reason are printed at startup.
Real transcript
hello-mcp-chat v1.0.0
a Model Context Protocol client for Python
Connected to hello-mcp-server (4 tools)
Model strategy: prompt planner - Ollama says this model does not support tools
[tool] add {"a": 17.5, "b": 24.25} -> 41.75
bot> The sum of 17.5 and 24.25 is 41.75.
Tests and linting
.\.venv\Scripts\python.exe -m ruff check .
.\.venv\Scripts\python.exe -m pytest
The integration tests spawn the real server over stdio, perform a real MCP handshake, list tools, call tools, list prompts, read resources, and assert stdout contains only JSON-RPC.
Limitations
- The prompt planner is intentionally conservative and less reliable than native tool calling.
- HTTP transport has no authentication; this is a local teaching project.
- Windows needs the
tzdatapackage for IANA time zones such asAsia/Kolkata.
Built with
mcp==2.0.0— official Python MCP SDK. In this version the ergonomic API ismcp.server.mcpserver.MCPServer; older examples may call this styleFastMCP.httpx— Ollama and OpenAI-compatible HTTP calls.pytest— unit and integration tests.ruff— linting and formatting.
The same project in other languages
This is one of three parallel implementations, same tools, same behaviour, same lessons:
- hello-mcp-dotnet — C# / .NET 10
- hello-mcp-java — Java 17 / Spring Boot
- hello-mcp-python — Python 3.14+ (you are here)
Licence
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。