ai.smithery/anirbanbasu-pymcp

平台与服务

by anirbanbasu

在 Python 中基于 FastMCP 开发 MCP server 的模板仓库,适合快速搭建、试验与后续扩展。

什么是 ai.smithery/anirbanbasu-pymcp

在 Python 中基于 FastMCP 开发 MCP server 的模板仓库,适合快速搭建、试验与后续扩展。

README

Python 3.12+ pytest PyPI GitHub commits since latest release CodeQL Advanced OpenSSF Scorecard

<p align="center"> <img width="256" height="84" src="https://raw.githubusercontent.com/anirbanbasu/pymcp/master/resources/logo.svg" alt="pymcp logo" style="filter: invert(1)"> </p>

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.

Components

The following components are available on this MCP server.

Tools

  1. greet
  • Greets the caller with a quintessential Hello World message.
  • Input(s)
    • name: string (optional): The name to greet. Default value is none.
  • Output(s)
    • TextContent with a UTC time-stamped greeting.
  1. generate_password
  • Generates a random password with specified length, optionally including special characters and conforming to the complexity requirements of at least one lowercase letter, one uppercase letter, and two digits. If special characters are included, it will also contain at least one such character.
  • Input(s)
    • length: integer: The length of the generated password. The value must be an integer between 8 and 64, both inclusive.
    • use_special_chars: boolean (optional): A flag to indicate whether the password should include special characters. Default value is False.
  • Output(s)
    • TextContent with the generated password.
  1. text_web_search
  • Searches the web with a text query using the Dux Distributed Global Search (DDGS).
  • Input(s)
    • query: string: The search query to fetch results for. It should be a non-empty string.
    • region: string (optional): Two letter country code followed by a hyphen and then by two letter language code, e.g., uk-en or us-en. Default value is uk-en.
    • max_results: integer (optional): Optional maximum number of results to be fetched. Default value is 10.
    • pages: integer (optional): Optional number of pages to spread the results over. Default value is 1.
  • Environment variable(s)
    • DDGS_PROXY: string (optional): Optional proxy server to use for egress web search requests.
  • Output(s)
    • TextContent with a list of dictionaries with search results.
  1. permutations
  • Calculates the number of ways to choose $k$ items from $n$ items without repetition and with order. If $k$ is not provided, it defaults to $n$.
  • Input(s)
    • n: integer: The number of items to choose from. This should be a non-zero, positive integer.
    • k: integer (optional): The number of items to choose. Default value is the value of n.
  • Output(s)
    • TextContent with number of ways to choose $k$ items from $n$, essentially ${}^{n}P_{k}$.
  1. run_python_code
  • Runs arbitrary Python code in a secure and fast interpreter using Pydantic Monty. Note that Pydantic Monty is experimental and Python language support is partial as of February 8, 2026.
  • Input(s)
    • code: string: The Python code to run.
    • inputs: dict[str, Any] (optional): A dictionary of input values for the Python code. Default value is None.
    • script_name: str (optional): The name of the script used in traceback and error messages. Default value is main.py.
    • check_types: bool (optional): A flag to indicate whether to check types. Default value is True.
    • type_definitions: str (optional): Type definitions to be used for type checking. Default value is None.
  • Output(s)
    • TextContent with the output, if any, of the Python code.

[!NOTE] The pirate_summary (LLM client sampling) and vonmises_random (client elicitation) example tools have been removed. Both relied on server-initiated requests (ctx.sample() and ctx.elicit()), which SEP-2577 removed from the modern MCP protocol (2026-07-28) in favour of a stateless per-request envelope with no back-channel for the server to call back into the client. FastMCP now marks both APIs deprecated — they still function, but only on the older, handshake-era (session-based) protocol. Since PyMCP tracks the cutting edge of FastMCP, these tools were dropped rather than pinned to a deprecated protocol era.

Resources

  1. resource_logo
  • Retrieves the Base64 encoded PNG logo of PyMCP along with its SHA3-512 hash.
  • URL: data://logo
  • Output(s)
    • TextContent with a Base64EncodedBinaryDataResponse Pydantic object with the following fields.
      • data: string: The Base64 encoded PNG logo of PyMCP.
      • hash: string: The hexadecimal encoded cryptographic hash of the raw binary data, which is represented by its Base64 encoded string equivalent in data. (The hex encoded hash value is expected to be 6414b58d9e44336c2629846172ec5c4008477a9c94fa572d3419c723a8b30eb4c0e2909b151fa13420aaa6a2596555b29834ac9b2baab38919c87dada7a6ef14.)
      • hash_algorithm: string: The cryptographic hash algorithm used, e.g., sha3_512.
  1. resource_logo_svg
  • Retrieves the SVG logo of PyMCP.
  • URL: data://logo_svg
  • Output(s)
    • TextContent with a the SVG data for the PyMCP logo.
  1. resource_unicode_modulo10
  • Computes the modulus 10 of a given number and returns a Unicode character representing the result. The character is chosen based on whether the modulus is odd or even. For odd modulus, it uses the Unicode characters ❶ (U+2776), ❸ (U+2778), ❺ (U+277A), ❼ (U+277C), and ❾ (U+277E). For even modulus, it uses the Unicode characters ⓪ (U+24EA), ② (U+2461), ④ (U+2463), ⑥ (U+2465), and ⑧ (U+2467).
  • URL: data://modulo10/{number}
  • Input(s)
    • number: integer: A positive integer between 1 and 1000, both inclusive.
  • Output(s)
    • TextContent with a string representing the correct Unicode character.

Prompts

  1. code_prompt
  • Get a prompt to write a code snippet in Python based on the specified task..
  • Input(s)
    • task: string: The description of the task for which a code implementation prompt will be generated.
  • Output(s)
    • str representing the prompt.

Installation

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

Install uv. Install just. 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 install taget with the install-all target in the following command.

bash
just install

Environment variables

The following environment variables can be configured.

  • PYMCP_LOG_LEVEL: Sets the Python log level for the PyMCP server. Default is INFO.
  • MCP_SERVER_TRANSPORT: Sets the FastMCP server transport type of this MCP server. Default is stdio.
  • RESPONSE_CACHE_TTL: Sets the time, in seconds, for the time-to-live (TTL) cache that can be activated for caching prompt, resource and tool responses from the server. Default value is 30. Any integer value between 0 and 86400 (i.e., one day), both inclusive, is valid. Setting it to 0 effectively disables response caching.
  • FASTMCP_HOST: Sets the host address for the FastMCP server when using network transports (e.g., streamable-http, sse). Default is localhost.
  • FASTMCP_PORT: Sets the port number for the FastMCP server when using network transports. Default is 8000.
  • ASGI_CORS_ALLOWED_ORIGINS: Sets the CORS allowed origins when the MCP server is started with a transport over HTTP. Default is ["*"].

Standalone usage

PyMCP can be started standalone as a MCP server with stdio transport by running the following. Alternatively, it can be started using streamable-http or sse transports by specifying the transport type using the MCP_SERVER_TRANSPORT environment variable.

bash
uv run pymcp

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.

bash
nvm install --lts
nvm use --lts

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

bash
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.

You can, alternatively, launch the MCP inspector by running just launch-inspector.

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.

json
{
    "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.

Remotely hosted options

The currently available remotely hosted options are as follows.

Testing and coverage

To run the provided set of tests using pytest, execute the following in WD. To get a report on coverage while invoking the tests, run the following in WD.

bash
just test-coverage

This will generate something like the following output.

bash
Name    Stmts   Miss    Cover   Missing
---------------------------------------
TOTAL     214      0  100.00%

Contributing

See the Contributing guide.

License

MIT.

常见问题

ai.smithery/anirbanbasu-pymcp 是什么?

在 Python 中基于 FastMCP 开发 MCP server 的模板仓库,适合快速搭建、试验与后续扩展。

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描176.4k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描176.4k

接口测试套件

by alirezarezvani

Universal
热门

扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。

帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。

平台与服务
未扫描26.0k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
89.7k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
80.0k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
72.9k

评论