accurlex-mcp-server
v0.5.0
Published
Remote MCP (Streamable HTTP, protocol 2026-07-28) for accurLex Chinese legal AI - config generator, tool schemas and integration examples
Downloads
99
Maintainers
Readme
accurLex MCP Server
accurLex 知法(accurlex.com)的 远程 MCP 服务:一次配置,让 Cursor、Claude Code、Codex、VS Code 等 AI 客户端直接调用中国法律能力——法律问答、法条检索、合同审查、法律文书生成。
本服务是 Streamable HTTP(MCP 协议 2026-07-28)远程端点,不需要本地安装服务端;API Key 在 开放平台控制台 创建。
快速开始
1. 创建 API Key
- 打开 accurLex 开放平台控制台 并登录
- 创建一个 API Key(
ak_live_开头),勾选需要的权限(scope) - 只把 Key 放在服务端环境变量或客户端密钥管理中,不要提交到公开仓库
2. 配置客户端
以 Cursor / Claude Code / VS Code 的 .mcp.json 为例:
{
"mcpServers": {
"accurlex": {
"type": "http",
"url": "https://accurlex.com/mcp/stream",
"headers": {
"Authorization": "Bearer ak_live_YOUR_API_KEY"
}
}
}
}也可以直接用本包生成配置:
# JSON(Cursor / Claude Code / VS Code)
npx accurlex-mcp-server --key ak_live_YOUR_API_KEY
# TOML(Codex CLI)
npx accurlex-mcp-server --key ak_live_YOUR_API_KEY --format toml更多客户端配置见 docs/client-configs.md。
3. 开始使用
配置完成后刷新工具列表,向 AI 提问,例如:
- “根据《民法典》分析一下违约金过高能否请求调整?”
- “审查这份合同的付款条款和违约责任”
- “帮我起草一份民事起诉状”
端点与协议
| 项目 | 值 |
|---|---|
| 端点 | POST https://accurlex.com/mcp/stream |
| 协议 | MCP 2026-07-28,Streamable HTTP(无状态,不需要会话 ID) |
| 认证 | 请求头 Authorization: Bearer ak_live_... |
| 请求体 | 单条 JSON-RPC 2.0 消息,最大 2MB |
| 流式 | Accept 含 text/event-stream 时返回 SSE,否则单条 JSON |
请求头
| 头 | 说明 |
|---|---|
| MCP-Protocol-Version | 2026-07-28 |
| Mcp-Method | 与 body 的 method 一致,如 tools/call |
| Mcp-Name | tools/call 必填,与 body.params.name 一致 |
| Accept | application/json, text/event-stream |
工具
| 工具 | 必填参数 | 计费 |
|---|---|---|
| accurlex_legal_qa | question | deep 免费(每日 100 次,≤10000 字符);expert 付费 5 点(≤30000 字符) |
| accurlex_law_search | prompt | deep 免费(每日 100 次,≤10000 字符);expert 促销期免费(≤30000 字符,限时免费至 2026-10-15),到期自动恢复付费 5 点 |
| accurlex_contract_review | contract_text + standpoint | 付费 10 点(合计 ≤30000 字符) |
| accurlex_document_draft | document_type + facts | 付费 10 点(合计 ≤30000 字符) |
| accurlex_account_usage | 无 | 免费,不消耗点数 |
完整 JSON Schema 见 schemas/tools.json,调用示例见 examples/。
调用示例
server/discover(协议协商):
curl -sS -X POST https://accurlex.com/mcp/stream \
-H "Authorization: Bearer ak_live_YOUR_API_KEY" \
-H "MCP-Protocol-Version: 2026-07-28" \
-H "Mcp-Method: server/discover" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}'tools/call(deep 免费法律问答):
curl -sS -X POST https://accurlex.com/mcp/stream \
-H "Authorization: Bearer ak_live_YOUR_API_KEY" \
-H "MCP-Protocol-Version: 2026-07-28" \
-H "Mcp-Method: tools/call" \
-H "Mcp-Name: accurlex_legal_qa" \
-H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"accurlex_legal_qa","arguments":{"question":"合同约定的违约金过高时,可以请求法院调整吗?","mode":"deep"},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}'JavaScript 与 Python 示例见 examples/。
计费与额度
- 与 accurLex REST API 共用同一套 API Key、scope、每日免费额度与点数计费
- 免费调用也写入用量台账(0 点);付费调用失败自动退款
- 服务端无状态、不提供请求级去重;客户端应避免自动重试付费工具调用
- SSE 连接断开即取消:计费后断连自动退款,计费前断连不扣费
支持范围
- 支持
2026-07-28及之后的 MCP 协议版本(Streamable HTTP / 无状态) - 旧版 initialize 握手(2024/2025)与旧版 stdio 包不兼容,已退役
许可
MIT License,见 LICENSE。
