0xAI logo
0xAI
Products / Legal MCP

Legal AI infrastructure exposed as production MCP tools.

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

Endpointhttps://mcp.laweragent.com/mcp/
TransportMCP-compatible streamable HTTP
AuthenticationAuthorization: Bearer <client_token>
Unauthenticated probes/health, /healthz, /readyz, /livez

25

MCP tools

Scoped

authenticated access

Graph + RAG

Brazilian legal knowledge retrieval

DataJud

process lookup and movement interpretation

Product surface

A legal intelligence layer for serious integrations.

The platform packages retrieval, legal graph intelligence, process lookup, ingestion, generation, authentication, token governance, and usage telemetry behind a single MCP interface.

Grounded legal answers and orchestration

Answer PT-BR legal questions with citations, area-specific specialists, triage, risk flags, and lawyer review signals.

Contracts, drafting, and PageIndex

Extract clauses, validate completeness, generate drafts, return drafting context, and navigate parsed legal-document trees.

Process and ingestion operations

Consult CNJ/DataJud process history, enrich with public communications, and queue source or local-document ingestion.

Legal graph intelligence

Query provisions and relations, trace normative history, check provision status, validate hierarchy, and inspect graph stats.

Quickstart

Authenticate once, then call any scoped legal tool.

Every request is attributed to a client token. The MCP server validates issuer, audience, expiry, signature, and revocation status before a tool runs.

01

Create a client

A backoffice operator creates an MCP client and assigns the exact tool scopes the integration needs.

02

Issue a token

The admin API issues a scoped client token. The raw token is displayed once, then only metadata is retained.

03

Call /mcp/

Your app sends MCP tool calls over authenticated HTTP with Authorization: Bearer <token>.

04

Monitor and revoke

Usage is attributed by client and token id. Revoked tokens are rejected by the server within 60 seconds.

curl
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
      }
    }
  }'
python
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

Subscribe and receive your Legal MCP client token.

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

US$0.03per 1,000 tokens

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

Twenty-five tools across retrieval, graph intelligence, process lookup, ingestion, analysis, drafting, triage, and risk review.

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.

Search and answers

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

Contracts and documents

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

Workflow and risk

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

Process tracking

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

Ingestion and corpus

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

Legal graph

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

Backed by the storage and worker model needed for legal-grade retrieval.

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.

MCP server

Authenticated FastMCP endpoint exposing 25 legal, process, ingestion, PageIndex, and graph tools.

Admin API

Client, token, job, upload, document, chunk, search, ingestion, and playground APIs.

Knowledge operations

Pub/Sub ingestion, embedding workers, source quality, retrieval freshness, and operational review flows.

Knowledge and graph layer

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

Scoped client tokens with revocation and usage attribution.

Tokens are minted by legal-admin-api, persisted only as metadata, and rejected if expired, mis-scoped, unknown, or revoked.

Current full scope set

search_legal_sourcesget_law_articlecheck_contract_risksvalidate_contract_completenessget_clause_recommendationexplain_legal_basisrequest_source_ingestioningest_local_documentanswer_legal_questionconsultar_processolegal_orchestrateclassify_legal_caseanswer_in_areadraft_legal_documentanalyze_legal_documentassess_legal_riskreview_legal_documentpageindex_navigateget_drafting_contextquery_legal_graphtrace_normative_historycheck_provision_statusfind_related_provisionsvalidate_normative_hierarchyget_legal_graph_stats
token claims
{
  "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

Built for teams embedding legal intelligence into real product workflows.

Legal MCP can sit behind a chat product, drafting workflow, contract review system, process-monitoring experience, IDE assistant, or internal operations console.

Agent and product workflows

Call orchestration, area-scoped answers, deterministic risk scans, and drafting tools from product agents.

Grounded legal copilots

Give assistants grounded citations, literal source explanations, legal graph context, and human review signals.

Contract and drafting operations

Screen drafts, produce legal context, navigate parsed documents, and review generated legal documents.

Case and corpus operations

Consult process histories, ingest new sources or files, and keep the retrieval corpus operationally managed.

continue ide
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

Operators control clients, tokens, search, jobs, uploads, and usage.

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

Curated legal knowledge behind the MCP endpoint.

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

The daily control plane for production legal integrations.

Common operations stay explicit: issue, revoke, retry, inspect, and rotate with a clear owner path.

Issue tokens from backoffice

Create clients at /clients, issue a token, and copy the raw credential immediately.

Review operational events

Use the operations board to inspect processing status and retry controlled jobs.

Revoke leaked credentials

Delete the token by id. Revocation is observed by the MCP server cache.

Track usage

Read per-client totals, monthly breakdowns, and per-tool usage from the usage card.

Build with 0xAI

Bring Legal MCP into your product workflow.

0xAI can help scope token governance, tool access, knowledge coverage, and the integration path for your app or agent workflow.