SEI MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SEI MCP Serverconsultar processo 12345/2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🏛️ SEI MCP Server (Python) — Model Context Protocol for SEI WebServices v3.1+
An enterprise-grade Model Context Protocol (MCP) server built in Python that exposes the official SEI (Sistema Eletrônico de Informações) SOAP Web Services (SEI-WebServices-v3.1.pdf / sei.wsdl), SIP (Sistema de Permissões) Web Services, and External RH Web Services as 72 structured MCP tools for Google Cloud Gemini Enterprise, Claude Desktop, Cursor, and MCP Inspector.
✨ Key Features
Complete SEI v3.1+ Coverage (72 MCP Tools):
25 Process & Workflow (
Procedimentos) Tools:gerarProcedimento,consultarProcedimento,consultarProcedimentoIndividual,enviarProcesso,concluirProcesso,reabrirProcesso,sobrestarProcesso,removerSobrestamentoProcesso,anexarProcesso,desanexarProcesso,relacionarProcesso,removerRelacionamentoProcesso,atribuirProcesso,lancarAndamento,listarAndamentos,registrarAnotacao,bloquearProcesso,desbloquearProcesso,adicionarMarcador,removerMarcador,listarAndamentosMarcadores,definirControlePrazo,concluirControlePrazo,removerControlePrazo,listarExtensoesPermitidas.13 Document & File (
Documentos&Arquivos) Tools:incluirDocumento,consultarDocumento,cancelarDocumento,gerarBloco,adicionarArquivo,adicionarConteudoArquivo,listarHipotesesLegais,listarTiposConferencia,agendarPublicacao,alterarPublicacao,cancelarAgendamentoPublicacao,consultarPublicacao,enviarEmail.12 Signature, Meeting & Internal Block (
Blocos) Tools:incluirDocumentoBloco,retirarDocumentoBloco,incluirProcessoBloco,retirarProcessoBloco,disponibilizarBloco,cancelarDisponibilizacaoBloco,excluirBloco,reabrirBloco,devolverBloco,consultarBloco,listarBlocos,concluirBloco.17 Catalog & Parameter (
Parâmetros) Tools:listarUnidades,listarTiposProcedimento,listarSeries,listarContatos,atualizarContatos,listarUsuarios,listarPaises,listarEstados,listarCidades,listarCargos,listarFeriados,listarMarcadoresUnidade,definirMarcador,listarTiposPrioridade,confirmarDisponibilizacaoPublicacao,enviarNotificacaoPublicacao,SinalizarDocumento.3 SIP Permission (
SIP) Tools:sip_listarPermissao,sip_replicarPermissao,sip_replicarUsuario.1 External HR (
RH) Tool:rh_listarCargoFuncao.1 Diagnostic Tool:
get_system_info.
Dual-Transport HTTP Server (
StreamableHTTP&SSE) +stdio:POST /mcp: Modern MCP StreamableHTTP transport (used by Google Cloud Gemini Enterprise).GET /sse&POST /messages?sessionId=...: Legacy MCP Server-Sent Events (SSE) transport.--stdio: Standard input/output transport for local CLI / IDE agents.
Gemini Enterprise OAuth 2.0 Authentication & Discovery:
Exposes RFC 9728
GET /.well-known/oauth-protected-resourceand RFC 8414GET /.well-known/oauth-authorization-server.Allows unauthenticated MCP discovery handshakes (
initialize,notifications/initialized,ping,tools/list) so Gemini Enterprise's "Validate & Save" and "Reload custom actions" always succeed.Enforces Google OAuth 2.0 Bearer token validation (via
https://oauth2.googleapis.com/tokeninfo) and optionalOAUTH_CLIENT_IDaudience verification on alltools/calltool executions in production.
Official SEI SOAP 1.1 RPC/Encoded Integration:
Parses
sei-documentation/sei.wsdlto serialize all<wsdl:part>parameters in exact positional order as required by PHP'sSoapServer(controlador_ws.php?servico=sei).Handles
SOAP-ENC:Array(<item>elements),xsi:nil="true"optional fields, Base64 encoding, and MD5 checksum helpers forincluirDocumentoandadicionarArquivo.
Related MCP server: mcp-brasil
🏗️ System Architecture
flowchart LR
subgraph Clients["MCP Clients"]
GE["Google Cloud\nGemini Enterprise"]
IDE["Claude / Cursor /\nMCP Inspector"]
end
subgraph GCP["Google Cloud Platform (infra/ Terraform)"]
ALB["Global External HTTPS\nLoad Balancer + Static IP"]
NEG["Serverless NEG"]
CR["Cloud Run Service\n(sei-mcp-server Python)"]
end
subgraph GovEnv["SEI / SIP Environment"]
SEI["SEI SOAP WebService\n/sei/controlador_ws.php?servico=sei"]
SIP["SIP SOAP WebService\n/sip/controlador_ws.php?servico=wsdl"]
end
GE -- "StreamableHTTP (POST /mcp)\n+ OAuth 2.0 Bearer Token" --> ALB
IDE -- "SSE (/sse) or StreamableHTTP" --> ALB
ALB --> NEG --> CR
CR -- "SOAP 1.1 RPC/Encoded\n(SiglaSistema + IdentificacaoServico)" --> SEI
CR -- "SOAP 1.1 RPC/Encoded" --> SIP🔐 Authentication Architecture
This server implements two distinct authentication layers:
1. Inbound Authentication: Gemini Enterprise -> MCP Server (OAuth 2.0)
Following the Gemini Enterprise MCP specification (mirrored from sei-mcp-prodesp):
Endpoint / Method | Auth Requirement | Purpose |
| Public | Liveness & readiness probe |
| Public | RFC 9728 OAuth 2.0 Protected Resource Metadata |
| Public | RFC 8414 OAuth 2.0 Authorization Server Metadata |
| Public | Allows Gemini Enterprise to discover tools during connector registration |
| OAuth 2.0 Bearer Token | Validates Google OAuth 2.0 access token & |
In Production (
ENV=productionandOAUTH_ENABLED=true): Everytools/callinvocation must carryAuthorization: Bearer <google_access_token>.In Local Development (
ENV=developmentandOAUTH_ENABLED=false):tools/callcan be invoked without an OAuth token for rapid testing.
2. Outbound Authentication: MCP Server -> SEI Web Services (SEI-WebServices-v3.1.pdf)
Per the official SEI WebServices v3.1 Manual (sei-documentation/SEI-WebServices-v3.1.pdf, pages 5–8), every SOAP operation authenticates using:
SiglaSistema(SEI_SIGLA_SISTEMA): System acronym registered in SEI under Administração -> Sistemas -> Novo.IdentificacaoServico(SEI_IDENTIFICACAO_SERVICO): Either:The 72-character Access Key (
Chave de Acesso) generated in SEI (Administração -> Sistemas -> Serviços -> Chave de Acesso) — recommended by SEI v3.1+, ORThe plain-text service name (
Identificação) prefixed by its SHA-256 hash when authenticating against legacy SEI 3.0 services.
IP Whitelisting (
Servidores): In SEI under Administração -> Sistemas -> listar -> Serviços -> Servidores, register the outbound IP address (or CIDR mask) of the MCP server so SEI permits SOAP calls for the configured operations (Operações).IdUnidade(SEI_ID_UNIDADE): Default organizational unit ID automatically injected when not explicitly passed by the user in a tool call.
🧰 Complete Catalog of 72 MCP Tools
🩺 System & Diagnostics (1 Tool)
Tool Name | Description |
| Returns server status, configured SEI/SIP endpoints, default unit ID, and registered tool count. |
📁 Process & Workflow Tools — src/tools/processos.py (25 Tools)
Tool Name | SEI WSDL Operation | Description |
|
| Creates a new administrative process ( |
|
| Queries comprehensive metadata of a process (subjects, interested parties, units, open locations, related/annexed processes). |
|
| Queries individual process metadata in a specific context. |
|
| Forwards ( |
|
| Concludes ( |
|
| Reopens a previously concluded process in the specified unit. |
|
| Suspends ( |
|
| Removes the suspension ( |
|
| Annexes a subsidiary process ( |
|
| Detaches ( |
|
| Creates a bidirectional link ( |
|
| Removes a relationship link between two processes. |
|
| Assigns ( |
|
| Records a workflow progress entry ( |
|
| Lists workflow history entries ( |
|
| Registers or updates a unit note ( |
|
| Locks ( |
|
| Unlocks ( |
|
| Applies unit markers/tags ( |
|
| Removes unit markers/tags ( |
|
| Lists the history of marker changes on a process in the unit. |
|
| Sets a deadline ( |
|
| Marks a deadline control as completed on one or more processes. |
|
| Removes a deadline control from one or more processes. |
|
| Lists file extensions permitted for external document uploads in SEI. |
📄 Document & File Tools — src/tools/documentos.py (13 Tools)
Tool Name | SEI WSDL Operation | Description |
|
| Includes a generated ( |
|
| Queries document metadata, signatures, publication data, and view link ( |
|
| Cancels a document with justification ( |
|
| Creates a new Signature ( |
|
| Starts a chunked file upload ( |
|
| Appends a Base64 content chunk to an in-progress |
|
| Lists legal hypotheses ( |
|
| Lists authentication/certification types ( |
|
| Schedules a document for official publication ( |
|
| Modifies an existing publication schedule. |
|
| Cancels a scheduled document publication. |
|
| Queries publication details by publication ID, document ID, or protocol. |
|
| Sends an official email from within a process ( |
📦 Block, Catalog, SIP & RH Tools — src/tools/parametros.py (33 Tools)
Tool Name | Service / WSDL Operation | Description |
| SEI: | Adds a document to a signature ( |
| SEI: | Removes a document from a block. |
| SEI: | Adds a process ( |
| SEI: | Removes a process from a block. |
| SEI: | Makes a block available ( |
| SEI: | Cancels the availability of a block. |
| SEI: | Deletes one or more blocks ( |
| SEI: | Reopens a concluded block. |
| SEI: | Returns ( |
| SEI: | Queries details of a block and optionally lists its protocols ( |
| SEI: | Lists blocks filtered by type ( |
| SEI: | Concludes one or more blocks. |
| SEI: | Lists organizational units ( |
| SEI: | Lists process types ( |
| SEI: | Lists document types ( |
| SEI: | Searches contacts ( |
| SEI: | Creates ( |
| SEI: | Lists users with permission in the unit. |
| SEI: | Lists countries ( |
| SEI: | Lists states/provinces ( |
| SEI: | Lists cities ( |
| SEI: | Lists official titles/positions ( |
| SEI: | Lists holidays ( |
| SEI: | Lists markers ( |
| SEI: | Creates or updates unit marker definitions ( |
| SEI: | Lists priority types ( |
| SEI: | Confirms publication availability in an external publication vehicle. |
| SEI: | Sends a publication notification in SEI. |
| SEI: | Applies visual flags/signals ( |
| SIP: | Queries permissions registered in SIP (Sistema de Permissões). |
| SIP: | Replicates permissions in SIP across users/units. |
| SIP: | Replicates/synchronizes user records in SIP ( |
| RH: | Queries job titles/functions ( |
🚀 Quickstart (Local Development)
1. Clone & Configure Environment
cp .env.example .envEdit .env with your SEI credentials:
PORT=3000
HOST=0.0.0.0
ENV=development
OAUTH_ENABLED=false
# SEI SOAP WebService Configuration
SEI_WS_URL=https://sei.orgao.gov.br/sei/controlador_ws.php?servico=sei
SEI_SIGLA_SISTEMA=MCP_GEMINI
SEI_IDENTIFICACAO_SERVICO=<72-character-chave-de-acesso>
SEI_ID_UNIDADE=110000958
SEI_VERIFY_SSL=true
SEI_TIMEOUT_SECONDS=60
# Optional SIP & RH WebService URLs
SIP_WS_URL=https://sei.orgao.gov.br/sip/controlador_ws.php?servico=wsdl
RH_WS_URL=2. Install Dependencies (Optional if system packages are present)
pip install -r requirements.txt3. Run the Server
# Start Dual-Transport HTTP Server (StreamableHTTP /mcp + SSE /sse)
python3 -m src.server
# Or run over stdio transport for local CLI clients
python3 -m src.server --stdio4. Run Unit & cURL Integration Tests
# Run Python unit test suite (WSDL parser, SOAP serializer, MCP JSON-RPC, OAuth 2.0)
python3 -m unittest discover -s tests -v
# Run automated 13-test cURL suite against a running server
./scripts/test-mcp-curl.sh --url http://localhost:3000☁️ Deploying to Google Cloud Run with Terraform
Step 1: Build and Push Container Image via Cloud Build
gcloud builds submit --config=cloudbuild.yaml --project=YOUR_GCP_PROJECT_IDStep 2: Provision Cloud Run + Global HTTPS Load Balancer with Terraform
The infra/ directory provisions:
Google Cloud APIs (
run.googleapis.com,compute.googleapis.com)Cloud Run v2 Service running
sei-mcp-serverGlobal Static IP Address + Google-Managed SSL Certificate
Global External Application Load Balancer + Serverless NEG
cd infra
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your project_id, domain, and SEI credentials
terraform init
terraform plan
terraform applySee infra/README.md for detailed DNS and SSL certificate provisioning instructions.
🤖 Connecting to Google Cloud Gemini Enterprise
Open the Google Cloud Console -> Gemini Enterprise -> Extensions / Custom Actions (MCP).
Click Add MCP Server and configure:
Server URL:
https://<YOUR_LOAD_BALANCER_DOMAIN>/mcpTransport:
Streamable HTTPAuthentication:
OAuth 2.0Client ID: Matches
OAUTH_CLIENT_IDconfigured on Cloud RunClient Secret: Your Google OAuth 2.0 Client Secret
Authorization URL:
https://accounts.google.com/o/oauth2/v2/authToken URL:
https://oauth2.googleapis.com/tokenScopes:
openid email profile
Click Validate & Save. Gemini Enterprise will perform an unauthenticated
initializeandtools/listhandshake to discover all 72 SEI tools, and will attach the end-user's OAuth 2.0 Bearer token on everytools/callexecution.
📂 Project Structure
sei-mcp/
├── src/
│ ├── __init__.py
│ ├── config.py # Environment & SEI/OAuth configuration loader
│ ├── auth.py # Google OAuth 2.0 token verifier & MCP discovery bypass
│ ├── mcp_server.py # JSON-RPC 2.0 MCP router (initialize, tools/list, tools/call)
│ ├── server.py # Dual-transport HTTP server (/mcp, /sse, /messages, /health)
│ ├── client/
│ │ ├── __init__.py
│ │ └── sei_client.py # WSDL parser & SOAP 1.1 RPC/Encoded client for SEI/SIP/RH
│ └── tools/
│ ├── __init__.py # Registers all 72 MCP tools
│ ├── processos.py # 25 Process & workflow tools
│ ├── documentos.py # 13 Document, file upload, publication & email tools
│ └── parametros.py # 12 Block tools + 17 Catalog tools + 3 SIP + 1 RH tool
├── tests/
│ ├── test_wsdl_and_soap.py # Unit tests for WSDL parsing & SOAP 1.1 serialization
│ └── test_mcp_server.py # Unit tests for MCP JSON-RPC & OAuth 2.0 middleware
├── scripts/
│ └── test-mcp-curl.sh # Automated 13-test cURL test suite (/health, /mcp, /sse)
├── infra/ # Terraform IaC (Cloud Run v2 + Global HTTPS Load Balancer)
├── sei-documentation/ # Official SEI WebServices v3.1 PDF manual & sei.wsdl
├── Dockerfile # Production Python 3.12 Slim container image
├── cloudbuild.yaml # Google Cloud Build pipeline
├── pyproject.toml # Python packaging & pytest/ruff/mypy configuration
└── requirements.txt # Pinned Python dependencies📄 License
Licensed under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any AI agent to 1,000+ apps and 27,000+ actions through one remote MCP server (OAuth).
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceBridges AI agents to the Brazilian SEI system, enabling listing processes, reading documents, searching, and downloading files via session cookies.2ISC
- AlicenseAqualityDmaintenanceMCP Server for accessing 36 Brazilian public data sources and 1 agent, enabling AI agents to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables automation of the SEI! (Sistema Eletrônico de Informações) system via Claude Code, supporting login, process search, document download/creation/signing, and forwarding through natural language commands.1 npm6MIT
- AlicenseBqualityCmaintenanceMCP Server do SEI Pro para o SEI (Sistema Eletrônico de Informações) via API REST mod-wssei v2 + scraper do frontend web (modo híbrido).10018MIT