Skip to main content
Glama
adambbhe

kingdee_star

by adambbhe

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 アプリ

JDY_CLIENT_ID / JDY_CLIENT_SECRET

X-Api-ClientID ヘッダー + X-Api-Signature の HMAC キー

テナント帳票

JDY_APP_KEY / JDY_APP_SECRET

app_signature を計算し、app-token と交換

連鎖:

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 で処理済み。変更前はコメントを先に確認すること):

  1. hash_hmac(..., raw_output=false)hex 文字列を返す。base64 の入力はこの hex であり、raw digest ではない。

  2. 署名対象文字列内のヘッダー名は小文字で、nonce が先、timestamp が後。X-Api-SignHeaders で宣言された順序とは逆。末尾に改行が 1 つある。

  3. 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-run

Windows は run_test.bat をダブルクリックするだけ(結果は connection_test_result.txt に書き込まれる)。

MCP Server として使用

python -m kingdee_star.server        # stdio

mcp.config.json 内の kingdee-star をクライアントの mcpServers 設定にマージする(cwdenv を変更)。 mcp 1.x と 2.x の両メジャーバージョンに対応。

ツール一覧(17)

カテゴリ

ツール

端点

メタ/鉴权

kdy_health kdy_auth_fetch_token

プローブ

kdy_current_user

sys/current_user_info

読み取り専用・科目

kdy_list_account kdy_list_account_type

fi/account fi/account_type

読み取り専用・伝票

kdy_list_voucher kdy_get_voucher

fi/voucher fi/voucher_detail

読み取り専用・发票

kdy_list_invoice kdy_get_invoice

fi/invoice_fp fi/invoice_detail

読み取り専用・収支

kdy_list_ar_receive kdy_list_ap_pay

arap/ar_credit arap/ap_credit

読み取り専用・往来

kdy_reconciliation kdy_customer_debt

arap/reconciliation_statement arap/customer_debt

読み取り専用・报销

kdy_get_reimb_detail kdy_list_expense

ebx/reimb_detail(リスト接口は存在しない)

計算

kdy_calc_invoice_tax

ローカル、金蝶を呼び出さない

报文生成

kdy_fill_reimbursement

dry-run のみ、下記参照

销项/进项发票は 2 つの端点ではなく、fi/invoice_fpbill_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 ログ。

税额エンジン

票種

口径

専用发票

票面の税额と税抜金額を取得

旅客輸送(税额記載あり)

票面の税额を取得;face_tax 欠落時は明示的にエラー、静かに降格しない

鉄道

÷1.09×9%

航空

(運賃+燃油サーチャージ)÷1.09×9%、検証は taxable_base() を使用し total ではない

道路/水路

÷1.03×3%

その他普通发票

控除不可;票面に税额が記載されている場合はチケット種別の手動確認を求めるプロンプトを出す

旅客輸送控除で搭乗者情報が欠落 → コンプライアンス検証で控除不可に設定。マイナス(赤字)发票は直接拒否。

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    B
    maintenance
    Enables 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.
    29
    11
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Enables 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.
    133
    2
    Apache 2.0
  • A
    license
    B
    quality
    B
    maintenance
    Enables AI assistants to operate Kingdee Cloud Star ERP via natural language, including querying, creating, submitting, auditing, and deleting business documents.
    81
    57
    MIT

View all related MCP servers

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)

View all MCP Connectors

Latest Blog Posts

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