内容
# 我的案件 MCP
[](https://pypi.org/project/mycase-mcp/)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
适用于 [MyCase](https://www.mycase.com/) 的 MCP 服务器 - 为您的律师事务所的 MyCase 账户提供完整的 Claude 访问权限。
**112 个工具。一次设置命令。**
## 功能
- 读取和管理案件、客户、联系人、公司
- 创建和更新任务、事件、日历条目
- 记录时间条目、费用、管理发票
- 访问案件笔记、文件、文件夹、自定义字段
- 管理潜在客户、潜在客户接收和推荐来源
- 消息线程访问和通话记录
- Webhooks、人员组、执业范围等
## 要求
- Python 3.10+
- MyCase 开发者应用程序(参见下面的设置)
- Claude Desktop 或任何 MCP 兼容的客户端
## 开始前 - 注册重定向 URI
OAuth 流使用 `http://127.0.0.1:8766/callback` 作为重定向 URI。**您必须在运行设置之前在 MyCase 开发者应用程序设置中注册此 URI。** 没有它,授权将失败。
如果您还没有 MyCase 开发者应用程序,请联系 MyCase 支持或您的账户经理请求 API 访问权限。
## 安装
```bash
pip install mycase-mcp
```
## 设置(5 步)
1. **在您的 MyCase 应用程序中注册重定向 URI**:`http://127.0.0.1:8766/callback`
2. **运行设置:**
```bash
mycase-mcp-setup
```
输入提示的客户端 ID 和客户端密钥。您的浏览器将打开以进行 MyCase 授权。
3. **验证:**
```bash
mycase-mcp-verify
```
4. **添加到 Claude Desktop 配置**(参见下文)
5. **重启 Claude Desktop**
## Claude Desktop 配置
添加到 `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"mycase": {
"command": "mycase-mcp"
}
}
}
```
保存配置后重启 Claude Desktop。
## 故障排除
**"授权后未收到代码"**
→ MyCase 应用程序中未注册重定向 URI `http://127.0.0.1:8766/callback`。添加它并重试。
**令牌交换失败(401)**
→ 重新检查您的客户端 ID 和客户端密钥。重新运行 `mcase-mcp-setup`。
**"缺少凭证" 验证时**
→ 首先运行 `mcase-mcp-setup`。凭证保存在 `~/.mycase-mcp/`。
**Claude 看不到 mycase 工具**
→ 确保在编辑 `claude_desktop_config.json` 后重启了 Claude Desktop。
**429 请求过多**
→ 服务器会自动重试(最多 3 次)。如果持续出现,请等待片刻后重试。
## 凭证存储
默认情况下,凭证通过跨平台的 [`keyring`](https://github.com/jaraco/keyring) 库存储在操作系统的原生秘密存储中:
| 操作系统 | 后端 |
| ------- | ---------------------------------------- |
| macOS | 钥匙串 |
| Windows | 凭证管理器 |
| Linux | 秘密服务(GNOME 钥匙串 / KWallet) |
秘密以服务名称 `mycase-mcp` 保存。磁盘上不会以明文写入任何内容。
**文件备用。** 在没有 keyring 后端的主机上(例如没有秘密服务的无头 Linux 盒),或者如果您设置 `MYCASE_MCP_USE_KEYRING=0`,凭证将备用到 `~/.mycase-mcp/.env` 文件,权限为 `0600`。
**读取顺序。** 凭证按照以下顺序解析:OS keyring → 进程环境 → `.env` 文件。因此,keyring 中的轮换秘密始终获胜,而在 shell 中导出的 `MYCASE_CLIENT_ID` / `MYCASE_CLIENT_SECRET` 会覆盖文件备用而无需触及 keyring。
OAuth 令牌单独存储在 `~/.mycase-mcp/tokens.json`(模式 600)中,并在过期时自动刷新。
## 工具
| 类别 | 工具 |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 身份 | who_am_i, get_firm, list_staff, get_staff_member |
| 案件 | list_cases, get_case, create_case, update_case, delete_case, list_cases_for_client, add_client_to_case, add_company_to_case, add_staff_to_case |
| 客户 | list_clients, get_client, create_client, update_client, delete_client, list_client_notes, list_client_message_threads |
| 公司 | list_companies, get_company, create_company, update_company, delete_company, add_client_to_company |
| 任务 | list_tasks, create_task, update_task, delete_task, assign_task_to_staff |
| 事件 | list_events, create_event, update_event, delete_event, add_staff_to_event |
| 时间条目 | list_time_entries, get_time_entry, create_time_entry, delete_time_entry |
| 发票 | list_invoices, delete_invoice, record_invoice_payment, list_invoice_payments |
| 费用 | list_expenses, get_expense, create_expense, delete_expense |
| 笔记 | get_note, update_note, delete_note, list_case_notes, create_case_note, create_client_note, create_company_note |
| 文档 | list_documents, get_document, update_document, delete_document, list_case_documents, list_document_versions, list_all_document_versions, get_case_folder, upload_document, upload_case_document, upload_document_version, get_document_data, get_document_version_data, delete_document_version |
| 文件夹 | list_folder_documents, list_folder_subfolders, create_case_subfolder |
| 潜在客户 | list_leads, get_lead, create_lead, update_lead |
| 通话 | list_calls, create_call, update_call, delete_call |
| 消息 | create_message_thread, create_case_message_thread, post_message |
| 自定义字段 | list_custom_fields, get_custom_field, create_custom_field, delete_custom_field, list_custom_field_options, create_custom_field_option, update_custom_field_option, delete_custom_field_option |
| 案件参考 | list_case_stages, create_case_stage, update_case_stage, delete_case_stage, list_case_roles |
| 地点 | list_locations, create_location, update_location, delete_location |
| 推荐来源 | list_referral_sources, create_referral_source |
| 人员组 | list_people_groups, create_people_group, update_people_group, delete_people_group |
| 执业范围 | list_practice_areas, create_practice_area, update_practice_area, delete_practice_area |
| Webhooks | list_webhook_subscriptions, create_webhook_subscription, delete_webhook_subscription |
## 许可证
MIT