Legalis MCP Server

Legalis MCP Server

MCP server for Legalis, a Brazilian legal document AI that enables attorneys to manage cases, generate legal documents, search legislation, and more via natural language.

Category
访问服务器

README

Legalis MCP Server

Assistente jurídico com IA para advogados brasileiros

Leia em Português

MCP (Model Context Protocol) server for Legalis — Brazilian legal document AI for attorneys.

Connect Claude (or any MCP-compatible client) to your Legalis account and interact with cases, generate legal documents, search legislation, and more using natural language.


Quick start

1. Install

pip install legalis-mcp
# or with uv:
uv tool install legalis-mcp

2. Authenticate

legalis-mcp auth

This opens your browser. Log in to Legalis normally — tokens are saved to ~/.legalis/credentials.json (owner-readable only).

3. Configure Claude

Add to your Claude configuration (~/.claude/claude_desktop_config.json for Claude Desktop, or claude_code_config.json for Claude Code):

{
  "mcpServers": {
    "legalis": {
      "command": "legalis-mcp",
      "args": ["serve"]
    }
  }
}

4. Use

In Claude, try:

  • "Liste meus casos no Legalis"
  • "Crie um caso de rescisão indireta para João Silva"
  • "Gere a seção de fundamentos jurídicos da peça X do caso Y"
  • "Pesquise legislação trabalhista sobre justa causa"
  • "Quantas gerações ainda tenho disponíveis este mês?"

Available tools

Cases

Tool Description
list_cases List cases (paginated, filterable by status)
get_case Get case details by ID
create_case Create a new case
update_case Update case fields
search_cases Full-text search across cases
delete_case Delete a case permanently

Legal documents

Tool Description
list_legal_documents List peças processuais for a case
get_legal_document Get a document with all sections
create_legal_document Create a new legal document
generate_section AI-generate a document section (fatos, fundamentos, pedidos…)
update_section_text Manually edit a document section
get_case_context Get case context (facts, parties, evidence)
update_case_context Update case context
delete_legal_document Delete a legal document
export_legal_document_docx Export a document as DOCX

Events & Tasks

Tool Description
create_case_event Create an event on a case (internal or client-visible)
list_case_events List events for a case
delete_case_event Delete a case event
create_case_task Create a task with due date and priority
list_case_tasks List tasks for a case
update_case_task Update a task's fields
complete_case_task Mark a task as complete
delete_case_task Delete a task
list_upcoming_tasks List upcoming tasks across all cases
list_overdue_tasks List all overdue tasks

Other

Tool Description
run_interview AI-guided case intake interview
list_templates List available document templates
get_template Get template details and sections
search_legislation Search Brazilian legislation (LexML)
get_my_usage Check AI quota and billing period usage

API coverage

The table below maps every Legalis backend endpoint to its MCP tool (when available).

Cases

Endpoint Method MCP Tool
/api/cases GET list_cases
/api/cases POST create_case
/api/cases/{id} GET get_case
/api/cases/{id} PUT update_case
/api/cases/{id} DELETE delete_case
/api/cases/search GET search_cases
/api/cases/{id}/overview GET
/api/cases/{id}/portal-token POST / DELETE

Legal documents

Endpoint Method MCP Tool
/api/cases/{id}/legal-documents GET list_legal_documents
/api/cases/{id}/legal-documents POST create_legal_document
/api/cases/{id}/legal-documents/{doc} GET get_legal_document
/api/cases/{id}/legal-documents/{doc} DELETE delete_legal_document
/api/cases/{id}/legal-documents/{doc}/sections/{key}/generate POST generate_section
/api/cases/{id}/legal-documents/{doc}/sections/{key}/text PUT update_section_text
/api/cases/{id}/legal-documents/{doc}/export/docx GET export_legal_document_docx

Case context

Endpoint Method MCP Tool
/api/cases/{id}/context GET get_case_context
/api/cases/{id}/context PUT update_case_context
/api/cases/{id}/context/history GET

Tasks

Endpoint Method MCP Tool
/api/cases/{id}/tasks GET list_case_tasks
/api/cases/{id}/tasks POST create_case_task
/api/cases/{id}/tasks/{task} PUT update_case_task
/api/cases/{id}/tasks/{task} DELETE delete_case_task
/api/cases/{id}/tasks/{task}/complete POST complete_case_task
/api/tasks/upcoming GET list_upcoming_tasks
/api/tasks/overdue GET list_overdue_tasks

Events

Endpoint Method MCP Tool
/api/cases/{id}/events GET list_case_events
/api/cases/{id}/events POST create_case_event
/api/cases/{id}/events/{event} DELETE delete_case_event

Templates & Legislation

Endpoint Method MCP Tool
/api/templates GET list_templates
/api/templates/{id} GET get_template
/api/legislacao GET search_legislation

Usage

Endpoint Method MCP Tool
/api/plans/my-usage GET get_my_usage

Not yet covered

Endpoint Notes
/api/cases/{id}/overview BFF endpoint — case + tasks + events in one call
/api/cases/{id}/portal-token Share case status with clients via public link
/api/cases/{id}/context/history Context version history
/api/users/me User profile read/update
/api/users/settings Notification and UI preferences
/api/users/documents Uploaded documents (non-generated)
/api/voice-agent/* Voice assistant (plan-gated feature)
/api/corporates/{id}/users Team member management
/api/subordinates/invite Invite team members

CLI commands

legalis-mcp auth      # Authenticate via browser
legalis-mcp serve     # Start MCP server (stdio)
legalis-mcp status    # Verify authentication
legalis-mcp logout    # Remove stored credentials

Development

git clone <repo>
cd mcp
pip install -e ".[test]"

# Run unit tests (no external services needed)
pytest tests/unit/ -v

# Run integration tests (requires Docker)
cd ../integration && docker-compose up -d
cd ../mcp
LEGALIS_API_URL=http://localhost:8000 \
LEGALIS_ACCESS_TOKEN=<token> \
LEGALIS_REFRESH_TOKEN=<refresh> \
pytest tests/integration/ -v

Environment variables

Variable Default Description
LEGALIS_API_URL https://hai-production-612f.up.railway.app Backend URL
LEGALIS_ACCESS_TOKEN Pre-issued token (CI/test only)
LEGALIS_REFRESH_TOKEN Refresh token (CI/test only)
LEGALIS_CREDENTIALS_FILE ~/.legalis/credentials.json Credentials file path
LEGALIS_OAUTH_PORT 3742 Local OAuth callback port

Security

  • Credentials are stored in ~/.legalis/credentials.json with 600 permissions (owner read/write only).
  • The OAuth redirect is restricted to http://localhost — open-redirect attacks are blocked at the backend.
  • Tokens are never stored in the MCP configuration file.
  • All API calls go through the existing Legalis backend — RBAC, rate limiting, and quotas apply normally.

Publishing

# PyPI
pip install build twine
python -m build
twine upload dist/*

# Then register at:
# - smithery.ai (MCP marketplace)
# - mcp.so (community directory)
# - github.com/modelcontextprotocol/servers (official list)

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选