Grounded legal answers
Answer PT-BR legal questions with citations from indexed Brazilian sources and a lawyer review signal on every response.
Legal MCP gives applications, agents, and IDE workflows a governed interface for Brazilian legal search, grounded answers, contract review, document drafting, triage, and risk analysis.
Live endpoint
/mcp/ streamable HTTP
14
legal tools
Scoped
authenticated access
RAG
grounded Brazilian law answers
Managed
retrieval, review, and usage controls
Product surface
The platform packages retrieval, generation, authentication, token governance, and usage telemetry behind a single MCP interface.
Answer PT-BR legal questions with citations from indexed Brazilian sources and a lawyer review signal on every response.
Extract parties, dates, values, obligations, omissions, clauses, and risk markers from contracts and legal drafts.
Expose legal intelligence through an MCP-compatible HTTP interface so IDEs, agents, apps, and internal tools can call it directly.
Issue scoped client tokens, revoke leaked credentials, track usage, and route critical outputs to human legal review.
Quickstart
Every request is attributed to a client token. The MCP server validates issuer, audience, expiry, signature, and revocation status before a tool runs.
A backoffice operator creates an MCP client and assigns the exact tool scopes the integration needs.
The admin API issues a scoped client token. The raw token is displayed once, then only metadata is retained.
Your app sends MCP tool calls over authenticated HTTP with Authorization: Bearer <token>.
Usage is attributed by client and token id. Revoked tokens are rejected by the server within 60 seconds.
TOKEN="eyJhbGciOiJIUzI1NiIs..."
curl -sN -X POST https://your-legal-mcp-endpoint.example/mcp/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "answer_legal_question",
"arguments": {
"question": "O que diz o artigo 422 do Codigo Civil?",
"top_k": 6
}
}
}'from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async with streamablehttp_client(
"https://your-legal-mcp-endpoint.example/mcp/",
headers={"Authorization": f"Bearer {token}"},
timeout=30.0,
) as (read, write, _meta):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool(
"answer_legal_question",
{"question": "...", "top_k": 8},
)Get access
After confirmation, we generate a client token with every Legal MCP tool enabled so your project can start calling the MCP endpoint immediately.
MCP client token
The token is created after the subscription is confirmed.
All 14 public Legal MCP tools are enabled on the client token.
The first 1,000 tokens are included for testing your integration.
Your first 1,000 tokens are free. After that, Legal MCP usage is only US$0.03 per 1,000 tokens for legal RAG and document workflows.
Tool reference
All tools require a valid client token with the matching scope. Each response carries requiresHumanReview so callers can preserve the lawyer-in-the-loop contract.
answer_legal_question
Primary user-facing RAG answer with inline citations.
question, top_k, jurisdiction
search_legal_sources
Low-level BM25 plus semantic retrieval for raw chunks.
query, limit
get_law_article
Retrieve a specific article from a numbered law.
law_number, article
explain_legal_basis
Return literal source text and neighboring chunks without LLM rewriting.
query
answer_in_area
Answer a question filtered by a legal area such as civil, labor, tax, LGPD, or corporate.
question, area, top_k, jurisdiction
check_contract_risks
Find contract risks with category, level, citation, and recommendation.
contract_text, contract_type
validate_contract_completeness
Check a contract against type-specific required fields.
contract_text, contract_type
get_clause_recommendation
Recommend essential missing clauses with templates and legal basis.
contract_text, contract_type
draft_legal_document
Generate a Brazilian legal document in markdown for lawyer review.
document_type, facts, area, parties, target_court
analyze_legal_document
Extract structured fields from legal text.
text, kind
review_legal_document
QA pass for coherence, omissions, unsupported claims, and style.
document_text, kind
legal_orchestrate
One-shot triage, RAG answer, risk markers, and optional draft.
question, include_draft, draft_type, top_k
classify_legal_case
Fast triage for area, sub-topics, risk, urgency, and required docs.
question
assess_legal_risk
Deterministic regex-based risk scan with no LLM call.
facts
Architecture
The MCP server stays focused on authenticated tool execution while operational systems manage source quality, retrieval freshness, and usage governance.
Authenticated MCP endpoint with 14 legal tool handlers available to client tokens.
Client, token, job, document, chunk, search, and playground APIs.
Managed source quality, retrieval freshness, and operational review flows.
Versioned documents, searchable chunks, vector retrieval, token usage, and raw file custody.
Request path
01
A bearer client token enters the Legal MCP endpoint.
02
Middleware validates token claims and revocation status.
03
Tool handlers read from the legal knowledge index.
04
Operational controls remain internal and are not exposed to client tokens.
05
Usage events are recorded without blocking tool responses.
Authentication
Tokens are minted by legal-admin-api, persisted only as metadata, and rejected if expired, mis-scoped, unknown, or revoked.
{
"iss": "legal-admin-api",
"aud": "legal-mcp-server",
"sub": "<client_id>",
"scopes": ["answer_legal_question", "search_legal_sources"],
"iat": 1779121557,
"exp": 1781713557,
"jti": "<token uuid>"
}Use cases
Legal MCP can sit behind a chat product, a drafting workflow, a contract review system, an IDE assistant, or an internal operations console.
Call legal search, legal basis explanation, and area-scoped answers from drafting or curation nodes.
Give customer-facing assistants grounded citations while keeping the final decision behind human review.
Screen drafts for missing clauses, risk patterns, unsupported assertions, and completeness gaps.
Use governed legal knowledge coverage across grounded answers, document review, drafting, and risk workflows.
name: Legal MCP Server
version: 0.2.0
schema: v1
mcpServers:
- name: Legal MCP
url: https://your-legal-mcp-endpoint.example/mcp/
transport: streamable-http
headers:
Authorization: Bearer ${{ secrets.LEGAL_MCP_TOKEN }}Lawyer-agent workflow
Your product can call search_legal_sources during drafting, then run explain_legal_basis, answer_in_area, and assess_legal_risk in parallel during curation.
LEGAL_MCP_URL=<provided_onboarding_endpoint>
LEGAL_MCP_TOKEN=<client_token>
LEGAL_MCP_TIMEOUT_S=30.0
LEGAL_MCP_SEARCH_K=6
Backoffice and admin
The admin API supports operational workflows and the Clerk-authenticated operator UI used to manage Legal MCP safely.
Jobs: GET/POST /admin/jobs, retry, cancel, detail
Documents: GET /admin/documents, /admin/documents/{id}, /admin/chunks
Search: POST /admin/search/semantic and /admin/search/hybrid
MCP clients: create, list, detail, soft delete, usage
MCP tokens: issue once, list metadata, revoke by jti
Playground: POST /admin/mcp/playground/{tool_name}
Knowledge governance
0xAI manages the knowledge surface behind the MCP endpoint so client tokens can focus on approved legal reasoning, review, drafting, and risk workflows.
01
0xAI curates the legal knowledge surface exposed to client tokens.
02
Retrieval quality is monitored through source metadata, citations, and review signals.
03
Client integrations consume only the approved MCP tools listed in the public reference.
04
Operational controls stay internal so user tokens cannot modify the knowledge base.
Operational runbook
Common operations stay explicit: issue, revoke, retry, inspect, and rotate with a clear owner path.
Create clients at /clients, issue a token, and copy the raw credential immediately.
Use the operations board to inspect processing status and retry controlled jobs.
Delete the token by id. Revocation is observed by the MCP server cache.
Read per-client totals, monthly breakdowns, and per-tool usage from the usage card.
Build with 0xAI
0xAI can help scope token governance, tool access, knowledge coverage, and the integration path for your app or agent workflow.