Skip to main content

Python MCP提示词服务

基于Model Context Protocol的Python SDK实现的提示词管理服务。

功能

  • 连接Cloudflare Worker API获取提示词数据
  • 提供MCP接口供Claude等AI助手调用
  • 包含可靠的重试、超时和缓存机制

安装

  1. 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Linux/Mac
# 或者 venv\Scripts\activate  # Windows
  1. 安装依赖
pip install -r requirements.txt

使用方法

直接测试API连接

运行direct_test.py测试直接连接到Cloudflare Worker API:

python direct_test.py

启动MCP服务器

python mcp_server.py

或使用MCP CLI工具:

mcp dev mcp_server.py

在Claude Desktop中安装

mcp install mcp_server.py --name "提示词管理服务"

测试MCP客户端

python test_client.py

配置选项

可以在mcp_server.py文件中修改以下配置项:

  • WORKER_URL - Cloudflare Worker API的URL
  • API_TIMEOUT - API请求超时时间(秒)
  • RETRIES - 重试次数

代理配置

如需使用代理,可设置以下环境变量:

# Linux/Mac
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890

# Windows
set HTTP_PROXY=http://127.0.0.1:7890
set HTTPS_PROXY=http://127.0.0.1:7890

Metadata

Release files for python-mcp 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-mcp 1.0.1
File Size Uploaded
python_mcp-1.0.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-mcp 1.0.1
File Interpreter ABI Platform
python_mcp-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / python_mcp-1.0.1.tar.gz

Download URL python_mcp-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0b3f4fab87cdd7839669204c6bbbb1d07a0c20d5e22e05ce3eee567e1c94f2c5
BLAKE2b-256 checksum
How to use checksums
cff285106c333721c39500a05a6b2ab144f2bf61b2ebe661ebadc087c2f9ddc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / python_mcp-1.0.1-py3-none-any.whl

Download URL python_mcp-1.0.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04b9ca4ab6e5d206ce9e54fc0ee941d9a3b7f9e405baef83625199024b2cfdf6
BLAKE2b-256 checksum
How to use checksums
5f246db39be3196ef9dfd6056f4e3306339358a17755cfc3a388df27ee3331a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page