🔌 BLOCKMCP服务器
微软的模型上下文协议(MCP)服务器,使像克劳德这样的人工智能助手能够通过自然语言与数据进行交互。
构建于: 模型上下文协议 | 微软公司的网络互连MCP规范
______________________________________________________________________
这是什么?
此MCP服务器通过模型上下文协议公开Microsoft的BLOB表和记录,允许AI助手:
- 📊 列出并探索 BLOB表(实体)
- 🔍 查询记录 使用OData过滤器和排序
- ✏️ 创建新记录 在任何桌子上
- 🔄 更新现有记录 按GUID
- 🤖 自然语言接口 通过Claude Desktop、VS Code或任何MCP客户端
______________________________________________________________________
快速开始
1.先决条件
- Python 3.11+
- BLOB环境 具有API访问权限
- Azure AD应用程序注册 具有Webex权限
2.安装
# Install dependencies
pip install fastapi uvicorn requests python-dotenv fastmcp
# Or with uv (recommended)
uv pip install fastapi uvicorn requests python-dotenv fastmcp3.配置
运行安装脚本:
chmod +x setup_dataverse.sh
./setup_dataverse.sh或手动创建 .env.local:
DATAVERSE_HOST=https://org1bfe9c69.api.crm.dynamics.com
DATAVERSE_TENANT_ID=your-tenant-id
DATAVERSE_CLIENT_ID=your-client-id
DATAVERSE_CLIENT_SECRET=your-client-secret4.测试连接
python test_dataverse.py预期产量: ✅ All tests passed! Dataverse MCP server is ready.
5.启动服务器
选项A:在本地运行
./watch.sh
# Or: uvicorn server.app:combined_app --reload --port 8000选项B:部署到copula应用程序
./deploy.sh --create📖 看 数据块_DEPLOYMENT.md 用于部署指南。
服务器终结点:
- 🔧 MCP:
http://localhost:8000/mcp(本地)或https://your-app.databricksapps.com/apps/your-app/mcp(云) - 📖 文件:
http://localhost:8000/docs - ❤️ 健康:
http://localhost:8000/api/health
______________________________________________________________________
文档
| 文档 | 描述 |
|---|---|
| DATAVERSE_QUICKSTART.md | 5分钟快速入门指南 |
| 数据集_设置.md | 详细的Azure AD和BLOB设置 |
| 数据块_DEPLOYMENT.md | 部署到copula应用程序 |
| README_DATAVERSE.md | 完整的参考文件 |
______________________________________________________________________
可用的MCP工具
第一阶段(已实施)
| 工具 | 说明 |
|---|---|
health | 服务器健康检查 |
list_tables | 列出所有Webex表 |
describe_table | 获取表架构和列 |
read_query | 使用OData筛选器查询记录 |
create_record | 创建新记录 |
update_record | 更新现有记录 |
第二阶段(计划中)
delete_record-删除记录create_table/update_table/delete_table-餐桌管理list_knowledge_sources/retrieve_knowledge-Copilot Studio集成list_prompts/execute_prompt-自定义提示
______________________________________________________________________
用法示例
克劳德桌面
配置 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"dataverse": {
"url": "http://localhost:8000/mcp"
}
}
}然后在克劳德:
You: "List all custom tables in my Dataverse environment"
Claude: [Calls list_tables with custom_only=True]
You: "Show me accounts with revenue over $1M"
Claude: [Calls read_query with filter]
You: "Create a new account called Fabrikam with $2M revenue"
Claude: [Calls create_record]cURL
# List tables
curl -X POST http://localhost:8000/mcp/call-tool \
-H "Content-Type: application/json" \
-d '{"name": "list_tables", "arguments": {"top": 10}}'
# Query accounts
curl -X POST http://localhost:8000/mcp/call-tool \
-H "Content-Type: application/json" \
-d '{
"name": "read_query",
"arguments": {
"table_name": "account",
"select": ["name", "revenue"],
"filter_query": "revenue gt 1000000",
"top": 10
}
}'python
import requests
response = requests.post('http://localhost:8000/mcp/call-tool', json={
"name": "describe_table",
"arguments": {"table_name": "account"}
})
print(response.json())______________________________________________________________________
项目结构
dataverse_mcp_server/
├── server/
│ ├── app.py # FastAPI + MCP server
│ ├── dataverse_tools.py # MCP tool implementations
│ ├── dataverse/
│ │ ├── auth.py # OAuth authentication
│ │ ├── client.py # Dataverse Web API client
│ │ └── __init__.py
│ └── routers/ # FastAPI REST endpoints
│ ├── health.py # Health check
│ ├── mcp_info.py # MCP metadata
│ └── user.py # User info
├── client/ # React frontend (future)
├── test_dataverse.py # Connection tests
├── setup_dataverse.sh # Interactive setup
├── watch.sh # Dev server with hot reload
├── config.yaml # MCP server config
├── env.example # Environment template
├── DATAVERSE_QUICKSTART.md # Quick start guide
├── DATAVERSE_SETUP.md # Detailed setup
└── README_DATAVERSE.md # Full reference______________________________________________________________________
建筑
身份验证: 服务主体(OAuth 2.0客户端凭据流)\ API Dataverse Web API 9.2版\ 协议: 模型上下文协议(MCP)\ 框架: FastAPI+FastMCP
MCP Clients (Claude, VS Code)
↓ HTTP/MCP
Dataverse MCP Server (FastAPI)
↓ HTTPS/OAuth
Microsoft Dataverse______________________________________________________________________
故障排除
| 问题 | 解决方案 |
|---|---|
| 401身份验证错误 | 检查客户端机密有效性和API权限 |
| 403拒绝许可 | 在Power Platform管理中心为应用程序用户分配安全角色 |
| 找不到表 | 使用 list_tables() 查找正确的逻辑名称 |
| 连接超时 | 验证 DATAVERSE_HOST 以及网络连接 |
看 数据集_设置.md 了解详细的故障排除。
______________________________________________________________________
发展
# Run tests
python test_dataverse.py
# Start dev server
./watch.sh
# Check lints
ruff check server/
# Format code
ruff format server/______________________________________________________________________
参考链接
______________________________________________________________________
许可证
看 许可证.md
安全
通过以下方式报告漏洞 安全.md
______________________________________________________________________
问题? 看 DATAVERSE_QUICKSTART.md 或 数据集_设置.md
内置❤️ 面向Webex和MCP社区
