Skip to main content

A template (repository) for developing MCP servers in Python

Project description

Python 3.12+ pytest smithery badge

pymcp logo

Primarily to be used as a template repository for developing MCP servers with FastMCP in Python, PyMCP is somewhat inspired by the official everything MCP server in Typescript.

Installation

The directory where you clone this repository will be referred to as the working directory or WD hereinafter.

Install uv. To install the project with its minimal dependencies in a virtual environment, run the following in the WD. To install all non-essential dependencies (which are required for developing and testing), replace the --no-dev with the --all-groups flag in the following command.

uv sync --no-dev

Standalone usage

PyMCP can be started standalone as a MCP server with stdio transport by running the following. However, you are unlikely to use it this way.

uv run pymcp

Furthermore, being a template repository, the code deliberately does not implement streamable-http and sse transports.

Test with the MCP Inspector

The MCP Inspector is an official Model Context Protocol tool that can be used by developers to test and debug MCP servers. This is the most comprehensive way to explore the MCP server.

To use it, you must have Node.js installed. The best way to install and manage node as well as packages such as the MCP Inspector is to use the Node Version Manager (or, nvm). Once you have nvm installed, you can install and use the latest Long Term Release version of node by executing the following.

nvm install --lts
nvm use --lts

Following that, run the MCP Inspector and PyMCP by executing the following in the WD.

npx @modelcontextprotocol/inspector uv run pymcp

This will create a local URL at port 6274 with an authentication token, which you can copy and browse to on your browser. Once on the MCP Inspector UI, press Connect to connect to the MCP server. Thereafter, you can explore the tools available on the server.

Use it with Claude Desktop, Visual Studio, and so on

The server entry to run with stdio transport that you can use with systems such as Claude Desktop, Visual Studio Code, and so on is as follows.

{
    "command": "uv",
    "args": [
        "run",
        "pymcp"
    ]
}

Instead of having pymcp as the last item in the list of args, you may need to specify the full path to the script, e.g., WD/.venv/bin/pymcp.

Contributing

Install pre-commit for Git by using the --all-groups flag for uv sync for the installation of PyMCP.

Then enable pre-commit by running the following in the WD.

pre-commit install

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymcp_template-0.1.0.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymcp_template-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pymcp_template-0.1.0.tar.gz.

File metadata

  • Download URL: pymcp_template-0.1.0.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for pymcp_template-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb794bae84ed23cd4091a83022d0f3c28c994e069c35b5c4e9a294e1e68950ed
MD5 f0cbc8e46a410d03064bd01377368bcd
BLAKE2b-256 b39eab8c13bca8c0777c9aa8b0ed3c53b4955eedbf4fc0b50b45ef327c6e1ab9

See more details on using hashes here.

File details

Details for the file pymcp_template-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymcp_template-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d04c9b5bcd27cd699bdbdc15657e4eec337d141b552e2e590c0eadade97313d
MD5 cd1c4a4daabed82d623f37aed36641ae
BLAKE2b-256 c2635996b87a5d271ebc16dec24981d68375dab603729a2d405e3a2ada981291

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page