MCP Server Template
by sh-aidev
README.md
<div align="center">
# MCP Server Template
[](https://www.python.org/)
[](https://modelcontextprotocol.io/)
[](https://github.com/astral-sh/uv)

A minimal MCP (Model Context Protocol) server template managed with [uv](https://github.com/astral-sh/uv), exposing a string-reversal tool and basic two-integer arithmetic tools (`add`, `subtract`, `multiply`, `divide`).
</div>
## š Feature
- [x] `uv` for dependency management
- [x] TOML + Pydantic based config
- [x] `reverse_string` tool
- [x] `add` / `subtract` / `multiply` / `divide` tools
- [x] Centralized logging (loguru)
- [x] Custom exception handling
- [x] Standalone stdio client for manual testing
## š Project Structure
The directory structure of the project looks like this:
```
āāā LICENSE
āāā Makefile
āāā README.md
āāā client.py
āāā main.py
āāā configs
ā āāā config.toml
āāā outputs
āāā pyproject.toml
āāā src
āāā __init__.py
āāā app.py
āāā server
ā āāā __init__.py
ā āāā server.py
āāā utils
āāā __init__.py
āāā config.py
āāā exceptions.py
āāā logger.py
āāā models.py
```
## š Getting Started
### Step 1: Install dependencies
```bash
uv sync
```
### Step 2: Run the server
```bash
uv run python main.py
# or
make run
```
The server communicates over stdio and is meant to be launched by an MCP client (see Step 3), not run standalone in a terminal.
### Step 3: Try it with the bundled client
```bash
uv run python client.py
# or
make client
```
This spawns `main.py` as a subprocess over stdio, lists the available tools, then prompts you to try `reverse_string` and the arithmetic tools.
### Step 4 (optional): Inspect it with the MCP Inspector
```bash
uv run mcp dev main.py:mcp
```
Opens a browser UI to browse and call the registered tools interactively. `main.py` exposes a lazily-built `mcp` attribute for this purpose (see `__getattr__` at the bottom of the file) ā normal runs via `make run` / `make client` don't trigger it.
## š References
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk)
- [uv](https://github.com/astral-sh/uv)
TDQS
A3.6/5.0
Scored across 5 tools
Disambiguation5/5
Each tool has a clear, distinct purpose: four basic arithmetic operations on integers and one string reversal. There is no overlap in functionality.
Naming Consistency5/5
All tool names are verbs or verb_noun in lowercase with underscores where needed, following a consistent pattern (e.g., add, divide, reverse_string).
Tool Count5/5
With 5 tools, the count is well within the ideal range (3-15) and each tool serves a distinct function.
Completeness3/5
The arithmetic operations are basic but missing common ones like modulo or power. The single string operation feels isolated and incomplete without other string utilities.
Maintenance
ActivityInactive
ResponsivenessNo recent community issues