这是一个用于 Microsoft Dynamics 365 Business Central 的 Model Context Protocol (MCP) 服务器。它通过正确格式化的 API v2.0 调用,为 AI 助手提供对 Business Central 数据的直接访问。
/companies(id)/resource 格式(没有 ODataV4 段)npx 运行,无需预先安装get_schema, list_items 等无需安装!在 Claude Desktop 或 Claude Code 中进行配置:
{
"mcpServers": {
"business-central": {
"type": "stdio",
"command": "cmd",
"args": ["/c", "npx", "-y", "@knowall-ai/mcp-business-central"],
"env": {
"BC_URL_SERVER": "https://api.businesscentral.dynamics.com/v2.0/{tenant-id}/{environment}/api/v2.0",
"BC_COMPANY": "您的公司名称",
"BC_AUTH_TYPE": "azure_cli"
}
}
}
}
注意(Windows):如上所示,使用 cmd 和 /c 来正确执行 npx。
通过 Smithery 安装:
npx -y @smithery/cli install @knowall-ai/mcp-business-central --client claude
git clone https://github.com/knowall-ai/mcp-business-central.git
cd mcp-business-central
npm install
npm run build
node build/index.js
| 变量 | 必需 | 描述 | 示例 |
|---|---|---|---|
BC_URL_SERVER | 是 | Business Central API 基础 URL | https://api.businesscentral.dynamics.com/v2.0/{tenant}/Production/api/v2.0 |
BC_COMPANY | 是 | 公司显示名称 | KnowAll Ltd |
BC_AUTH_TYPE | 否 | 认证类型(默认:azure_cli) | azure_cli |
Production 或 Sandbox示例 URL 格式:
https://api.businesscentral.dynamics.com/v2.0/00000000-0000-0000-0000-000000000000/Production/api/v2.0
az loginaz account get-access-token --resource https://api.businesscentral.dynamics.comget_schema获取 Business Central 资源的 OData 元数据。
参数:
resource (字符串,必需):资源名称(例如,customers, contacts, salesOpportunities)示例:
{
"resource": "customers"
}
list_items列出项目,可选过滤和分页。
参数:
resource (字符串,必需):资源名称filter (字符串,可选):OData 过滤表达式top (数字,可选):返回的最大项目数skip (数字,可选):跳过的项目数以实现分页示例:
{
"resource": "customers",
"filter": "displayName eq 'Contoso'",
"top": 10
}
get_items_by_field根据特定字段值获取项目。
参数:
resource (字符串,必需):资源名称field (字符串,必需):要筛选的字段名称value (字符串,必需):匹配值示例:
{
"resource": "contacts",
"field": "companyName",
"value": "Contoso Ltd"
}
create_item在 Business Central 中创建新项目。
参数:
resource (字符串,必需):资源名称item_data (对象,必需):要创建的项目数据示例:
{
"resource": "contacts",
"item_data": {
"displayName": "John Doe",
"companyName": "Contoso Ltd",
"email": "john.doe@contoso.com"
}
}
update_item更新现有项目。
参数:
resource (字符串,必需):资源名称item_id (字符串,必需):项目 ID(GUID)item_data (对象,必需):要更新的字段示例:
{
"resource": "customers",
"item_id": "1366066e-7688-f011-b9d1-6045bde9b95f",
"item_data": {
"displayName": "更新后的名称"
}
}
delete_item从 Business Central 删除项目。
参数:
resource (字符串,必需):资源名称item_id (字符串,必需):项目 ID(GUID)示例:
{
"resource": "contacts",
"item_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
}
companies - 公司信息customers - 客户记录contacts - 联系人记录salesOpportunities - 销售机会salesQuotes - 销售报价salesOrders - 销售订单salesInvoices - 销售发票items - 产品/服务项目vendors - 供应商记录az loginaz account get-access-token --resource https://api.businesscentral.dynamics.comcustomers 而不是 customer)get_schema 探索可用资源# 安装依赖
npm install
# 构建 TypeScript
npm run build
# 开发监视模式
npm run dev
MIT
欢迎在 https://github.com/knowall-ai/mcp-business-central 提交问题和拉取请求