Content
# Chanjet MCP Server
An independent Python MCP service for exposing OpenAPI documentation and business interfaces of Chanjet T+Cloud, HYC/ZPlus, HSY, YDZ/Finance, and HKJ/Accounting to MCP clients.
## Features
- Query T+Cloud official API documentation module tree.
- Query HYC/ZPlus official API documentation module tree.
- Query HSY official API documentation module tree.
- Query YDZ/Finance official API documentation module tree.
- Query HKJ/Accounting official API documentation module tree.
- Read official interface details by module code.
- Search T+Cloud, HYC/ZPlus, HSY, YDZ/Finance, or HKJ/Accounting document modules by keyword.
- Diagnose MCP client configuration for document query, OAuth, and business interface call capabilities.
- Generate editable MCP call templates from official interface documentation.
- Query T+ document type `bizCode` and business type `BusinessType` mapping table.
- Query T+ document list query fields and display column fields.
- Automatically reference official request examples and parse common natural language fields before calling T+ interfaces.
- Universally call any `/tplus/api/...` business interface, automatically injecting `appKey`, `appSecret`, and `openToken`.
- Universally call any HYC/ZPlus `/accounting/openapi/...` business interface, automatically injecting `appKey`, `appSecret`, and `openToken`.
- Universally call any HSY OpenAPI business interface, automatically injecting `appKey`, `appSecret`, and `openToken`.
- Universally call any YDZ/Finance `/accounting/document/...` business interface, automatically injecting `appKey`, `appSecret`, and `openToken`.
- Universally call any HKJ/Accounting `/accounting/document/...` business interface, automatically injecting `appKey`, `appSecret`, and `openToken`.
- Generate OAuth authorization links, exchange authorization codes for tokens, and refresh tokens.
- Support multi-account OAuth authorization management, save tokens by account alias, and automatically refresh expired tokens when calling business interfaces.
## Installation
```bash
python3 -m venv .venv
.venv/bin/python -m pip install -e .
```
## Matching Skill
The repository has a built-in Codex matching skill: `skills/chanjet-mcp`. It is not the MCP service itself but provides calling strategy instructions for the Agent, covering `call_natural`, `call_api_smart`, T+ `bizCode` / `BusinessType`, `filters`, `display_fields`, and automatic conversion of Chinese labels to field codes.
To install it to the local Codex skill directory:
```bash
cp -R skills/chanjet-mcp ~/.codex/skills/
```
## Configuration
Copy `.env.example` to `.env` and fill in the Chanjet open platform configuration:
```bash
cp .env.example .env
```
Key variables:
```dotenv
CHANJET_APP_KEY=your_app_key
CHANJET_APP_SECRET=your_app_secret
CHANJET_ACTIVE_ACCOUNT=company-a
CHANJET_TOKEN_STORE_PATH=.chanjet_tokens.json
CHANJET_REDIRECT_URI=https://example.com/oauth/callback
```
`CHANJET_APP_KEY` and `CHANJET_APP_SECRET` are application-level credentials. Account-level `openToken` / `refreshToken` is recommended to be automatically written to the local `.chanjet_tokens.json` through OAuth setup, which has been added to `.gitignore`.
Compatible with old usage: You can still configure `CHANJET_OPEN_TOKEN` and `CHANJET_REFRESH_TOKEN` in `.env` as a single-account fallback. If you only use the document query tool, you can temporarily not configure business interface credentials.
## First OAuth Authorization
`redirect_uri` can be explicitly passed when calling the tool or set a default value through `CHANJET_REDIRECT_URI`. Explicit parameters take precedence over environment variables.
1. Call `get_auth_url` to get the authorization link. If `CHANJET_REDIRECT_URI` is configured, you can omit `redirect_uri`:
```json
{
"redirect_uri": "https://example.com/oauth/callback",
"state": "optional-state"
}
```
2. Open the authorization link in the browser and complete the Chanjet account authorization. The callback domain must be verified as a trusted domain on the Chanjet open platform.
3. Get the `code` from the callback address.
4. Call `oauth_complete_setup` to save the account token. If `CHANJET_REDIRECT_URI` is configured, you can also omit `redirect_uri` here, but it must be consistent with the callback address used to generate the authorization link:
```json
{
"code": "temporary_authorization_code",
"redirect_uri": "https://example.com/oauth/callback",
"account_alias": "company-a"
}
```
`account_alias` can only use letters, numbers, dots, underscores, and hyphens, such as `company-a` and `client_001`. The first saved account will be automatically set as the active account. When calling business interfaces later, the account token will be automatically read; if the token is missing, expired, or the interface returns token invalidation, the service will automatically refresh once using the refresh token and retry.
## Multi-Client Authorization
Different MCP clients can use different `redirect_uri` and token files. Each `redirect_uri` domain must be verified as a trusted domain on the Chanjet open platform: download `CHANJET_CHECK.txt`, upload it to the domain root directory, such as `https://example.com/CHANJET_CHECK.txt`, and confirm that it is publicly accessible before adding the trusted domain.
When sharing authorization, multiple clients configure the same `CHANJET_REDIRECT_URI` and the same `CHANJET_TOKEN_STORE_PATH`. For isolated authorization, configure different `CHANJET_REDIRECT_URI`, `CHANJET_TOKEN_STORE_PATH`, and `CHANJET_ACTIVE_ACCOUNT` for each client.
Cursor example:
```json
{
"CHANJET_ACTIVE_ACCOUNT": "cursor-company",
"CHANJET_TOKEN_STORE_PATH": "/Users/sun/Documents/Cursor/SP/.chanjet_tokens.cursor.json",
"CHANJET_REDIRECT_URI": "https://cursor.example.com/oauth/callback"
}
```
Claude example:
```json
{
"CHANJET_ACTIVE_ACCOUNT": "claude-company",
"CHANJET_TOKEN_STORE_PATH": "/Users/sun/Documents/Cursor/SP/.chanjet_tokens.claude.json",
"CHANJET_REDIRECT_URI": "https://claude.example.com/oauth/callback"
}
```
## Running
```bash
.venv/bin/chanjet-mcp
```
You can also directly run the module:
```bash
.venv/bin/python -m chanjet_tcloud_mcp
```
Compatible command aliases:
```bash
.venv/bin/chanjet-tcloud-mcp
.venv/bin/hyc-mcp
.venv/bin/hsy-mcp
.venv/bin/ydz-mcp
.venv/bin/hkj-mcp
```
## MCP Client Configuration Example
```json
{
"mcpServers": {
"chanjet-mcp": {
"command": "/Users/sun/Documents/Cursor/SP/.venv/bin/python",
"args": ["-m", "chanjet_tcloud_mcp"],
"env": {
"CHANJET_APP_KEY": "your_app_key",
"CHANJET_APP_SECRET": "your_app_secret",
"CHANJET_ACTIVE_ACCOUNT": "company-a",
"CHANJET_TOKEN_STORE_PATH": "/Users/sun/Documents/Cursor/SP/.chanjet_tokens.json",
"CHANJET_REDIRECT_URI": "https://example.com/oauth/callback"
}
}
}
}
```
If the client supports `cwd`, you can also change `command` to `/Users/sun/Documents/Cursor/SP/.venv/bin/chanjet-mcp` and set `cwd` to the project directory; if it prompts `mcpServers.chanjet-mcp: Invalid input`, it usually indicates that the client does not accept the `cwd` field, and use the above compatible writing method.
## Tool List
Recommended client process:
1. Call `diagnose_config` to confirm configuration and account status.
2. When the user provides a natural language business request, prioritize calling `call_natural`.
3. If `call_natural` returns `decision: "suggest"`, ask the user to supplement the product, business object, action, or field based on the candidates and missing information. Do not guess the call.
4. For more fine-grained control, call `search_api_templates` to find callable templates using Chinese business words, and then call `call_api_smart` to automatically parse Chinese fields and route to the corresponding product interface.
If the client needs more fine-grained control, it can continue to use the old process: first call `search_*_docs` to find the module, then call `get_api_call_template` to generate the template, and finally call `call_api_template`, `call_tplus_api`, `call_hyc_api`, `call_hsy_api`, `call_ydz_api`, or `call_hkj_api` according to the template.
`diagnose_config`
Returns a secure diagnosis result without secret key and token:
```json
{
"ok": true,
"data": {
"settings": {
"has_app_key": true,
"has_app_secret": true,
"has_redirect_uri": true,
"token_store_path": "/path/to/.chanjet_tokens.json"
},
"accounts": {
"active_account": "company-a",
"stored_account_count": 1,
"active_account_exists": true,
"has_active_open_token": true,
"has_active_refresh_token": true,
"active_token_expired": false
},
"capabilities": {
"documentation_lookup": true,
"oauth_url_generation": true,
"token_exchange": true,
"business_api_calls": true
},
"issues": []
}
}
```
If configuration is missing, `issues` will return readable problems and repair suggestions such as `missing_app_key`, `missing_app_secret`, `missing_redirect_uri`, or `missing_token`.
`get_api_call_template`
Extracts the interface address and call parameter template from the official document details. `product` supports `tplus`/`tcloud`, `hyc`/`zplus`, `hsy`/`haoshengyi`, `ydz`/`finance`, or `hkj`/`accounting`.
Parameters:
```json
{
"product": "tplus",
"parent_code": "t+jcda",
"module_code": "t+ck",
"api_name": "Query"
}
```
Returns:
```json
{
"ok": true,
"data": {
"product": {
"code": "tcloud",
"tool": "call_tplus_api"
},
"module": {
"parent_code": "t+jcda",
"module_code": "t+ck"
},
"templates": [
{
"api_name": "Warehouse Query",
"path": "/tplus/api/v2/warehouse/Query",
"method": "POST",
"tool": "call_tplus_api",
"arguments": {
"path": "/tplus/api/v2/warehouse/Query",
"method": "POST",
"body": {},
"query": {},
"headers": {},
"account_alias": null
}
}
]
}
}
```
`search_api_templates`
Searches official documentation by business keywords and directly returns editable call templates. The client does not need to first determine which `search_*_docs` to call.
Parameters:
```json
{
"query": "Warehouse",
"product": "tplus",
"api_name": "Query",
"limit": 5
}
```
`product` can be omitted; if omitted, it will search T+Cloud, Hao Ye Cai, Hao Sheng Yi, Yi Dai Zhang, and Hao Ji Ku in sequence. Each returned template contains `product`, `module`, `tool`, and `arguments`.
`get_tplus_reference_codes`
Gets the T+ document type business code对照表 and business type对照表. If the document type `bizCode` or business type `BusinessType` is unknown, call this tool first.
Data source:
- Document type: `tcloud/t+xdescription/t+vouchertype`
- Business type: `tcloud/t+xdescription/t+busitype`
Parameters:
```json
{
"query": "Sales"
}
```
`query` can be omitted; if omitted, it returns the complete对照表. Can filter by code or name, such as `SA04`, `Sales Invoice`, `02`, or `Purchase Return`.
Usage:
1. If the document type `bizCode` is unknown, query by document name.
```json
{
"query": "Sales Invoice"
}
```
Find the corresponding `code` in the returned `voucher_types`, such as `SA04`. When calling `query_tplus_voucher_list` later, use it as `biz_code`.
2. If the business type `BusinessType` is unknown, query by business type name.
```json
{
"query": "Purchase Return"
}
```
Find the corresponding `code` in the returned `business_types`, such as `02`. When calling the T+ business interface later, put it into the business parameter field required by the official interface, such as `BusinessType`.
3. If unsure which table the keyword belongs to, directly pass the business word.
```json
{
"query": "Return"
}
```
The tool will simultaneously filter `voucher_types` and `business_types`; the caller selects the document type code or business type code based on the returned items.
Returns:
```json
{
"ok": true,
"data": {
"voucher_types": [
{
"code": "SA04",
"name": "Sales Invoice",
"raw": {}
}
],
"business_types": [
{
"code": "02",
"name": "Purchase Return",
"raw": {}
}
],
"source_docs": {
"voucher_types": {
"product": "tcloud",
"parent_code": "t+xdescription",
"module_code": "t+vouchertype"
},
"business_types": {
"product": "tcloud",
"parent_code": "t+xdescription",
"module_code": "t+busitype"
}
}
}
}
```
`get_tplus_voucher_list_fields`
Gets the T+ document list query fields and display column fields. If the `body.param` query fields of the list interface are unknown or the `display_fields` to be passed are unknown, call this tool first.
Data source: Official `tcloud/t+dj/djlbcxfz` document list query auxiliary page. This page corresponds to two auxiliary interfaces:
- Query items: `/tplus/api/v2/VoucherAPIService/GetSearchItemByBizCode`
- Column items: `/tplus/api/v2/VoucherAPIService/GetColumnSetByBizCode`
Parameters:
```json
{
"biz_code": "SA04",
"query": "Customer",
"account_alias": "company-a"
}
```
`query` can be omitted; if omitted, it returns the complete query items and column items of the current document type. Can filter by field code or Chinese name, such as `Code`, `Document Number`, `CustomerName`, or `Customer`.
Returns:
```json
{
"ok": true,
"data": {
"biz_code": "SA04",
"query_fields": [
{
"field": "Code",
"label": "Document Number",
"raw": {}
}
],
"display_fields": [
{
"field": "CustomerName",
"label": "Customer",
"raw": {}
}
],
"source_doc": {
"product": "tcloud",
"parent_code": "t+dj",
"module_code": "djlbcxfz"
}
}
}
```
Usage:
1. Query fields are used to construct the `body.param` of the list interface. For example, if `query_fields` returns `Code` / `Document Number`, the corresponding query condition can be passed in the request body according to the official interface requirements.
2. Display column fields are used for `query_tplus_voucher_list.display_fields`. Can pass Chinese names; the tool will match them into real fields and inject `body.param.selectFields`.
3. If `biz_code` is unknown, call `get_tplus_reference_codes` to query the document type code first.
`call_natural`
The highest-level entry for LLM clients. It receives natural language requests, deterministically parses product, action, business object, field, query condition, and display field, and then routes to existing MCP tools. It is not a built-in large model; if the confidence level is low or there are multiple candidates, it will not guess the call interface but return candidates and missing information.
Applicable examples:
```json
{
"user_input": "Query all production processing orders, display document number and quantity",
"filters": {
"Document Number": "MO-001"
},
"page_size": 50,
"page_index": 1,
"account_alias": "company-a"
}
```
```json
{
"user_input": "Hao Ye Cai add warehouse, code WH001, name Shanghai Warehouse",
"dry_run": true
}
```
Return structure:
```json
{
"ok": true,
"data": {
"parsed_intent": {},
"confidence": 0.85,
"decision": "call",
"selected_tool": "query_tplus_voucher_list_smart",
"candidates": [],
"request": {},
"data": {}
}
}
```
Processing rules:
1. Only call business interfaces with high confidence.
2. When `dry_run=true`, only return the tool and request draft to be called.
3. If product is missing, multiple products are optional, multiple templates are close, or fields cannot be matched, return `decision: "suggest"` and do not call business interfaces.
4. Only T+ document list requests route to `query_tplus_voucher_list_smart` and use `voucher_name` / `bizCode` to parse.
5. T+ non-document interfaces (such as basic archives like warehouses, customers, and inventory) and other products' clear single template requests route to `call_api_smart`; do not process according to document `bizCode`.
`call_api_smart`
Recommended intelligent call tool, supporting T+Cloud, HYC/ZPlus, HSY, YDZ/Finance, and HKJ/Accounting. It reads official interface templates, parses Chinese fields passed by users into real interface fields, and automatically routes to corresponding product interfaces. If fields cannot be parsed, it returns a unified error structure and does not silently call error requests.
Parameter example:
```json
{
"product": "hyc",
"parent_code": "zjjcda",
"module_code": "ck",
"api_name": "Add",
"fields": {
"Warehouse Code": "WH001",
"Warehouse Name": "Shanghai Warehouse"
},
"body_overrides": {
"statusEnum": "A"
},
"account_alias": "company-a"
}
```
Processing rules:
1. Keys of `fields` can be Chinese field names in official documentation, such as `Warehouse Code`.
2. The tool first parses Chinese fields from official interface field descriptions; if documentation does not have field descriptions, it uses real field names in official request examples for precise matching as a fallback.
3. Parsed fields are written into the request body. If the official example contains a `param` object, it is written into `body.param` by default; if the official example is an array of objects, it is written into the first array element; otherwise, it is written into the top-level request body.
4. `body_overrides` merges last and explicitly overrides automatically parsed fields.
5. T+ interfaces also support `voucher_name`, `business_type_name`, `filters`, and `display_fields` for automatically parsing document type, business type, query items, and display columns.
Returns:
```json
{
"ok": true,
"data": {
"template": {},
"resolved": {
"product_code": "zplus",
"matched_fields": [
{
"requested": "Warehouse Code",
"field": "code",
"path": ["code"]
}
],
"unmatched_fields": []
},
"request": {
"path": "/accounting/openapi/cc/warehouse/create/123",
"method": "POST",
"body": {
"code": "WH001"
}
},
"data": {}
}
}
```
`call_tplus_api_smart`
Automatically refers to the official interface request example before calling the T+ interface, and then merges natural language fields and explicit override parameters. Suitable for scenarios where you know which document module/interface to call but want the server to automatically query codes, fields, and assemble requests.
Must provide official documentation positioning parameters:
- `parent_code`
- `module_code`
- `api_name`
The tool first calls `get_api_call_template(product="tplus", ...)`, using the official request example as the base request; then calls `get_tplus_reference_codes` and `get_tplus_voucher_list_fields` as needed.
Parameter example:
```json
{
"parent_code": "t+xs",
"module_code": "saleDelivery",
"api_name": "List Query",
"voucher_name": "Sales Invoice",
"business_type_name": "Purchase Return",
"filters": {
"Customer": "Customer A"
},
"display_fields": ["Document Number", "Amount"],
"body_overrides": {
"param": {
"pageSize": 50
}
},
"account_alias": "company-a"
}
```
Processing rules:
1. `voucher_name` parses into `biz_code`, such as `Sales Invoice` -> `SA04`.
2. `business_type_name` parses into `BusinessType`, such as `Purchase Return` -> `02`.
3. Chinese keys of `filters` match real fields according to query fields, and then write into `body.param`.
4. Chinese column names of `display_fields` match real fields and write into `body.param.selectFields`.
5. `body_overrides` merges last and can override official examples or automatically parsed fields.
6. If query items or column items cannot be matched, the tool returns a unified error structure and does not silently call error requests.
Returns:
```json
{
"ok": true,
"data": {
"template": {},
"resolved": {
"biz_code": "SA04",
"business_type": "02",
"matched_filter_fields": [],
"matched_display_fields": []
},
"request": {
"path": "/tplus/api/v2/saleDelivery/Query",
"method": "POST",
"body": {}
},
"data": {}
}
}
```
`call_api_template`
Automatically selects the corresponding product call tool based on the official documentation template. The client only needs to provide product, module code, optional interface name, and business parameters, without needing to choose `call_tplus_api` / `call_hyc_api` and other underlying tools.
If `body` or `query` uses Chinese field names in official field descriptions, the service automatically converts them into real field codes according to the template; Chinese field names in `selectFields`, `fields`, `columns`, or `select` are also converted synchronously.
Parameters:
```json
{
"product": "tplus",
"parent_code": "t+jcda",
"module_code": "t+ck",
"api_name": "Query",
"account_alias": "company-a",
"body": {
"param": {
"Code": "01"
}
}
}
```
Returns:
```json
{
"ok": true,
"data": {
"template": {
"api_name": "Warehouse Query",
"path": "/tplus/api/v2/warehouse/Query",
"tool": "call_tplus_api"
},
"request": {
"path": "/tplus/api/v2/warehouse/Query",
"method": "POST",
"body": {
"param": {
"Code": "01"
}
},
"query": {},
"headers": {},
"account_alias": "company-a"
},
"data": {}
}
}
```
`diagnose_config`, `get_api_call_template`, `search_api_templates`, `get_tplus_reference_codes`, `get_tplus_voucher_list_fields`, `call_api_smart`, `call_tplus_api_smart` and `call_api_template` use a unified error structure:
```json
{
"ok": false,
"error": {
"code": "invalid_argument",
"message": "Unsupported product: unknown",
"hint": "Use one of: tplus, tcloud, hyc, zplus, hsy, haoshengyi, ydz, finance, hkj, accounting.",
"trace_id": null
}
}
```
`list_tcloud_modules`
Returns the official T+Cloud documentation module tree.
`list_hyc_modules`
Returns the official HYC/ZPlus documentation module tree.
`list_hsy_modules`
Returns the official HSY documentation module tree.
`list_ydz_modules`
Returns the official YDZ/Finance documentation module tree.
`list_hkj_modules`
Returns the official HKJ/Accounting documentation module tree.
`get_tcloud_doc`
Parameters:
```json
{
"parent_code": "t+jcda",
"module_code": "t+ck"
}
```
Returns the official interface details of the warehouse module.
`get_hyc_doc`
Parameters:
```json
{
"parent_code": "zjjcda",
"module_code": "ck"
}
```
Returns the official interface details of the warehouse module for HYC.
`get_hsy_doc`
Parameters:
```json
{
"parent_code": "hsyxxdy",
"module_code": "hsy_product"
}
```
Returns the official interface details of the module for HSY. The official documentation tree for `hsy` products may be empty; the tool will automatically return newly added modules as the official documentation is updated.
`get_ydz_doc`
Parameters:
```json
{
"parent_code": "ydzjcda",
"module_code": "ck"
}
```
Returns the official interface details of the warehouse module for YDZ.
`get_hkj_doc`
Parameters:
```json
{
"parent_code": "jcda",
"module_code": "ck"
}
```
Returns the official interface details of the warehouse module for HKJ.
`search_tcloud_docs`
Parameters:
```json
{
"query": "warehouse",
"limit": 20
}
```
Returns the matching module codes, names, and documentation paths.
`search_hyc_docs`
Parameters:
```json
{
"query": "warehouse",
"limit": 20
}
```
Returns the matching module codes, names, and documentation paths for HYC.
`search_hsy_docs`
Parameters:
```json
{
"query": "warehouse",
"limit": 20
}
```
Returns the matching module codes, names, and documentation paths for HSY.
`search_ydz_docs`
Parameters:
```json
{
"query": "warehouse",
"limit": 20
}
```
Returns the matching module codes, names, and documentation paths for YDZ.
`search_hkj_docs`
Parameters:
```json
{
"query": "warehouse",
"limit": 20
}
```
Returns the matching module codes, names, and documentation paths for HKJ.
`call_tplus_api`
Parameters example:
```json
{
"path": "/tplus/api/v2/warehouse/Query",
"method": "POST",
"account_alias": "company-a",
"body": {
"param": {
"Code": "01"
}
}
}
```
If `body` or `query` contains Chinese field names, the service will attempt to match the corresponding official interface template using `path` and convert the Chinese field names to real field codes before sending. Requests that already use real field codes will not be queried for templates.
The service will automatically inject:
```json
{
"appKey": "from CHANJET_APP_KEY",
"appSecret": "from CHANJET_APP_SECRET",
"openToken": "from active or selected account",
"Content-Type": "application/json"
}
```
If `account_alias` is not provided, the service will use `CHANJET_ACTIVE_ACCOUNT` or the active account from the token store.
`query_tplus_voucher_list_smart`
A natural language T+ voucher list query tool. Recommended for requests like "query production processing order list" or "query all sales orders". The service will automatically identify intentions like `list`, `query`, `all`, and parse voucher `bizCode`, search for official documentation of list query interfaces, generate pagination and query bodies, and then call T+ business interfaces.
Parameters example:
```json
{
"voucher_name": "production processing order",
"intent": "query all",
"module_code": "ManufactureOrderOpenApi",
"filters": {
"voucher number": "MO-001"
},
"display_fields": ["voucher number", "quantity"],
"page_size": 50,
"page_index": 1,
"account_alias": "company-a"
}
```
Processing rules:
1. `voucher_name` is parsed to `bizCode` using official voucher type documentation; if not found, a small number of stable fallback mappings are used, e.g., `production processing order -> MP05`.
2. The tool searches official documentation and prioritizes interfaces with `FindVoucherList` or names containing "list query".
3. `filters` with Chinese field names are parsed and written to `body.param.paramDic`.
4. `display_fields` are parsed and written to `body.param.selectFields`.
5. `page_size` and `page_index` are written to `body.param.pageSize` and `body.param.pageIndex`.
6. If `module_code` is incorrectly passed, e.g., `ManufactureOrderOpenApi`, the tool will handle it as an interface class name and continue searching official documentation based on `voucher_name`.
The return value includes the actual business response, selected official template, final request body, and parsing process:
```json
{
"ok": true,
"data": {
"data": {},
"template": {},
"request": {
"path": "/tplus/api/v2/ManufactureOrderOpenApi/FindVoucherList",
"method": "POST",
"body": {
"param": {
"pageSize": 50,
"pageIndex": 1,
"paramDic": {
"Code": "MO-001"
},
"selectFields": ["Code", "Quantity"]
}
}
},
"resolved": {
"biz_code": "MP05",
"biz_code_source": "fallback",
"matched_filter_fields": [],
"matched_display_fields": []
}
}
}
```
`query_tplus_voucher_list`
A dedicated tool for querying T+ voucher lists. The service will first call the official voucher list query auxiliary interface to obtain query item fields and display column fields for the current voucher code, and then automatically match `display_fields` to real fields and inject them into the list query request.
Auxiliary interfaces are from `tcloud/t+dj/djlbcxfz`:
- Query items: `/tplus/api/v2/VoucherAPIService/GetSearchItemByBizCode`
- Column items: `/tplus/api/v2/VoucherAPIService/GetColumnSetByBizCode`
If unsure about `biz_code`, call `get_tplus_reference_codes` to query the mapping table.
If unsure about query fields supported by `body.param` or display columns supported by `display_fields`, call `get_tplus_voucher_list_fields`.
Parameters example:
```json
{
"biz_code": "SA03",
"path": "/tplus/api/v2/saleDelivery/Query",
"method": "POST",
"account_alias": "company-a",
"display_fields": ["voucher number", "customer", "amount"],
"body": {
"param": {
"pageIndex": 1,
"pageSize": 20
}
}
}
```
The return value includes the actual list query response, all available query item fields, all available display fields, matched fields, and unmatched fields:
```json
{
"data": {},
"query_fields": [],
"display_fields": [],
"matched_display_fields": [],
"unmatched_display_fields": []
}
```
If `selectFields`, `fields`, `columns`, or `select` already exist in the request body, the service will not override the caller's existing field selection.
`call_hyc_api`
Parameters example:
```json
{
"path": "/accounting/openapi/cc/warehouse/list/123456",
"method": "POST",
"account_alias": "company-a",
"body": {
"pageSize": 20,
"pageNo": 1
}
}
```
The service will automatically inject the same request headers as T+Cloud for the Changjet open platform. If `body` or `query` contains Chinese field names, it will also match the official template using `path` and automatically convert to real field codes.
`call_hsy_api`
Parameters example:
```json
{
"path": "/accounting/openapi/cc/warehouse/list/123456",
"method": "POST",
"account_alias": "company-a",
"body": {
"pageSize": 20,
"pageNo": 1
}
}
```
The service will automatically inject the same request headers as T+Cloud for the Changjet open platform. If `body` or `query` contains Chinese field names, it will also match the official template using `path` and automatically convert to real field codes. The current official documentation for HSY products may not have a module tree; the specific business path will be based on the official documentation.
`call_ydz_api`
Parameters example:
```json
{
"path": "/accounting/document/integration/warehouse/batchUpsertt/123456",
"method": "POST",
"account_alias": "company-a",
"body": [
{
"id": "WH001",
"code": "WH001",
"name": "warehouse",
"statusEnum": "A"
}
]
}
```
The service will automatically inject the same request headers as T+Cloud for the Changjet open platform. If `body` or `query` contains Chinese field names, it will also match the official template using `path` and automatically convert to real field codes.
`call_hkj_api`
Parameters example:
```json
{
"path": "/accounting/document/integration/warehouse/batchUpsertt/123456",
"method": "POST",
"account_alias": "company-a",
"body": [
{
"id": "HKJ001",
"code": "HKJ001",
"name": "warehouse",
"statusEnum": "A"
}
]
}
```
The service will automatically inject the same request headers as T+Cloud for the Changjet open platform. If `body` or `query` contains Chinese field names, it will also match the official template using `path` and automatically convert to real field codes.
`get_auth_url`
Parameters:
```json
{
"redirect_uri": "https://example.com/oauth/callback",
"state": "optional-state"
}
```
If `CHANJET_REDIRECT_URI` is configured, `redirect_uri` can be omitted.
`exchange_token`
Parameters:
```json
{
"code": "temporary_authorization_code",
"redirect_uri": "https://example.com/oauth/callback"
}
```
If `CHANJET_REDIRECT_URI` is configured, `redirect_uri` can be omitted.
`oauth_complete_setup`
Parameters:
```json
{
"code": "temporary_authorization_code",
"redirect_uri": "https://example.com/oauth/callback",
"account_alias": "company-a"
}
```
If `CHANJET_REDIRECT_URI` is configured, `redirect_uri` can be omitted.
Returns a security account summary, not the real token.
`list_auth_accounts`
Returns security summaries of all authorized accounts.
`get_active_account`
Returns the security summary of the current active account.
`set_active_account`
Parameters:
```json
{
"account_alias": "company-a"
}
```
`delete_auth_account`
Parameters:
```json
{
"account_alias": "company-a"
}
```
`refresh_token`
Parameters:
```json
{
"refresh_token": "optional_refresh_token"
}
```
If `refresh_token` is not provided, the service will read `CHANJET_REFRESH_TOKEN`.
## Development and Verification
Run unit tests without installing packages:
```bash
PYTHONPATH=src python3 -m unittest discover -s tests -v
```
Run tests after installation:
```bash
.venv/bin/python -m unittest discover -s tests -v
```
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available