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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_plot_mcp-1.0.3.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_plot_mcp-1.0.3.tar.gz.
File metadata
- Download URL: python_plot_mcp-1.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54dea79dddf3321d7b9b02384263e3ad259d457287b2832d7507166e7c28bb67
|
|
| MD5 |
12f55741ad5ec3d1aeefa6909af24866
|
|
| BLAKE2b-256 |
1cfe8a01341b130f76642406cda95fe72639117f033b725fbbcc9570c3a7d4a7
|
File details
Details for the file python_plot_mcp-1.0.3-py3-none-any.whl.
File metadata
- Download URL: python_plot_mcp-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0cd58f1400e30e79c2c248e3df924ce5f0c9d5b9ede0985a55181f1b006b677
|
|
| MD5 |
600bcd5d1f6937022e5cd9071993d315
|
|
| BLAKE2b-256 |
e66cf21c905dd76edef0819029ee7c41ef16c535cc4b186dedec2ddf1962a2d0
|