Python Plot MCP
一个专注于 Python 画图的 MCP (Model Context Protocol) 服务器,支持在云端执行 Python 代码并生成 matplotlib 图表。
功能特点
- ✅ Python 沙箱执行:安全隔离的 Python 代码执行环境
- ✅ Matplotlib 支持:内置 matplotlib 和中文字体
- ✅ Base64 图像返回:生成的图表直接返回为 data URL
- ✅ 完整 MCP 协议:符合 MCP 标准
- ✅ 多种安装方式:支持 uvx、pip、npx
安装
方式一:uvx(推荐 - 魔搭平台)
uvx python-plot-mcp
方式二:pip
pip install python-plot-mcp
python-plot-mcp
方式三:npx(Node.js)
npx python-plot-sandbox-mcp
使用
魔搭平台配置
在魔搭 MCP 广场或支持 MCP 的客户端中配置:
{
"mcpServers": {
"python-plot": {
"command": "uvx",
"args": ["python-plot-mcp"]
}
}
}
本地开发配置
{
"mcpServers": {
"python-plot": {
"command": "python",
"args": ["-m", "python_plot_mcp"]
}
}
}
工具:run_python
执行 Python 代码并生成图表。
参数
code(string, 必需): Python 代码timeout_s(integer, 可选): 超时时间(秒),默认 12return_inline_image(boolean, 可选): 返回 base64 图片,默认 true
示例
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(10, 6))
plt.plot(x, y)
plt.title('正弦波')
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.grid(True)
plt.show()
依赖
- Python 3.9+
- matplotlib
- numpy
- Pillow
许可证
MIT
作者
Your Name
Metadata
Release files for python-plot-mcp 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_plot_mcp-1.0.3.tar.gz | 5.7 kB | Without provenance | Details for python_plot_mcp-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_plot_mcp-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for python_plot_mcp-1.0.3-py3-none-any.whl |
Total release size: 12.2 kB
Release files / python_plot_mcp-1.0.3.tar.gz
| Download URL | python_plot_mcp-1.0.3.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54dea79dddf3321d7b9b02384263e3ad259d457287b2832d7507166e7c28bb67
|
|
BLAKE2b-256 checksum How to use checksums |
1cfe8a01341b130f76642406cda95fe72639117f033b725fbbcc9570c3a7d4a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / python_plot_mcp-1.0.3-py3-none-any.whl
| Download URL | python_plot_mcp-1.0.3-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0cd58f1400e30e79c2c248e3df924ce5f0c9d5b9ede0985a55181f1b006b677
|
|
BLAKE2b-256 checksum How to use checksums |
e66cf21c905dd76edef0819029ee7c41ef16c535cc4b186dedec2ddf1962a2d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for python-plot-mcp 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.