Skip to main content
Glama
justingyang218

劳动&劳务合同风险排查 MCP Server

Labor & Service Contract Risk Review MCP Server

A contract risk review MCP service built on FastMCP that can be invoked by any MCP protocol-compatible client (DeepSeek Harness, Claude Code, Cursor, Windsurf, etc.).

✨ Features

  • Single Contract Review: Conducts comprehensive intelligent review of labor contracts (16 risk categories) or service contracts (9 risk categories)

  • Batch Contract Review: Supports batch review of multiple contracts and automatically generates an overview table

  • Risk Knowledge Base Query: Queries key risk review points and legal basis for a specified category

  • Local Regulation Query: Queries local regulation differences for Beijing/Shanghai/Guangdong/Zhejiang/Jiangsu

  • Automatic Contract Type Recognition: Intelligently determines whether a contract is a labor contract or a service contract

  • Personal Information Desensitization: Automatically desensitizes ID card numbers, phone numbers, and bank card numbers

Related MCP server: Contract Review AI MCP

📦 Installation

pip install -r requirements.txt

⚙️ Configuration

Environment Variables

Variable Name

Required

Default Value

Description

LLM_API_KEY

✅ Yes

-

LLM API key

LLM_BASE_URL

❌ No

https://api.openai.com/v1

API endpoint URL (OpenAI-compatible interface)

LLM_MODEL

❌ No

gpt-4o-mini

Model name

LLM_TEMPERATURE

❌ No

0.1

Sampling temperature

Configuration Example

export LLM_API_KEY="sk-xxxxxxxxxxxxxx"
export LLM_BASE_URL="https://api.deepseek.com/v1"
export LLM_MODEL="deepseek-chat"

💡 Supports any OpenAI-compatible API interface (DeepSeek, Qwen, Zhipu AI, Ollama, etc.)

🚀 Running

Method 1: STDIO Mode (Local Tools/Desktop Clients)

python server.py
# 或显式指定
python server.py stdio

Method 2: HTTP Mode (Network Service)

python server.py http 0.0.0.0 8000

After startup, access http://localhost:8000/mcp to use it.

Method 3: Using the fastmcp CLI

# 开发调试
fastmcp dev server.py

# 安装到 Claude Desktop
fastmcp install server.py

🔌 MCP Tools

1. review_contract

Performs a complete risk review of the contract text.

Parameters:

  • contract_text (string, required): Contract text content

  • contract_type (string, optional): Contract type, auto/labor/service, default auto

Example:

review_contract(contract_text="劳动合同文本...", contract_type="auto")

2. batch_review

Reviews multiple contracts in batch.

Parameters:

  • contracts_text (string, required): Text of multiple contracts

  • separator (string, optional): Separator, default ---合同分割线---

Example:

batch_review(contracts_text="合同1\n---合同分割线---\n合同2", separator="---合同分割线---")

3. get_risk_knowledge

Queries the risk knowledge base for a specified category.

Parameters:

  • category (string, required): Risk category, e.g., "probation period", "non-compete restriction", "personal injury compensation"

Example:

get_risk_knowledge(category="竞业限制")

4. get_local_regulations

Queries regulation differences for a specified region.

Parameters:

  • region (string, required): Region, Beijing/Shanghai/Guangdong/Zhejiang/Jiangsu

  • topic (string, required): Topic, e.g., non-compete compensation/overtime pay base/minimum wage/maternity leave/marriage leave

Example:

get_local_regulations(region="上海", topic="竞业补偿")

📚 MCP Resources

URI

Description

risk-knowledge://categories

List of all risk categories

risk-knowledge://labor

List of 16 risk categories for labor relations

risk-knowledge://service

List of 9 risk categories for service relations

local-regions://list

List of supported regions

💬 MCP Prompts

Name

Description

contract_review_prompt

Complete contract review prompt template

batch_review_prompt

Batch review prompt template

🔗 Client Integration

Claude Desktop

Add the following to claude_desktop_config.json:

{
  "mcpServers": {
    "contract-risk-review": {
      "command": "python",
      "args": ["/path/to/server.py"],
      "env": {
        "LLM_API_KEY": "your-api-key",
        "LLM_BASE_URL": "https://api.openai.com/v1",
        "LLM_MODEL": "gpt-4o-mini"
      }
    }
  }
}

Cursor / Windsurf

Simply add the above stdio configuration to the IDE's MCP configuration.

HTTP/SSE Clients

Set the MCP server address to http://localhost:8000/mcp.

📁 Directory Structure

contract-risk-review-mcp/
├── server.py              # MCP Server 主文件
├── requirements.txt       # 依赖清单
├── README.md              # 使用说明
└── knowledge/             # 知识库
    ├── risk-knowledge-base.md    # 劳动关系16类风险知识库
    ├── service-contract-risks.md # 劳务关系9类风险知识库
    ├── local-regulations.md      # 地方法规差异知识库
    └── categories-index.md       # 风险类别索引

⚠️ Disclaimer

This tool only provides contract risk references, clause modification suggestions, and regulatory basis. It does not constitute formal legal advice and cannot replace the professional review of a licensed attorney. For matters involving labor arbitration or major rights disputes, be sure to consult a licensed attorney.

📝 Changelog

v1.0.0

  • Initial version

  • Supports review of 16 risk categories for labor contracts

  • Supports review of 9 risk categories for service contracts

  • Supports batch review, knowledge base queries, and local regulation queries

  • Supports both STDIO and HTTP/SSE transport modes

Related MCP Connectors

Related MCP Servers