shap-mcp
SHAP MCP 服务器(shap-mcp)
一个轻量级、专注的**模型上下文协议(MCP)**服务器,将 SHAP(SHapley Additive exPlanations)模型可解释性暴露为可供智能体调用的工具。
专为 AI 助手(如 Claude Desktop)和数据科学家设计,可在共享的内存会话中无缝协作。
主要特性
双并发传输:标准
stdio传输用于 Claude Desktop,同时 StarletteHTTP传输在8765端口上提供 Web GUI 和生成的图表。统一内存会话:通过 Web GUI 运行分析并在 Claude 中提问,或让 Claude 触发分析并立即在 GUI 图库中查看生成的图表。
通用模型支持:
tree:针对 XGBoost、LightGBM、CatBoost、RandomForest、ExtraTrees 的精确 TreeExplainer。linear:针对逻辑回归、Ridge、Lasso 的快速闭式 LinearExplainer。deep:针对 PyTorch 神经网络的 DeepExplainer。kernel:与模型无关的 KernelExplainer,支持自动 kmeans 聚类。
可发表级图表:生成并保存 6 种图表类型(
summary、bar、waterfall、force、dependence、heatmap),附带预格式化的可点击浏览器和本地文件链接。URL 与文件导入:从本地路径或公共 HTTP/HTTPS URL 导入模型和 CSV 数据集,支持流式下载、自动大小上限(
SHAP_MCP_MAX_DOWNLOAD_MB)和临时文件清理。安全性:通过
SHAP_MCP_API_KEY为 HTTP 端点提供可选的 API 密钥认证。
Related MCP server: my-mcp-server2
安装
# Standard installation
pip install shap-mcp
# Optional extra for PyTorch DeepExplainer support
pip install shap-mcp[deep]Claude Desktop 配置
将 shap-mcp 添加到您的 claude_desktop_config.json:
通用推荐配置(通过 uvx)
{
"mcpServers": {
"shap-mcp": {
"command": "uvx",
"args": ["shap-mcp", "--no-ui"]
}
}
}直接 Pip / Pipx 配置
{
"mcpServers": {
"shap-mcp": {
"command": "shap-mcp",
"args": ["--no-ui"]
}
}
}工具参考
工具 | 用途 | 关键输入 |
| 加载 |
|
| 在数据集上计算 SHAP 值 |
|
| 全局排名前 N 个特征 |
|
| 单个实例的局部归因分解 |
|
| 成对特征交互强度(Tree 模型) |
|
| 渲染并保存 PNG 图表,附带可点击 URL |
|
运行时配置
所有运行时配置均通过环境变量管理:
变量 | 默认值 | 描述 |
|
| HTTP 服务器端口(若被占用则自动递增; |
| (未设置) | HTTP 认证的 Bearer 令牌;未设置 = 本地主机无需认证 |
|
| 保存生成的图表 PNG 的根目录 |
|
| 基于 URL 的模型/数据集下载的最大大小上限 |
|
| 结构化 JSON 日志级别( |
Web GUI
通过 shap-mcp 直接启动时,服务器会自动在 http://localhost:8765/ui/ 打开 Web GUI:
配置表单:输入本地路径或 URL,选择模型架构,并运行分析。
实时徽章:实时显示模型加载状态、已分析行数和当前解释器类型。
动态图表图库:当 Claude 或 GUI 生成图表时,缩略图会自动出现。
实例解释器:单个特征贡献的交互式表格。
即将推出的功能与路线图
以下功能计划在后续版本中推出:
save_analysis/load_analysis:将计算出的 SHAP 值序列化为.npz文件,以便在重新加载时跳过重新计算,并在团队间共享结果。受认证保护的远程导入:支持 Hugging Face 令牌、私有 S3/GCS 存储桶和预签名 URL。
标签页 GUI 与渐进式披露:将 Web GUI 重新设计为简洁、聚焦的标签页,随着分析完成逐步解锁。
交互式图表:通过
mpld3支持 matplotlib 图表的平移、缩放和悬停提示。图表专属引导提示:为 6 种图表类型分别定制专门的 MCP 提示。
多租户会话隔离:为共享多用户服务器部署提供连接隔离的会话状态。
更多模型格式:原生支持 ONNX runtime、MLflow 模型和 Weights & Biases 模型注册表。
公平性与偏差分解:按子群体的人口统计均等性和基于切片的 SHAP 分析。
MCP-UI 内联画布与本地拖放:通过 MCP-UI / MCP Apps 规范直接在聊天中渲染画布,支持本地拖放文件导入,消除外部浏览器标签页和云附件摩擦。
许可证
MIT 许可证。详情请参阅 LICENSE。
Maintenance
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that supports STDIO, SSE and Streamable HTTP protocols for AI model interactions.131MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server built with FastMCP that features dynamic tool loading and modular management via a dedicated tool directory. It supports both stdio and HTTP transport modes, enabling efficient development and deployment of custom MCP tools.
- AlicenseNot gradedqualityDmaintenanceModel Context Protocol server that standardizes tool discovery, execution, and context management for AI applications.MIT
- FlicenseNot gradedqualityDmaintenanceA robust, lightweight Model Context Protocol (MCP) server designed to empower your AI Agents with context-awareness, safe execution sandboxes, and dedicated thought logs.
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Manas-maker/shap-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server