Skip to main content
Glama

pje_configurar

Configure connection settings for the Brazilian Electronic Judicial Process (PJE) system to enable API access and judicial data integration.

Instructions

Configura a conexão com o PJE

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlYesURL base da API do PJE
appNameNoNome da aplicação

Implementation Reference

  • Main handler function that configures the PJEClient with provided arguments, attempts certificate authentication (hardcoded thumbprint/password), falls back to SSO or public access, and returns formatted status text.
    private async configurarPJE(args: any) {
      const config: PJEConfig = {
        baseUrl: args.baseUrl || process.env.PJE_BASE_URL || "https://pje.tjce.jus.br",
        appName: args.appName || process.env.PJE_APP_NAME || "pje-tjce-1g",
        ssoUrl: args.ssoUrl || process.env.PJE_SSO_URL,
        clientId: args.clientId || process.env.PJE_CLIENT_ID,
        clientSecret: args.clientSecret || process.env.PJE_CLIENT_SECRET,
        username: args.username || process.env.PJE_USERNAME,
        password: args.password || process.env.PJE_PASSWORD,
      };
      
      const certificateConfig: CertificateConfig = {
        certificateThumbprint: '7db4b6cc9de4785944bcf1c8f3cde03355733b84',
        certificatePassword: '123456'
      };
    
      this.pjeClient = new PJEClient(config);
    
      if (certificateConfig) {
        try {
          await this.pjeClient.initializeCertificate();
          try {
            await this.pjeClient.authenticateWithCertificate();
            return {
              content: [
                {
                  type: "text",
                  text: `✅ PJE configurado com sucesso!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Autenticação: 🔐 Certificado Digital\n\n✅ **Pronto para usar todas as funcionalidades!**`,
                },
              ],
            };
          } catch (authError) {
            return {
              content: [
                {
                  type: "text",
                  text: `⚠️ PJE configurado com certificado!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Certificado: ✅ Carregado\n- Autenticação: ⚠️ Falha na autenticação\n\n**Erro:** ${authError instanceof Error ? authError.message : String(authError)}`,
                },
              ],
            };
          }
        } catch (certError) {
          return {
            content: [
              {
                type: "text",
                text: `❌ PJE configurado sem certificado!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Certificado: ❌ Erro ao carregar\n\n**Erro:** ${certError instanceof Error ? certError.message : String(certError)}`,
              },
            ],
          };
        }
      }
    
      if (config.ssoUrl && config.clientId && config.clientSecret && config.username && config.password) {
        try {
          await this.pjeClient.authenticate();
          return {
            content: [
              {
                type: "text",
                text: `✅ PJE configurado com sucesso!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Autenticação: ✅ SSO autenticado\n\n✅ **Pronto para usar todas as funcionalidades!**`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `⚠️ PJE configurado com erro na autenticação!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Autenticação: ❌ Falha no SSO\n\n❌ **Erro:** ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    
      return {
        content: [
          {
            type: "text",
            text: `✅ PJE configurado!\n\n🎯 **Configuração:**\n- URL: ${config.baseUrl}\n- App: ${config.appName}\n- Autenticação: ⚠️ Apenas consultas públicas\n\n💡 **Para funcionalidades completas:**\nConfigure certificado digital ou credenciais no arquivo .env`,
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema requiring baseUrl.
    {
      name: "pje_configurar",
      description: "Configura a conexão com o PJE",
      inputSchema: {
        type: "object",
        properties: {
          baseUrl: { type: "string", description: "URL base da API do PJE" },
          appName: { type: "string", description: "Nome da aplicação" },
        },
        required: ["baseUrl"],
      },
    },
  • src/index.ts:328-330 (registration)
    Registration of the tool handler in the CallToolRequest switch statement, dispatching to configurarPJE method.
    switch (request.params.name) {
      case "pje_configurar":
        return await this.configurarPJE(request.params.arguments);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chapirousIA/pje-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server