Skip to main content
Glama
MCP Server Template

MCP Server Template

by sh-aidev

MCP Server Template

python mcp uv license

A minimal MCP (Model Context Protocol) server template managed with uv, exposing a string-reversal tool and basic two-integer arithmetic tools (add, subtract, multiply, divide).

πŸ“Œ Feature

  • uv for dependency management

  • TOML + Pydantic based config

  • reverse_string tool

  • add / subtract / multiply / divide tools

  • Centralized logging (loguru)

  • Custom exception handling

  • Standalone stdio client for manual testing

Related MCP server: DDG MCP1234

πŸ“ 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

uv sync

Step 2: Run the server

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

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

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

Available Tools

5 tools
addB

Add two integers

Inputs: a (required), b (required). Returns: result

divideB

Divide the first integer by the second

Inputs: a (required), b (required). Returns: result

multiplyB

Multiply two integers

Inputs: a (required), b (required). Returns: result

reverse_stringA

Reverse a given string

Inputs: text (required). Returns: result

subtractA

Subtract the second integer from the first

Inputs: a (required), b (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A demonstration MCP server that provides basic utility tools including hello world functionality and string reversal operations. Shows how to build and deploy MCP tools using the MCPO orchestrator framework.
      GPL 3.0
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A basic MCP server template with example tools for echoing messages and retrieving server information. Built with FastMCP framework and supports both stdio and HTTP transports.
      -
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A basic MCP server template with example tools for echoing messages and retrieving server information. Built with FastMCP framework and supports both stdio and HTTP transports.
      -
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A basic MCP server template with example tools for echoing messages and retrieving server information. Built with FastMCP framework and supports both stdio and HTTP transports.
      -