Skip to main content
Glama
adambbhe

kingdee_star

by adambbhe

kingdee_star — Kingdee Cloud Star MCP Server

GC032 Financial Agent · Kingdee side (the DingTalk side is already connected via DingTalk MCP; this repo only handles Kingdee). Aligned with requirement v2.1: Phase 1 read-only + invoice tax calculation + reimbursement form pending-entry message generation.

v0.2.0 Important changes: Authentication, endpoints, and the tax engine have all been rewritten per the official docs and sandbox testing. The endpoint constants from v0.1.0 (like /finance/expense) do not exist on the real gateway; do not reuse them.

Table of Contents

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

Authentication (two layers of credentials, don't mix them up)

Layer

Value

Purpose

ISV app

JDY_CLIENT_ID / JDY_CLIENT_SECRET

X-Api-ClientID header + HMAC key for X-Api-Signature

Tenant account set

JDY_APP_KEY / JDY_APP_SECRET

Compute app_signature, exchange for app-token

Flow:

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

Three easy pitfalls (already handled in signer.py; read the comments before changing anything):

  1. hash_hmac(..., raw_output=false) returns a hex string; the base64 input is this hex, not the raw digest.

  2. Header names in the string to sign are lowercase, and nonce comes first, timestamp last — the reverse of the order declared in X-Api-SignHeaders; there is also a trailing newline.

  3. X-GW-Router-Addr (taken from the domain in the push message, e.g. https://tf.jdy.com) is a globally required header; all 370 endpoints in the official docs mark it as required.

Quick Start

pip install -r requirements.txt
cp .env.example .env        # 填入凭据
pytest -q                   # 单测应全绿
python test_connection.py   # 联调:配置→网络→鉴权→只读→dry-run

On Windows, just double-click run_test.bat (results are written to connection_test_result.txt).

Using as an MCP Server

python -m kingdee_star.server        # stdio

Merge kingdee-star from mcp.config.json into the client's mcpServers config (adjust cwd and env). Compatible with both mcp 1.x and 2.x major versions.

Tool List (17)

Category

Tools

Endpoint

Meta/Auth

kdy_health kdy_auth_fetch_token

Probe

kdy_current_user

sys/current_user_info

Read-only · Accounts

kdy_list_account kdy_list_account_type

fi/account fi/account_type

Read-only · Vouchers

kdy_list_voucher kdy_get_voucher

fi/voucher fi/voucher_detail

Read-only · Invoices

kdy_list_invoice kdy_get_invoice

fi/invoice_fp fi/invoice_detail

Read-only · Receipts/Payments

kdy_list_ar_receive kdy_list_ap_pay

arap/ar_credit arap/ap_credit

Read-only · Transactions

kdy_reconciliation kdy_customer_debt

arap/reconciliation_statement arap/customer_debt

Read-only · Reimbursement

kdy_get_reimb_detail kdy_list_expense

ebx/reimb_detail (list endpoint does not exist)

Calculation

kdy_calc_invoice_tax

Local, does not call Kingdee

Message generation

kdy_fill_reimbursement

dry-run only, see below

Sales/output and purchase/input invoices are not two separate endpoints; filter via bill_type / invoice_type on fi/invoice_fp.

⚠ Real-world constraints on reimbursement writes

The official open platform has 370 endpoints in total; the ebx module has only one GET — "reimbursement detail", with neither a reimbursement list nor any reimbursement save endpoint.

Therefore, the "auto-fill reimbursement draft from invoice" in requirement v2.1 cannot be persisted via the open API:

  • kdy_fill_reimbursement only produces pending-entry messages with tax already computed and compliance checks passed, dry_run=False is explicitly rejected.

  • To actually write automatically, you can only go through non-open-API channels (RPA / frontend APIs / asking Kingdee for a custom endpoint).

Security Boundary

  • JDY_READONLY=true → pure read-only.

  • The guard layer is whitelist + deny by default: path variations (trailing slashes, sub-paths, case changes) cannot bypass it.

  • Payment/voucher/account writes and reimbursement submission for approval → permanently forbidden (FORBID_ENDPOINTS), executed manually.

  • Full audit: kingdee_star.audit log.

Tax Engine

Ticket type

Rule

Special VAT invoice

Use the face tax amount and the amount excluding tax

Passenger transport (tax shown)

Use the face tax amount; if face_tax is missing, raise an explicit error — no silent downgrade

Railway

÷1.09×9%

Air

(fare + fuel surcharge)÷1.09×9%; validate with taxable_base() rather than total

Road/waterway

÷1.03×3%

Other ordinary invoices

Not deductible; if tax is already shown on the face, raise a prompt asking for manual confirmation of the ticket type

Passenger transport deduction missing the traveler → compliance check marks it as non-deductible. Negative (red-letter) invoices are rejected outright.

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