MCP.so
ログイン

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

@liuhaotian9420

基本情報

カテゴリ

開発者ツール

トランスポート

stdio

作者

liuhaotian9420

MCPY-CLI: 快速从 Python 文件构建 MCP 服务 について

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

MCPY-CLI: 快速从 Python 文件构建 MCP 服务 の設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

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

MCPY-CLI: 快速从 Python 文件构建 MCP 服务 のツール

ツール一覧はまだありません

この掲載には表示できるツール一覧がまだありません。サーバーにツールがないという意味ではありません。対応機能はプロジェクトのドキュメントをご確認ください。

ツールは 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).

よくある質問

1

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.

2

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

3

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.

4

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.

5

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`).

コメント

「開発者ツール」の他のコンテンツ