MCP.so
登录

🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务

@liuhaotian9420

关于 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务

A cli tool to auto discover and build MCP service from Python files

基本信息

分类

开发工具

运行时

python

传输方式

stdio

发布者

liuhaotian9420

配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "mcpy-cli": {
      "command": "uv",
      "args": [
        "pip",
        "install",
        "mcpy-cli"
      ]
    }
  }
}

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务?

🚀 MCPY-CLI is a command-line toolkit that converts one or more Python functions or scripts into standard MCP (Model Context Protocol) services. It automatically generates service routes, supports multiple transport protocols, and offers one‑click deployment. It is designed for developers who want to quickly build and deploy MCP services from existing Python code.

How to use 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务?

Install via pip install mcpy-cli (requires Python ≥ 3.10 and FastMCP). Use mcpy-cli run --source-path <file_or_dir> to launch a local MCP service on port 8080 (default). Use mcpy-cli package --source-path <path> --package-name <name> to package the service for production. Options include --mode (composed/routed) and --enable-event-store for persistence.

Key features of 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务?

  • Converts Python functions into MCP tools automatically.
  • Supports two server architectures: composed and routed.
  • Provides both local run and production packaging commands.
  • Offers Streamable HTTP transport (default) and legacy SSE.
  • Supports event store persistence with SQLite.
  • Includes session‑level tool call caching for performance.

Use cases of 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务?

  • Quickly expose existing Python utility functions as MCP tools.
  • Prototype and debug MCP services with automatic reload during development.
  • Package multiple Python modules into a deployable MCP service for production.
  • Build modular MCP services with separate routes for different tool groups (routed mode).

FAQ from 🚀 MCPY-CLI: 快速从 Python 文件构建 MCP 服务?

What are the dependencies and runtime requirements?

Python ≥ 3.10 and the FastMCP library are required. The uv package manager is recommended but not mandatory.

How does persistence work?

By using the --enable-event-store flag, the service stores JSON‑RPC messages in a local SQLite database (default ./mcp_event_store.db), enabling state recovery after restarts. The path can be customized with --event-store-path.

What transport protocols are supported?

The default transport is Streamable HTTP (stable and recommended). Legacy SSE mode can be enabled via --legacy-sse but is deprecated and may have path issues in cloud environments like Knative/Istio.

How does caching work?

The SessionToolCallCache is an in‑memory cache tied to a user session. It stores results of tool calls performed with the same arguments, avoiding redundant executions. It is primarily active in stateful JSON response mode.

What are the two server modes?

  • Composed mode (default): All tools are mounted under one FastMCP instance; tool names are prefixed with the source file name.
  • Routed mode: Each file gets its own FastMCP instance serving at a separate URL path (e.g., /math_tools).

评论

开发工具 分类下的更多 MCP 服务器