使用说明
合法MCP服务器
符合模型上下文协议(MCP)的服务器,用于使用Azure Blob存储和Anthropic Claude API进行法律文档分析。
特性
- 文档管理:列出并检索预加载的
.txtAzure Blob存储中的文档 - 提示库:管理精心策划的法律文件分析提示
- 流媒体分析:通过MCP进度通知执行具有实时进度更新的文档分析
- MCP SSE运输:使用服务器发送事件完全符合MCP规范
先决条件
- Node.js 18+
- Azure存储帐户:
documents-texts集装箱(用于.txt文件)prompts容器(用于提示库JSON)
- 有信用的Claude API无烟煤钥匙
设置
-
克隆和安装依赖关系:
git clone <your-repo-url> cd Legal-MCP npm install -
配置环境变量:
cp .env.example .env # Edit .env with your actual values -
将初始提示库上载到Azure:
# Using Azure CLI (after setting up connection) az storage blob upload \ --account-name legalmcpstore \ --container-name prompts \ --name "library.json" \ --file ./prompts/library.json \ --connection-string "$AZURE_STORAGE_CONNECTION_STRING" -
将文档上传到Azure:
# Upload `.txt` files to the documents-texts container az storage blob upload \ --account-name legalmcpstore \ --container-name documents-texts \ --name "your-document.txt" \ --file ./path/to/your-document.txt \ --connection-string "$AZURE_STORAGE_CONNECTION_STRING"
本地运行
开发模式(自动重新加载):
npm run dev
生产方式:
npm run build
npm start
服务器将于启动 http://localhost:3000 (或中指定的端口 PORT 有人)。
MCP客户端配置
克劳德桌面
增添 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"legal-mcp": {
"command": "node",
"args": ["/absolute/path/to/Legal-MCP/dist/index.js"],
"env": {
"AZURE_STORAGE_CONNECTION_STRING": "...",
"ANTHROPIC_API_KEY": "..."
}
}
}
}
备注:对于SSE传输,您需要配置HTTP端点。有关SSE客户端设置,请参阅MCP文档。
MCP检验员测试
您可以使用MCP检查器或任何兼容MCP的客户端测试服务器:
# Server should be running on http://localhost:3000/mcp
# Use an MCP client that supports SSE transport
可用工具
- list_文档:返回所有可用信息
.txt文件 - list_prompts:列出可用的分析提示(可选搜索)
- get_prompt:按ID检索完整的提示详细信息
- add_prompt:添加新的用户贡献提示
- 执行分析:使用流式进度更新执行文档分析
项目结构
legal-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── storage/
│ │ ├── azure-blob.ts # Azure Blob Storage client
│ │ └── prompts.ts # Prompt library management
│ ├── claude/
│ │ └── client.ts # Claude API client with streaming
│ ├── tools/
│ │ ├── documents.ts # Document listing tool
│ │ ├── prompts.ts # Prompt management tools
│ │ └── execute.ts # Analysis execution tool
│ └── types.ts # Shared TypeScript types
├── prompts/
│ └── library.json # Initial prompt library
└── package.json
部署到Azure
有关Azure App Service部署说明,请参阅原始计划中的部署部分。
许可证
国际协调委员会