kingdee_star
kingdee_star —— 金蝶云星辰 MCP Server
GC032 财务智能体 · 金蝶端(钉钉侧已由钉钉 MCP 打通,本仓库只做金蝶)。 对齐需求 v2.1:一期只读 + 发票税额计算 + 报销单待录入报文生成。
v0.2.0 重要变更:鉴权、端点、税额引擎均已按官方文档与沙箱实测重写。 v0.1.0 的端点常量(
/finance/expense一类)在真实网关上并不存在,请勿沿用。
目录
kingdee_star/
├── kingdee_star/
│ ├── config.py # 环境/凭据(两层:ISV + 租户),只读/写开关
│ ├── signer.py # jdy 网关签名(X-Api-Signature / app_signature)
│ ├── models.py # Invoice / ExpenseDraft / ExpenseLine
│ ├── tax_engine.py # 发票税额决策树(专票/铁路/航空/旅客运输/公路水路/其他)
│ ├── guards.py # 只读守卫 + 受控写入守卫(白名单+默认拒绝)+ 审计
│ └── star_client.py # 鉴权 + 只读查询 + 报销报文生成
├── test_connection.py # 分层联调测试(配置→网络→鉴权→只读→dry-run)
├── run_test.bat # Windows 一键跑:装依赖 + 单测 + 联调
├── tests/ # pytest:税额引擎 + 签名算法
└── .env.example # 配置模板Related MCP server: QuickBooks Online MCP Server
鉴权(两层凭据,别搞混)
层 | 取值 | 用途 |
ISV 应用 |
|
|
租户账套 |
| 计算 |
链路:
POST /jdyconnector/app_management/push_app_authorize?outerInstanceId=...
→ data[0].appKey / appSecret
GET /jdyconnector/app_management/kingdee_auth_token?app_key=..&app_signature=..
→ data['app-token'](有效期约 2h)
GET /jdy/v2/{module}/{object}
→ 头带 app-token + X-Api-* 签名 + X-GW-Router-Addr三个容易踩的坑(signer.py 已处理,改动前先看注释):
hash_hmac(..., raw_output=false)返回 hex 字符串,base64 的输入是这个 hex,不是 raw digest。待签名串里的头名是小写,且 nonce 在前、timestamp 在后,与
X-Api-SignHeaders声明的顺序相反;末尾还有一个换行。X-GW-Router-Addr(取推送报文里的domain,如https://tf.jdy.com)是全局必填头,官方文档 370 个接口全部标注必填。
快速开始
pip install -r requirements.txt
cp .env.example .env # 填入凭据
pytest -q # 单测应全绿
python test_connection.py # 联调:配置→网络→鉴权→只读→dry-runWindows 直接双击 run_test.bat(结果写入 connection_test_result.txt)。
作为 MCP Server 使用
python -m kingdee_star.server # stdio把 mcp.config.json 里的 kingdee-star 合并进客户端 mcpServers 配置(改 cwd 与 env)。
兼容 mcp 1.x 与 2.x 两个大版本。
工具清单(17)
类别 | 工具 | 端点 |
元/鉴权 |
| — |
探针 |
|
|
只读·科目 |
|
|
只读·凭证 |
|
|
只读·发票 |
|
|
只读·收付 |
|
|
只读·往来 |
|
|
只读·报销 |
|
|
计算 |
| 本地,不调金蝶 |
报文生成 |
| 仅 dry-run,见下 |
销项/进项发票不是两个端点,用
fi/invoice_fp的bill_type/invoice_type过滤。
⚠ 报销写入的现实约束
官方开放平台共 370 个接口,ebx 模块只有「报销单详情」一个 GET,
既没有报销单列表,也没有任何报销单保存接口。
因此需求 v2.1 里的「发票代填报销单草稿」无法通过开放 API 落库:
kdy_fill_reimbursement只产出已算好税额、已过合规校验的待录入报文,dry_run=False会被显式拒绝。要真正自动写入,只能走非开放-API 通道(RPA / 前端接口 / 找金蝶开定制接口)。
安全边界
JDY_READONLY=true→ 纯只读。守卫层为白名单 + 默认拒绝:路径变形(尾斜杠、子路径、大小写)均无法绕过。
付款/凭证/科目写入、报销提交审批 → 永久禁止(
FORBID_ENDPOINTS),人工执行。全量审计:
kingdee_star.audit日志。
税额引擎
票种 | 口径 |
专票 | 取票面税额与不含税金额 |
旅客运输(列示税额) | 取票面税额;缺 |
铁路 | ÷1.09×9% |
航空 | (票价+燃油附加费)÷1.09×9%,校验用 |
公路/水路 | ÷1.03×3% |
其他普票 | 不可抵扣;若票面已列税额会抛提示要求人工确认票种 |
旅客运输抵扣缺出行人 → 合规校验置为不可抵扣。负数(红字)发票直接拒绝。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables querying SAP SuccessFactors OData API metadata and managing Role-Based Permission (RBP) configurations. It provides tools for retrieving entity metadata, listing permission roles, and inspecting user-specific access rights through MCP-compatible clients.2911MIT
- AlicenseBqualityAmaintenanceEnables interaction with the QuickBooks Online Accounting API to manage customers, invoices, expenses, and payments through MCP-compatible clients. It supports comprehensive financial workflows and the generation of reports like Profit and Loss or Balance Sheets.1332Apache 2.0
- AlicenseBqualityBmaintenanceEnables AI assistants to operate Kingdee Cloud Star ERP via natural language, including querying, creating, submitting, auditing, and deleting business documents.8157MIT
- FlicenseNot gradedqualityBmaintenanceExposes enterprise WeChat approval, report, and check-in data reading capabilities through the MCP protocol, enabling WorkBuddy and CodeBuddy to read historical business data.7
Related MCP Connectors
A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud
PayPal MCP Pack — read-only access to PayPal transactions, orders, invoices, and disputes.
Remote MCP for Japan's EDINET DB — 3,800 listed companies' financials & filings (OAuth)
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/adambbhe/kingdee-star-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server