# chapirousia/pje-mcp-server architecture

> Architecture diagram of the GitHub repository chapirousia/pje-mcp-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chapirousia/pje-mcp-server
- Repository: https://github.com/chapirousia/pje-mcp-server

## Overview

PJE MCP Server exposes judicial-process queries through Claude Desktop and a separate web interface for process lookup and PDF-based petition submission. The MCP server configures tribunal access, handles certificate or SSO authentication, dispatches tools, and queries process and judicial-catalog endpoints. The web workflow extracts process metadata from uploaded PDFs before submitting petitions through its PJE client; that client’s sampled implementation currently simulates authentication, lookup, and petitioning. README capabilities include process filters, tribunal catalogs, certificate management, and multi-tribunal access; unsampled capabilities are shown only where documented.

Main entry points: [`src/index.ts`](https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts) (MCP tool server), [`src/web-server.ts`](https://github.com/chapirousia/pje-mcp-server/blob/main/src/web-server.ts) (Web interface), [`src/pje-client.ts`](https://github.com/chapirousia/pje-mcp-server/blob/main/src/pje-client.ts) (PJE client), [`src/certificate-manager.ts`](https://github.com/chapirousia/pje-mcp-server/blob/main/src/certificate-manager.ts) (Certificate manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_mcp["MCP tool server<br/>[index.ts]"]
  node_web["Web interface<br/>[web-server.ts]"]
end

subgraph group_pje_access["PJE access"]
  node_pje_client["PJE client<br/>[pje-client.ts]"]
  node_process_queries["Process queries<br/>[index.ts]"]
  node_judicial_catalogs["Judicial catalogs<br/>[index.ts]"]
  node_process_types["Process data types<br/>[types.ts]"]
end

subgraph group_document_workflow["Petition workflow"]
  node_pdf_extract["PDF metadata extraction<br/>[pdf-processor.ts]"]
  node_petition_submission["Petition submission<br/>[pje-client.ts]"]
end

subgraph group_certificate["Certificate handling"]
  node_cert_manager["Certificate manager"]
end

node_claude(("Claude Desktop"))
node_web_user(("Web user"))
node_pje_api["PJE tribunal API"]
node_sso["SSO provider"]

node_claude -->|"invokes tools"| node_mcp
node_mcp -->|"dispatches queries"| node_process_queries
node_process_queries -->|"queries processes"| node_pje_api
node_mcp -->|"dispatches lookups"| node_judicial_catalogs
node_judicial_catalogs -->|"fetches catalogs"| node_pje_api
node_mcp -->|"initializes certificate"| node_cert_manager
node_mcp -->|"authenticates"| node_sso
node_web_user -->|"submits requests"| node_web
node_web -->|"configures and calls"| node_pje_client
node_web -->|"extracts PDF metadata"| node_pdf_extract
node_web -->|"submits petitions"| node_petition_submission
node_pje_client -->|"initializes certificate"| node_cert_manager
node_pje_client -.->|"would access tribunal"| node_pje_api
node_process_queries -.->|"uses data model"| node_process_types

click node_mcp "https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts"
click node_web "https://github.com/chapirousia/pje-mcp-server/blob/main/src/web-server.ts"
click node_pje_client "https://github.com/chapirousia/pje-mcp-server/blob/main/src/pje-client.ts"
click node_process_queries "https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts"
click node_judicial_catalogs "https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts"
click node_pdf_extract "https://github.com/chapirousia/pje-mcp-server/blob/main/src/pdf-processor.ts"
click node_petition_submission "https://github.com/chapirousia/pje-mcp-server/blob/main/src/pje-client.ts"
click node_cert_manager "https://github.com/chapirousia/pje-mcp-server/blob/main/src/certificate-manager.ts"
click node_process_types "https://github.com/chapirousia/pje-mcp-server/blob/main/src/types.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp,node_web,node_web_user toneBlue
class node_pje_client,node_process_queries,node_judicial_catalogs,node_process_types toneAmber
class node_pdf_extract,node_petition_submission,node_pje_api toneMint
class node_cert_manager toneRose
class node_claude,node_sso toneIndigo
```

## Components

### User interfaces

- [MCP tool server](https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts): `src/index.ts`
- [Web interface](https://github.com/chapirousia/pje-mcp-server/blob/main/src/web-server.ts): `src/web-server.ts`

### PJE access

- [PJE client](https://github.com/chapirousia/pje-mcp-server/blob/main/src/pje-client.ts): `src/pje-client.ts`
- [Process queries](https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts): `src/index.ts`
- [Judicial catalogs](https://github.com/chapirousia/pje-mcp-server/blob/main/src/index.ts): `src/index.ts`
- [Process data types](https://github.com/chapirousia/pje-mcp-server/blob/main/src/types.ts): `src/types.ts`

### Petition workflow

- [PDF metadata extraction](https://github.com/chapirousia/pje-mcp-server/blob/main/src/pdf-processor.ts): `src/pdf-processor.ts`
- [Petition submission](https://github.com/chapirousia/pje-mcp-server/blob/main/src/pje-client.ts): `src/pje-client.ts`

### Certificate handling

- [Certificate manager](https://github.com/chapirousia/pje-mcp-server/blob/main/src/certificate-manager.ts): `src/certificate-manager.ts`

### Other components

- **Claude Desktop**
- **Web user**
- **PJE tribunal API**
- **SSO provider**

## Connections

- Claude Desktop → MCP tool server: invokes tools (evidence: `README.md`)
- MCP tool server → Process queries: dispatches queries (evidence: `src/index.ts`)
- Process queries → PJE tribunal API: queries processes (evidence: `src/index.ts`)
- MCP tool server → Judicial catalogs: dispatches lookups (evidence: `src/index.ts`)
- Judicial catalogs → PJE tribunal API: fetches catalogs (evidence: `src/index.ts`)
- MCP tool server → Certificate manager: initializes certificate (evidence: `src/index.ts`)
- MCP tool server → SSO provider: authenticates (evidence: `src/index.ts`)
- Web user → Web interface: submits requests (evidence: `src/web-server.ts`)
- Web interface → PJE client: configures and calls (evidence: `src/web-server.ts`)
- Web interface → PDF metadata extraction: extracts PDF metadata (evidence: `src/web-server.ts`)
- Web interface → Petition submission: submits petitions (evidence: `src/web-server.ts`)
- PJE client → Certificate manager: initializes certificate (evidence: `src/pje-client.ts`)
- PJE client → PJE tribunal API: would access tribunal
- Process queries → Process data types: uses data model
