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
鉴权(2 層の凭据、混同しないこと)
層 | 取值 | 用途 |
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陥りやすい落とし穴が 3 つ(signer.py で処理済み。変更前はコメントを先に確認すること):
hash_hmac(..., raw_output=false)は hex 文字列を返す。base64 の入力はこの hex であり、raw digest ではない。署名対象文字列内のヘッダー名は小文字で、nonce が先、timestamp が後。
X-Api-SignHeadersで宣言された順序とは逆。末尾に改行が 1 つある。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 # stdiomcp.config.json 内の kingdee-star をクライアントの mcpServers 設定にマージする(cwd と env を変更)。
mcp 1.x と 2.x の両メジャーバージョンに対応。
ツール一覧(17)
カテゴリ | ツール | 端点 |
メタ/鉴权 |
| — |
プローブ |
|
|
読み取り専用・科目 |
|
|
読み取り専用・伝票 |
|
|
読み取り専用・发票 |
|
|
読み取り専用・収支 |
|
|
読み取り専用・往来 |
|
|
読み取り専用・报销 |
|
|
計算 |
| ローカル、金蝶を呼び出さない |
报文生成 |
| dry-run のみ、下記参照 |
销项/进项发票は 2 つの端点ではなく、
fi/invoice_fpのbill_type/invoice_typeでフィルタリングする。
⚠ 报销書き込みの現実的制約
公式オープンプラットフォームには合計 370 個の接口があるが、ebx モジュールには「报销单詳細」という GET が 1 つしかない。
报销单リストも、报销单保存接口も存在しない。
そのため、要件 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