mcpField
C
Cerebra Legal MCP Server

Cerebra Legal MCP Server

本地服务
github.com/yoda-digital法律与政务3383 周前更新

关于 Cerebra Legal MCP Server

Cerebra Legal MCP Server 是一个用于法律推理与分析的 MCP 服务,基于 Anthropic 提出的 "think" 工具思路构建。它面向需要结构化分析法律问题的用户,可自动识别法律领域并给出对应的指导与模板。

主要功能

  1. 01自动识别法律领域(如 ANSC 异议、消费者保护、合同分析)
  2. 02按领域提供指导与分析模板
  3. 03法律引用格式化
  4. 04推理质量反馈
  5. 05支持修订先前的推理步骤

适用场景

  1. 01梳理采购异议等复杂法律问题的分析步骤
  2. 02针对具体条款向用户提出后续问题
  3. 03将分析结论整理为带引用的结构化文档

MCP 相关

该项目是一个 MCP 服务,向 MCP 客户端暴露 legal_think、legal_ask_followup_question 和 legal_attempt_completion 三个工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Cerebra Legal MCP 服务

一个企业级 MCP 服务,用于法律推理与分析,其设计基于 Anthropic 的工程博客 中的“think”工具概念。

概述

Cerebra Legal 提供三个强大的法律推理与分析工具:

  1. legal_think - 一款结构化法律推理工具,可借助领域专属指导和模板,帮助分析复杂的法律问题。
  2. legal_ask_followup_question - 一款专用工具,可在法律情境中提出后续问题,并提供领域专属选项。
  3. legal_attempt_completion - 一款用于展示法律分析结果的工具,支持规范的结构和引文格式。

服务会自动检测法律领域(ANSC contestation、消费者保护、合同分析),并提供领域专属的指导、模板和反馈。

功能

  • 领域检测:自动识别分析所属的法律领域
  • 领域专属指导:针对不同法律领域提供量身定制的指导
  • 结构化模板:提供领域专属的法律分析模板
  • 引文格式:规范地格式化法律引文
  • 思考质量分析:提供法律推理质量反馈
  • 修订支持:支持修订先前的思考内容

安装

# Clone the repository
git clone https://github.com/yoda-digital/mcp-cerebra-legal-server.git
cd mcp-cerebra-legal-server

# Install dependencies
npm install

# Build the project
npm run build

使用方法

运行服务
npm start
测试服务

此代码库包含一个测试客户端,演示如何与服务交互:

# Make the test client executable
chmod +x test-client.js

# Run the test client
./test-client.js

测试客户端将:

  1. 启动服务
  2. 发送 tools/list 请求以获取可用工具
  3. 发送包含示例思考内容的 legal_think 请求
  4. 显示服务的响应
添加到 Claude

若要将服务添加到 Claude,请使用以下配置更新 MCP 设置文件:

用于 VSCode 扩展

编辑文件 ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json:

{
  "mcpServers": {
    "cerebra-legal": {
      "command": "node",
      "args": ["/path/to/mcp-cerebra-legal-server/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}
用于 Claude 桌面应用

编辑文件 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS),或编辑你所用平台上的对应文件:

{
  "mcpServers": {
    "cerebra-legal": {
      "command": "node",
      "args": ["/path/to/mcp-cerebra-legal-server/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}
在 Claude 中使用工具

将服务添加到 Claude 后,即可在对话中使用这些工具:

系统提示词集成

为了让 AI 与这些法律工具进行最佳交互,必须在系统提示词中加入适当的指导。这些工具遵循与标准 Cline 工具相同的 AI → Human 交互模型,但针对特定领域进行了增强。

系统提示词应包含每个工具的详细文档:

## legal_think
Description: A structured legal reasoning tool that helps analyze complex legal issues with domain-specific guidance and templates. This tool enables step-by-step legal analysis with feedback on reasoning quality.

Parameters:
- thought: (required) The current legal reasoning step
- thoughtNumber: (required) Current thought number in sequence
- totalThoughts: (required) Estimated total thoughts needed
- nextThoughtNeeded: (required) Whether another thought step is needed
- category: (optional) Legal domain category (auto-detected if not provided)
- references: (optional) Array of legal references
- isRevision: (optional) Whether this revises previous thinking
- revisesThoughtNumber: (optional) Which thought is being reconsidered
- requestGuidance: (optional) Whether to request domain-specific guidance
- requestTemplate: (optional) Whether to request a domain-specific template

Usage:
<legal_think>
<thought>Your legal reasoning step here</thought>
<thoughtNumber>Current thought number</thoughtNumber>
<totalThoughts>Estimated total thoughts</totalThoughts>
<nextThoughtNeeded>true or false</nextThoughtNeeded>
<category>Legal domain (optional)</category>
<references>Array of references (optional)</references>
<isRevision>true or false (optional)</isRevision>
<revisesThoughtNumber>Thought number being revised (optional)</revisesThoughtNumber>
<requestGuidance>true or false (optional)</requestGuidance>
<requestTemplate>true or false (optional)</requestTemplate>
</legal_think>

## legal_ask_followup_question
Description: Ask the user a legal domain-specific question to gather additional information needed to complete the task. This tool enhances the standard ask_followup_question with legal domain detection, terminology formatting, and domain-specific suggested options.

Parameters:
- question: (required) The question to ask the user. This will be automatically enhanced with appropriate legal terminology.
- options: (optional) An array of 2-5 options for the user to choose from. If not provided, domain-specific options will be automatically suggested.
- context: (optional) Additional context to help with domain detection and question formatting.

Usage:
<legal_ask_followup_question>
<question>Your question here</question>
<options>
Array of options here (optional), e.g. ["Option 1", "Option 2", "Option 3"]
</options>
<context>Additional context to help with domain detection (optional)</context>
</legal_ask_followup_question>

## legal_attempt_completion
Description: Present the result of your work to the user with proper legal structure and formatting. This tool enhances the standard attempt_completion with legal domain detection, document structuring, and citation formatting.

Parameters:
- result: (required) The result of the task. This will be automatically formatted with proper legal structure.
- command: (optional) A CLI command to execute to show a live demo of the result to the user.
- context: (optional) Additional context to help with domain detection and result formatting.

Usage:
<legal_attempt_completion>
<result>
Your final result description here
</result>
<command>Command to demonstrate result (optional)</command>
<context>Additional context to help with domain detection (optional)</context>
</legal_attempt_completion>

这些指导可确保 AI 理解:

  1. 这些工具是标准工具的专用版本
  2. 它们保留相同的 AI → Human 交互流程
  3. 它们具备额外的能力和参数
  4. 如何正确格式化工具调用

如果缺少这些指导,AI 可能无法充分利用这些工具内置的领域专属能力。

1. 使用 legal_think

legal_think 工具可通过结构化思考帮助你分析复杂的法律问题:

I need to analyze an ANSC contestation where a claimant argues that technical specifications in a tender were too restrictive.

Claude 将使用 legal_think 工具来:

  • 检测法律领域(ANSC contestation)
  • 提供领域专属指导
  • 提供结构化分析模板
  • 反馈法律推理的质量
  • 支持修订先前的思考内容
2. 使用 legal_ask_followup_question

当 Claude 需要更多信息才能完成法律分析时:

What specific provisions of the technical specifications are being challenged?

Claude 将使用 legal_ask_followup_question 工具来:

  • 使用恰当的法律术语来表述问题
  • 提供供用户选择的领域专属选项
  • 检测法律领域,以便根据上下文提出问题
3. 使用 legal_attempt_completion

Claude 准备好呈现最终法律分析时:

Based on my analysis, the technical specifications requiring "minimum 5 years experience" appear disproportionate and likely violate Article 33(2) of Law 131/2015 on public procurement.

Claude 将使用 legal_attempt_completion 工具来:

  • 按照规范的法律结构整理结论
  • 提取并格式化法律引文
  • 将分析整理为清晰的章节
  • 提供专业的法律文档格式
工具输入架构
legal_think
{
  "thought": "Analyzing ANSC contestation where claimant argues technical specifications were too restrictive.",
  "thoughtNumber": 1,
  "totalThoughts": 5,
  "nextThoughtNeeded": true,
  "category": "ansc_contestation",  // Optional, auto-detected if not provided
  "references": ["Law 131/2015", "ANSC Decision #12345"],  // Optional
  "isRevision": false,  // Optional
  "revisesThoughtNumber": null,  // Optional
  "requestGuidance": true,  // Optional
  "requestTemplate": true  // Optional
}
legal_ask_followup_question
{
  "question": "What specific provisions of the technical specifications are being challenged?",
  "options": [  // Optional, auto-generated if not provided
    "Are you challenging the experience requirements?",
    "Are you challenging the technical capacity requirements?",
    "Are you challenging the financial requirements?",
    "Are you challenging the certification requirements?"
  ],
  "context": "ANSC contestation regarding procurement of IT equipment"  // Optional
}
legal_attempt_completion
{
  "result": "Based on the analysis of ANSC contestation #12345, the technical specifications requiring 'minimum 5 years experience' appear disproportionate and likely violate Article 33(2) of Law 131/2015 on public procurement.",
  "command": null,  // Optional
  "context": "ANSC contestation analysis"  // Optional
}

架构

该服务采用模块化架构构建:

  • 领域检测器:识别分析涉及的法律领域
  • 法律知识库:提供特定领域的指导和模板
  • 引文格式化器:规范地格式化法律引文
  • 工具实现:处理每个工具的逻辑

开发

项目结构
mcp-cerebra-legal-server/
├── src/
│   ├── shared/           # Shared components
│   │   ├── DomainDetector.ts
│   │   ├── LegalKnowledgeBase.ts
│   │   ├── CitationFormatter.ts
│   │   └── types.ts
│   ├── tools/            # Tool implementations
│   │   ├── LegalThinkTool.ts
│   │   ├── LegalAskFollowupQuestionTool.ts
│   │   └── LegalAttemptCompletionTool.ts
│   ├── utils/            # Utilities
│   │   └── logger.ts
│   └── index.ts          # Main server entry point
├── build/                # Compiled JavaScript
├── test-client.js        # Test client
├── package.json
└── tsconfig.json
构建
npm run build
测试
# Run the test client
./test-client.js

仓库

此项目托管在 GitHub 上: https://github.com/yoda-digital/mcp-cerebra-legal-server

参考资料

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。