Qianji API Service
钱迹 API 代理服务,提供 REST API 和 Streamable HTTP MCP。MCP 端点为
/mcp,当前 MCP 模式为 advanced。
可通过 QIANJI_MCP_MODE 设置为 read、write、advanced 或 full。
单次请求可用 ?mode=write 等 URL query 覆盖工具范围。
1 account(s) logged in. Current: fe***@g***.com
| Account ID | Name | Device | |
|---|---|---|---|
| fe***@g***.com | 迎*** | fe***@g***.com | MCP_20261022_000241 |
Quick Links
- 操作台
- API Docs (Swagger UI)
- API Docs (ReDoc)
/mcp- HTTP MCP endpoint for MCP clients/healthz- health check
MCP Modes
| Mode | Tools |
|---|---|
read | Login and read-only query tools |
write | Read tools plus core bookkeeping tools: create_expense, create_income, create_transfer, their update variants, sync_bills, set_bill_cache_ttl and set_tags_enabled |
advanced (default) | Write tools plus refund, reimbursement, loan/debt asset, principal, collection and repayment tools |
full | All MCP tools, including low-level create_bill, update_bill, delete_bill, raw call_api and 112 upstream endpoint tools |
Add MCP to Agent
Agent 使用 Streamable HTTP MCP 地址:https://qianji.x4ai.cn/mcp。
通过 Traefik 或域名访问本页时会自动使用当前域名;本地直接访问时使用当前本地调试地址。
MCP 使用钱迹账号的 MD5 密码等价凭据认证,Header 支持
Authorization: Bearer qj1.md5.account~pwd_hash 或
Authorization: Bearer qj1.md5-b64.base64_utf8(account~pwd_hash)。
Agent configJSON
{
"mcpServers": {
"qianji": {
"type": "streamable-http",
"url": "https://qianji.x4ai.cn/mcp",
"headers": {
"Authorization": "Bearer qj1.md5-b64.BASE64_ACCOUNT_TILDE_PWD_HASH"
}
}
}
}
Key Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /auth/login | Validate the Authorization credentials (optionally re-checks the plaintext password against the Bearer token) |
| GET | /auth/status | Check login status |
| GET | /bills | List bills newest-first (cache-backed, paginated) |
| GET | /bills/range | List bills in a time range (cache-backed) |
| POST | /bills/sync | Sync bills from Qianji into the local cache |
| POST | /bills | Create a new bill |
| DELETE | /bills/{id} | Delete a bill |
| GET | /assets | List all assets |
| GET | /categories | List categories |
| GET | /books | List books |
| GET | /tags | List tags |
| GET | /budgets | List budgets |
| GET | /currencies | List currencies |
| POST | /api/{ctrl}/{act} | Generic API passthrough (all 112 endpoints) |
Usage Example
REST API examplescurl
AUTH='Authorization: Bearer qj1.md5-b64.BASE64_ACCOUNT_TILDE_PWD_HASH'
# 1. Login status
curl http://localhost:50003/auth/status -H "$AUTH"
# 2. Query bills
curl http://localhost:50003/bills -H "$AUTH"
# 3. Create a bill (expense)
curl -X POST http://localhost:50003/bills \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"bill_type":"expense","amount":25.5,"occurred_at":"2026-04-12T19:30:00+08:00","asset_id":123,"category_id":60559217,"remark":"lunch"}'
# 4. Generic API call
curl -X POST http://localhost:50003/api/asset/typelist \
-H "$AUTH" \
-H "Content-Type: application/json" -d '{}'
Qianji SDK v0.0.30 | Reverse-engineered API proxy | Local network only