Grounded legal answers and orchestration
Answer PT-BR legal questions with citations, area-specific specialists, triage, risk flags, and lawyer review signals.
Legal MCP gives applications, agents, and IDE workflows a governed interface for Brazilian legal search, grounded answers, contract review, process history, source ingestion, legal graph queries, document drafting, triage, and risk analysis.
Live endpoint
/mcp/ streamable HTTP
25
MCP tools
Scoped
authenticated access
Graph + RAG
Brazilian legal knowledge retrieval
DataJud
process lookup and movement interpretation
Product surface
The platform packages retrieval, legal graph intelligence, process lookup, ingestion, generation, authentication, token governance, and usage telemetry behind a single MCP interface.
Answer PT-BR legal questions with citations, area-specific specialists, triage, risk flags, and lawyer review signals.
Extract clauses, validate completeness, generate drafts, return drafting context, and navigate parsed legal-document trees.
Consult CNJ/DataJud process history, enrich with public communications, and queue source or local-document ingestion.
Query provisions and relations, trace normative history, check provision status, validate hierarchy, and inspect graph stats.
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://mcp.laweragent.com/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://mcp.laweragent.com/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 25 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 hybrid retrieval for raw chunks with optional geographic and law filters.
query, limit, uf, municipality_ibge, law_number
get_law_article
Retrieve a specific article from a numbered law, with UF disambiguation for state and municipal laws.
law_number, article, uf
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
get_drafting_context
Return structured legal grounding for contract drafting with required clauses, risks, and jurisdiction notes.
contract_type, jurisdiction, extracted_entities, user_prompt
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
consultar_processo
Consult a Brazilian court case through CNJ DataJud and return structured process data plus legal interpretation.
numero_processo, tribunal
pageindex_navigate
Walk a parsed legal-document tree to locate the most relevant section for a question.
doc_id, query, top_k
request_source_ingestion
Queue public source ingestion such as Planalto or LexML through the admin ingestion API.
source, url, priority, document_type, jurisdiction, legal_areas
ingest_local_document
Upload arbitrary PDF or text content into the ingestion pipeline for parsing, chunking, and indexing.
filename, content_text, content_base64, content_type, priority
query_legal_graph
Search graph nodes and relations for documents, provisions, citations, alterations, and revocations.
query, node_type, relation_type, depth, limit
trace_normative_history
Trace provision changes through ALTERA, DA_NOVA_REDACAO, REVOGA, and related history.
provision_id, direction, as_of_date
check_provision_status
Check whether a legal provision is vigente, revoked, suspended, or otherwise affected on a date.
provision_id, as_of_date
find_related_provisions
Find related provisions by citations, alterations, revocations, and confidence threshold.
provision_id, relation_type, min_confidence, limit
validate_normative_hierarchy
Validate hierarchy relationships such as Constitution over federal law or decree.
lower_norm_id, upper_norm_id
get_legal_graph_stats
Return graph statistics for documents, provisions, and relations.
Architecture
The MCP server stays focused on authenticated tool execution while operational systems manage source quality, graph freshness, process lookups, ingestion, retrieval freshness, and usage governance.
Authenticated FastMCP endpoint exposing 25 legal, process, ingestion, PageIndex, and graph tools.
Client, token, job, upload, document, chunk, search, ingestion, and playground APIs.
Pub/Sub ingestion, embedding workers, source quality, retrieval freshness, and operational review flows.
Postgres documents, Qdrant vectors, FalkorDB legal graph, GCS raw files, Firestore clients, and usage events.
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 Postgres, Qdrant, FalkorDB, Firestore, DataJud, or ingestion services as needed.
04
Graph, PageIndex, source ingestion, and process consultation stay behind scoped tool contracts.
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, drafting workflow, contract review system, process-monitoring experience, IDE assistant, or internal operations console.
Call orchestration, area-scoped answers, deterministic risk scans, and drafting tools from product agents.
Give assistants grounded citations, literal source explanations, legal graph context, and human review signals.
Screen drafts, produce legal context, navigate parsed documents, and review generated legal documents.
Consult process histories, ingest new sources or files, and keep the retrieval corpus operationally managed.
name: Legal MCP Server
version: 0.2.0
schema: v1
mcpServers:
- name: Legal MCP
url: https://mcp.laweragent.com/mcp/
transport: streamable-http
headers:
Authorization: Bearer ${{ secrets.LEGAL_MCP_TOKEN }}Lawyer-agent workflow
Your product can call search_legal_sources or pageindex_navigate during drafting, run explain_legal_basis, answer_in_area, and assess_legal_risk during curation, then consult DataJud or graph tools when the matter needs procedural or normative history.
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
Ingestion: trigger public sources and upload local files for parsing
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, graph lookup, process consultation, ingestion, 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, graph context, and review signals.
03
Client integrations consume only approved MCP tools for RAG, graph lookup, process consultation, ingestion, drafting, and risk workflows.
04
Operational controls stay internal while approved ingestion tools route source updates through controlled admin services.
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.