Skip to main content
Glama
Example MCP Server

Example MCP Server

Example MCP Server using FastMCP

Prerequisites

  • uv

  • python 3.12

Related MCP server: Claude MCP Server Integration

Install

After checking out the repo, run uv venv and uv sync

How to run

on Mac (replace folder name with the root of the repo)

uv run --python /Users/chenjian/Documents/ai_projects/my_mcp_server/.venv/bin/python fastmcp run /Users/chenjian/Documents/ai_projects/my_mcp_server/main.py

or

uv run -p /Users/chenjian/Documents/ai_projects/my_mcp_server/.venv/bin/python fastmcp run /Users/chenjian/Documents/ai_projects/my_mcp_server/main.py

Adding this MCP on IDEs

  • With Claude Desktop and cursor

{
  "mcpServers": {
    "my_mcp_server": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "run",
        "--python",
        "/Users/chenjian/Documents/ai_projects/.venv/bin/python",
        "fastmcp",
        "run",
        "/Users/chenjian/Documents/ai_projects/my_mcp_server/main.py"
      ]
    }
  }
}
  • With Claude Code

claude mcp add uv run --python /Users/chenjian/Documents/ai_projects/my_mcp_server/.venv/bin/python fastmcp run /Users/chenjian/Documents/ai_projects/my_mcp_server/main.py

or

claude mcp add uv run -p /Users/chenjian/Documents/ai_projects/my_mcp_server/.venv/bin/python fastmcp run /Users/chenjian/Documents/ai_projects/my_mcp_server/main.py

Available Tools

5 tools
addC

Add two numbers

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

divideC

Divide two numbers

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

magic_wordB

Return a random word from the list

Inputs: no named parameters.

multiplyC

Multiply two numbers

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

subtractC

Subtract two numbers

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

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: add, subtract, multiply, and divide are basic arithmetic operations with no overlap, while magic_word is completely different, returning a random word. There is no ambiguity between tools.

    Naming Consistency4/5

    Four tools (add, divide, multiply, subtract) follow a consistent verb pattern for arithmetic operations, but magic_word deviates with a noun-based name. The naming is mostly consistent with one minor deviation.

    Tool Count5/5

    With 5 tools, this server is well-scoped for basic arithmetic and a simple word function. Each tool earns its place, and the count is appropriate for the apparent purpose.

    Completeness4/5

    For arithmetic, the surface is complete with add, subtract, multiply, and divide covering core operations. The magic_word tool adds a random function, but there is a minor gap in not including more advanced math operations like exponentiation or modulo.

    Related MCP Connectors

    Related MCP Servers