mcp-example

lailo/mcp-example

3.2

If you are the rightful owner of mcp-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a comprehensive guide to setting up and running a Model Context Protocol (MCP) server using Python and the UV package manager.

Example MCP Server

An example of how to run a MPC server in Python.

Development Setup

Prerequisites

  • Python 3.12 or higher
  • UV package manager

Installation

  1. Clone the repository:
git clone <repository-url>
cd mcp-example
  1. Install dependencies:
# Install main dependencies
uv sync

# Install development dependencies (for linting, formatting, etc.)
uv sync --extra dev

Running the MCP Server

To run the MCP server with the testing UI, you can execute the following UV command:

uv run mcp dev main.py

Development Tools

This project uses several development tools for code quality. All tools are configured in pyproject.toml and can be run locally:

Code Formatting and Linting

Format code with Black:

uv run black .

Sort imports with isort:

uv run isort .

Lint code with flake8:

uv run flake8 .

Type checking with mypy:

uv run mypy .

Run All Checks

You can run all the same checks that the CI pipeline runs:

# Format and lint
uv run black --check .
uv run isort --check-only .
uv run flake8 .
uv run mypy .

Configuration

The following configuration is for the Claude desktop client.

{
  "mcpServers": {
    "mcp-example": {
      "command": "uv",
      "args": [
        "--directory",
        "___PATH_TO_THIS_REPOSITORY___",
        "run",
        "main.py"
      ]
    }
  }
}