accurlex-mcp-server 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -269
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,51 +1,24 @@
|
|
|
1
1
|
# accurLex MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
### 方式一:npx 直接运行(推荐)
|
|
5
|
+
accurLex MCP Server 是一个面向中国法律工作流的 MCP 服务,支持法律问答、合同审查、法律文书生成等能力。通过 MCP(Model Context Protocol)协议,可在 VS Code Copilot、Claude Desktop、Cursor、Windsurf、OpenClaw 等 AI 客户端中使用。
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
npx accurlex-mcp-server
|
|
13
|
-
```
|
|
7
|
+
- **npm 包名:** `accurlex-mcp-server`
|
|
8
|
+
- **npm 页面:** https://www.npmjs.com/package/accurlex-mcp-server
|
|
9
|
+
- **官网:** https://accurlex.com
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
## 前置条件
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
npm install -g accurlex-mcp-server
|
|
19
|
-
```
|
|
13
|
+
- **Node.js ≥ 18** — 运行 `node --version` 确认。无需 clone 代码,无需手动安装依赖。
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
## 快速开始
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
git clone https://github.com/accurlex/accurlex-mcp-server.git
|
|
25
|
-
cd accurlex-mcp-server
|
|
26
|
-
npm install
|
|
27
|
-
cp .env.example .env
|
|
28
|
-
npm start
|
|
29
|
-
```
|
|
17
|
+
### 1. 配置 MCP
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
根据你使用的 AI 客户端,将以下配置添加到对应位置:
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"mcpServers": {
|
|
38
|
-
"accurlex": {
|
|
39
|
-
"command": "npx",
|
|
40
|
-
"args": ["accurlex-mcp-server"]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### VS Code GitHub Copilot
|
|
47
|
-
|
|
48
|
-
在工作区 `.vscode/settings.json` 中添加:
|
|
21
|
+
**VS Code Copilot** — 在工作区**根目录**创建 `.vscode/settings.json`:
|
|
49
22
|
|
|
50
23
|
```json
|
|
51
24
|
{
|
|
@@ -54,277 +27,98 @@ npm start
|
|
|
54
27
|
"accurlex": {
|
|
55
28
|
"type": "stdio",
|
|
56
29
|
"command": "npx",
|
|
57
|
-
"args": ["accurlex-mcp-server"]
|
|
30
|
+
"args": ["-y", "accurlex-mcp-server"],
|
|
31
|
+
"env": {
|
|
32
|
+
"ACCURLEX_PROXY_BASE_URL": "https://accurlex.com",
|
|
33
|
+
"ACCURLEX_API_BASE_URL": "https://accurlex.com/index.php"
|
|
34
|
+
}
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
37
|
}
|
|
61
38
|
}
|
|
62
39
|
```
|
|
63
40
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
编辑 `%APPDATA%\Claude\claude_desktop_config.json`(Windows)或 `~/Library/Application Support/Claude/claude_desktop_config.json`(macOS):
|
|
41
|
+
**Claude Desktop** — 编辑 `%APPDATA%\Claude\claude_desktop_config.json`(Windows)或 `~/Library/Application Support/Claude/claude_desktop_config.json`(macOS):
|
|
67
42
|
|
|
68
43
|
```json
|
|
69
44
|
{
|
|
70
45
|
"mcpServers": {
|
|
71
46
|
"accurlex": {
|
|
72
47
|
"command": "npx",
|
|
73
|
-
"args": ["accurlex-mcp-server"]
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## 登录认证
|
|
80
|
-
|
|
81
|
-
### 方式一:使用 `accurlex_login` 工具(推荐)
|
|
82
|
-
|
|
83
|
-
连接 MCP 服务后,在 AI 客户端中说:
|
|
84
|
-
|
|
85
|
-
> "帮我登录 accurLex,手机号 138xxxx1234,密码 xxx"
|
|
86
|
-
|
|
87
|
-
工具会返回 JWT token,按提示保存到 `.env` 文件,然后重启 AI 客户端即可。
|
|
88
|
-
|
|
89
|
-
### 方式二:手动配置
|
|
90
|
-
|
|
91
|
-
1. 在 https://accurlex.com 登录
|
|
92
|
-
2. 打开浏览器开发者工具 → Application → localStorage → 复制 `al_jwt` 值
|
|
93
|
-
3. 填入 `.env`:
|
|
94
|
-
|
|
95
|
-
```env
|
|
96
|
-
ACCURLEX_BILLING_PHONE=你的手机号
|
|
97
|
-
ACCURLEX_BEARER_TOKEN=你的JWT令牌
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
JWT 令牌有效期 **7 天**,过期后需重新登录获取。
|
|
101
|
-
|
|
102
|
-
## 可用工具
|
|
103
|
-
|
|
104
|
-
| 工具 | 功能 | 计费 |
|
|
105
|
-
|------|------|------|
|
|
106
|
-
| `accurlex_login` | 手机号+密码登录,返回 JWT 令牌 | 免费 |
|
|
107
|
-
| `accurlex_legal_qa` | 中国法律问答(deep 免费 / expert 付费) | deep=免费, expert=扣点 |
|
|
108
|
-
| `accurlex_contract_review` | 合同审查 → 审查意见书(仅 normal 模式) | 扣点 |
|
|
109
|
-
| `accurlex_draft_document` | 法律文书生成(起诉状/答辩状/代理词等) | 扣点 |
|
|
110
|
-
| `accurlex_get_account_status` | 查询账户点数余额 | 免费 |
|
|
111
|
-
| `accurlex_extract_text_from_file` | 提取本地纯文本文件内容 | 免费 |
|
|
112
|
-
|
|
113
|
-
## 输入限制(与网站对齐)
|
|
114
|
-
|
|
115
|
-
- 法律问答问题:**10,000 字**
|
|
116
|
-
- 合同审查:合同文本 + 立场合计 **10,000 字**
|
|
117
|
-
- 文书生成事实描述:**10,000 字**
|
|
118
|
-
- 审查人姓名:**40 字**
|
|
119
|
-
|
|
120
|
-
## 环境变量
|
|
121
|
-
|
|
122
|
-
| 变量 | 必填 | 说明 |
|
|
123
|
-
|------|------|------|
|
|
124
|
-
| `ACCURLEX_PROXY_BASE_URL` | 是 | 流式 API 地址(默认 `https://accurlex.com`) |
|
|
125
|
-
| `ACCURLEX_API_BASE_URL` | 是 | PHP API 地址(默认 `https://accurlex.com/index.php`) |
|
|
126
|
-
| `ACCURLEX_BILLING_PHONE` | 付费工具需要 | 计费手机号 |
|
|
127
|
-
| `ACCURLEX_BEARER_TOKEN` | 账户查询需要 | 登录后获取的 JWT 令牌 |
|
|
128
|
-
| `ACCURLEX_REQUEST_TIMEOUT_MS` | 否 | 请求超时毫秒数(默认 600000 = 10 分钟) |
|
|
129
|
-
|
|
130
|
-
## 当前限制
|
|
131
|
-
|
|
132
|
-
- 单账户模式(凭证来自 `.env`)
|
|
133
|
-
- 文件提取仅支持纯文本:`.txt`、`.md`、`.json`、`.csv`、`.text`
|
|
134
|
-
- 合同审查仅支持 normal 模式(审查意见书),不支持修订版
|
|
135
|
-
- 不支持 DOCX、PDF、图片 OCR(请使用网站处理这些格式)
|
|
136
|
-
|
|
137
|
-
## 常见问题
|
|
138
|
-
|
|
139
|
-
### PowerShell 编码问题
|
|
140
|
-
|
|
141
|
-
通过 PowerShell 管道手动测试时,中文字符可能被破坏。这**不影响**正常使用(VS Code、OpenClaw、Claude Desktop 均正确处理 UTF-8)。
|
|
142
|
-
|
|
143
|
-
如需命令行测试,先将 JSON 写入 UTF-8 文件:
|
|
144
|
-
|
|
145
|
-
```powershell
|
|
146
|
-
[System.IO.File]::WriteAllText("test.jsonl", $jsonContent, [System.Text.Encoding]::UTF8)
|
|
147
|
-
Get-Content test.jsonl -Encoding UTF8 | node src/index.js
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### "tool_unavailable" 错误
|
|
151
|
-
|
|
152
|
-
缺少 `.env` 配置。确保 `ACCURLEX_PROXY_BASE_URL` 和 `ACCURLEX_API_BASE_URL` 已设置。付费工具还需要 `ACCURLEX_BILLING_PHONE`。
|
|
153
|
-
|
|
154
|
-
### "insufficient_balance"(HTTP 402)
|
|
155
|
-
|
|
156
|
-
账户点数不足,请到 https://accurlex.com 充值。
|
|
157
|
-
|
|
158
|
-
### JWT 令牌过期
|
|
159
|
-
|
|
160
|
-
重新调用 `accurlex_login` 获取新令牌,更新 `.env` 后重启即可。
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
# accurLex MCP Server (English)
|
|
165
|
-
|
|
166
|
-
Node.js MCP server that exposes accurLex legal capabilities as MCP tools.
|
|
167
|
-
Designed for use with OpenClaw, VS Code GitHub Copilot, Claude Desktop, or any MCP-compatible AI client.
|
|
168
|
-
|
|
169
|
-
## Quick Start
|
|
170
|
-
|
|
171
|
-
### Option A: npx (recommended)
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
npx accurlex-mcp-server
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Option B: Global install
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
npm install -g accurlex-mcp-server
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### Option C: From source
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
git clone https://github.com/accurlex/accurlex-mcp-server.git
|
|
187
|
-
cd accurlex-mcp-server
|
|
188
|
-
npm install
|
|
189
|
-
cp .env.example .env
|
|
190
|
-
npm start
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Configuration
|
|
194
|
-
|
|
195
|
-
### For OpenClaw
|
|
196
|
-
|
|
197
|
-
```json
|
|
198
|
-
{
|
|
199
|
-
"mcpServers": {
|
|
200
|
-
"accurlex": {
|
|
201
|
-
"command": "npx",
|
|
202
|
-
"args": ["accurlex-mcp-server"]
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### For VS Code GitHub Copilot
|
|
209
|
-
|
|
210
|
-
Add to your workspace `.vscode/settings.json`:
|
|
211
|
-
|
|
212
|
-
```json
|
|
213
|
-
{
|
|
214
|
-
"mcp": {
|
|
215
|
-
"servers": {
|
|
216
|
-
"accurlex": {
|
|
217
|
-
"type": "stdio",
|
|
218
|
-
"command": "npx",
|
|
219
|
-
"args": ["accurlex-mcp-server"]
|
|
48
|
+
"args": ["-y", "accurlex-mcp-server"],
|
|
49
|
+
"env": {
|
|
50
|
+
"ACCURLEX_PROXY_BASE_URL": "https://accurlex.com",
|
|
51
|
+
"ACCURLEX_API_BASE_URL": "https://accurlex.com/index.php"
|
|
220
52
|
}
|
|
221
53
|
}
|
|
222
54
|
}
|
|
223
55
|
}
|
|
224
56
|
```
|
|
225
57
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
{
|
|
232
|
-
"mcpServers": {
|
|
233
|
-
"accurlex": {
|
|
234
|
-
"command": "npx",
|
|
235
|
-
"args": ["accurlex-mcp-server"]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
## Authentication
|
|
242
|
-
|
|
243
|
-
Two ways to authenticate:
|
|
244
|
-
|
|
245
|
-
### Option A: Use the `accurlex_login` tool (recommended)
|
|
246
|
-
|
|
247
|
-
After connecting the MCP server, ask the AI client:
|
|
58
|
+
**Cursor** — 在项目根目录创建 `.cursor/mcp.json`,格式同 Claude Desktop。
|
|
248
59
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
The tool will return a JWT token and instructions to save it in `.env`. Then restart the MCP server (reload the AI client window).
|
|
60
|
+
**Windsurf** — 在项目根目录创建 `.windsurf/mcp.json`,格式同 Claude Desktop。
|
|
252
61
|
|
|
253
|
-
|
|
62
|
+
**OpenClaw** — 使用与 Claude Desktop 相同的 stdio MCP 配置结构。
|
|
254
63
|
|
|
255
|
-
|
|
256
|
-
2. Open browser DevTools → Application → localStorage → copy `al_jwt` value
|
|
257
|
-
3. Fill in `.env`:
|
|
258
|
-
|
|
259
|
-
```env
|
|
260
|
-
ACCURLEX_BILLING_PHONE=your_phone_number
|
|
261
|
-
ACCURLEX_BEARER_TOKEN=your_jwt_token
|
|
262
|
-
```
|
|
64
|
+
> ⚠️ **Windows 上如果遇到 `npx` 找不到的问题,将 `"command"` 改为 `"npx.cmd"`。**
|
|
263
65
|
|
|
264
|
-
|
|
66
|
+
### 2. 重启客户端
|
|
265
67
|
|
|
266
|
-
|
|
68
|
+
- VS Code:`Ctrl+Shift+P` → `Developer: Reload Window`
|
|
69
|
+
- Claude Desktop:完全退出并重新打开
|
|
70
|
+
- Cursor / Windsurf:重启编辑器
|
|
267
71
|
|
|
268
|
-
|
|
269
|
-
|------|-------------|---------|
|
|
270
|
-
| `accurlex_login` | Login with phone + password, returns JWT | free |
|
|
271
|
-
| `accurlex_legal_qa` | Chinese-law legal Q&A (deep free / expert paid) | deep=free, expert=paid |
|
|
272
|
-
| `accurlex_contract_review` | Contract review → 审查意见书 (normal mode only) | paid |
|
|
273
|
-
| `accurlex_draft_document` | Draft legal documents (起诉状/答辩状/代理词 etc.) | paid |
|
|
274
|
-
| `accurlex_get_account_status` | Query account and point balances | free |
|
|
275
|
-
| `accurlex_extract_text_from_file` | Extract text from local plaintext files | free |
|
|
72
|
+
### 3. 验证安装
|
|
276
73
|
|
|
277
|
-
|
|
74
|
+
在 AI 对话中发送以下消息测试(免费,无需登录):
|
|
278
75
|
|
|
279
|
-
|
|
280
|
-
- Contract review: contract text + standpoint combined **10,000 chars** max
|
|
281
|
-
- Draft document facts: **10,000 chars** max
|
|
282
|
-
- Reviewer name: **40 chars** max
|
|
76
|
+
> "劳动合同试用期最长不能超过多久?"
|
|
283
77
|
|
|
284
|
-
|
|
78
|
+
如果 AI 调用了 `accurlex_legal_qa` 工具并返回了法律分析,说明安装成功。
|
|
285
79
|
|
|
286
|
-
|
|
287
|
-
|----------|----------|-------------|
|
|
288
|
-
| `ACCURLEX_PROXY_BASE_URL` | Yes | Streaming API base URL (default: `https://accurlex.com`) |
|
|
289
|
-
| `ACCURLEX_API_BASE_URL` | Yes | PHP API base URL (default: `https://accurlex.com/index.php`) |
|
|
290
|
-
| `ACCURLEX_BILLING_PHONE` | For paid tools | Phone number for billing identity |
|
|
291
|
-
| `ACCURLEX_BEARER_TOKEN` | For account status | JWT token from login |
|
|
292
|
-
| `ACCURLEX_REQUEST_TIMEOUT_MS` | No | Request timeout in ms (default: 600000) |
|
|
80
|
+
### 4. 配置登录信息(使用更多能力前)
|
|
293
81
|
|
|
294
|
-
|
|
82
|
+
如果你需要账户查询,或希望通过登录流程获取当前账号的配置值,可以在 AI 对话中说:
|
|
295
83
|
|
|
296
|
-
|
|
297
|
-
- Local file extraction supports plaintext only: `.txt`, `.md`, `.json`, `.csv`, `.text`
|
|
298
|
-
- Contract review only supports normal mode (审查意见书), revision mode is not available
|
|
299
|
-
- DOCX, PDF, image OCR are not supported (use the website for these)
|
|
84
|
+
> "帮我登录 accurLex,手机号 138xxxx1234,密码 xxx"
|
|
300
85
|
|
|
301
|
-
|
|
86
|
+
登录成功后,将返回的 `ACCURLEX_BEARER_TOKEN` 和 `ACCURLEX_BILLING_PHONE` 添加到客户端配置的 `env` 字段中,然后重启客户端。
|
|
302
87
|
|
|
303
|
-
|
|
88
|
+
说明:
|
|
304
89
|
|
|
305
|
-
|
|
90
|
+
- `accurlex_get_account_status` 需要 `ACCURLEX_BEARER_TOKEN`
|
|
91
|
+
- expert 问答、合同审查、法律文书生成按当前实现需要 `ACCURLEX_BILLING_PHONE`
|
|
306
92
|
|
|
307
|
-
|
|
93
|
+
## 可用功能
|
|
308
94
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
95
|
+
| 功能 | 工具名 | 计费 | 预期耗时 |
|
|
96
|
+
|------|--------|------|---------|
|
|
97
|
+
| 法律问答(免费) | `accurlex_legal_qa` (deep) | 免费 | 10-30 秒 |
|
|
98
|
+
| 法律问答(专业) | `accurlex_legal_qa` (expert) | 扣点 | 10-30 秒 |
|
|
99
|
+
| 合同审查 | `accurlex_contract_review` | 扣点 | 1-3 分钟 |
|
|
100
|
+
| 法律文书生成 | `accurlex_draft_document` | 扣点 | 1-2 分钟 |
|
|
101
|
+
| 查询账户余额 | `accurlex_get_account_status` | 免费 | 1-3 秒 |
|
|
102
|
+
| 提取文件文本 | `accurlex_extract_text_from_file` | 免费 | <1 秒 |
|
|
313
103
|
|
|
314
|
-
|
|
104
|
+
## 详细文档
|
|
315
105
|
|
|
316
|
-
|
|
106
|
+
完整的工具参数、工作流、错误处理和平台特定的故障排查指南,请参阅 [.github/skills/accurlex-legal-assistant/SKILL.md](../.github/skills/accurlex-legal-assistant/SKILL.md)。
|
|
317
107
|
|
|
318
|
-
|
|
108
|
+
## 常见问题
|
|
319
109
|
|
|
320
|
-
|
|
110
|
+
| 问题 | 解决方案 |
|
|
111
|
+
|------|---------|
|
|
112
|
+
| 工具未出现在 AI 对话中 | 确认配置文件路径正确(VS Code 必须在工作区**根目录**的 `.vscode/settings.json`),然后重启客户端 |
|
|
113
|
+
| `tool_unavailable` 错误 | 环境变量未设置,检查 `env` 字段中的 `ACCURLEX_PROXY_BASE_URL` 和 `ACCURLEX_API_BASE_URL` |
|
|
114
|
+
| `ENOENT` / `npx` 找不到 | Node.js 未安装或未在 PATH 中,Windows 上尝试将 `command` 改为 `npx.cmd` |
|
|
115
|
+
| 合同审查“超时” | 合同审查正常需要 1-3 分钟,请耐心等待 |
|
|
116
|
+
| JWT 令牌过期 | 重新调用 `accurlex_login`,更新配置中的 `ACCURLEX_BEARER_TOKEN`,重启客户端 |
|
|
321
117
|
|
|
322
|
-
|
|
118
|
+
## Contributing
|
|
323
119
|
|
|
324
|
-
|
|
120
|
+
Contributions are welcome. Please follow the standard Git workflow.
|
|
325
121
|
|
|
326
|
-
##
|
|
122
|
+
## License
|
|
327
123
|
|
|
328
|
-
|
|
329
|
-
2. Add file upload handling for DOCX, PDF, and OCR workflows
|
|
330
|
-
3. Replace env-bound billing identity with per-user auth for multi-user support
|
|
124
|
+
MIT License. See the LICENSE file for more details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accurlex-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server for accurLex Chinese legal AI — legal Q&A, contract review, law lookup, document drafting",
|
|
6
6
|
"keywords": ["mcp", "legal", "chinese-law", "contract-review", "accurlex", "ai"],
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"homepage": "https://accurlex.com",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/accurlex/accurlex-mcp-server"
|
|
12
|
+
"url": "git+https://github.com/accurlex/accurlex-mcp-server.git"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|