npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

epa-testemcp

v0.1.2

Published

EPA MCP Server

Readme

EPA MCP

Servidor MCP (Model Context Protocol) para integracao do sistema EPA com modelos de linguagem (LLMs).

Este projeto permite que assistentes de IA interajam com o EPA por meio de ferramentas estruturadas. O objetivo e permitir que usuarios utilizem linguagem natural para operar o sistema EPA.

Arquitetura

Fluxo principal:

Tool -> Service -> API Client -> EPA API

Camadas:

  • CLI: interface de execucao local
  • Server: servidor MCP
  • Tools: ferramentas expostas ao agente
  • Services: regras de negocio
  • API Client: comunicacao com a API do EPA

Estrutura do projeto

src/
  agent/
  api/
  cli/
  config/
  core/
  services/
  tools/
  tests/
  utils/

Tools implementadas

Solicitacoes:

  • requests.list
  • requests.view
  • requests.create

Dados auxiliares:

  • requests.types
  • requests.services
  • requests.priorities
  • requests.assignees
  • requests.clients
  • requests.units

Analitico:

  • analytics.teamReport

Endpoints reais configurados

  • requests.types
    • GET /epa_os/ajax.php
    • Query params: action=get, controller=TipoSolicitacao
  • requests.priorities
    • GET /api/api/prioridade
  • requests.assignees
    • GET /api/api/usuarios/search
    • Query params obrigatorios: term, _type=query, q
    • Filtro opcional preparado: filters[unidade_gerencial][type]=pertenco e filters[unidade_gerencial][value]=<id>

requests.list (filtros recomendados)

  • assignee_id (opcional): ID do responsavel
  • assignee_name (opcional): nome/login (ex: suporte.simeon)
  • period (opcional): current_year (padrao) ou last_12_months

Exemplo para "listar as solicitacoes do usuario suporte.simeon do ultimo ano":

{
  "assignee_name": "suporte.simeon",
  "period": "last_12_months"
}

Instalacao

npm install

Configuracao

Para clientes MCP (ex: Claude Desktop), configure as variaveis de ambiente:

  • epaApiUrl (ou EPA_API_URL)
  • epaApiToken (ou EPA_API_TOKEN)
  • epaApiTimeoutMs (ou EPA_API_TIMEOUT_MS, opcional)

Opcionalmente, voce pode usar arquivo local config/config.json.

Para uso da CLI, voce tambem pode executar o setup:

npm run dev setup

Esse comando configura a URL da API. Para login/token EPA da CLI:

npm run dev login

Os dados sao salvos em .env (se existir) ou config/config.json.

Arquivos de configuracao usados:

config/config.json

Execucao

Iniciar MCP Server em desenvolvimento:

npm run dev server

Iniciar agente OpenAI conectado ao MCP (CLI):

npm run dev agent

Ao iniciar o agent, a CLI valida se URL/token EPA estao configurados e se o token ainda e valido. Se estiver ausente/invalido, ela solicita login e senha para gerar novo token automaticamente.

No Windows (PowerShell com policy restritiva), use:

npm.cmd run dev agent

Se o ambiente bloquear spawn (erro EPERM, comum em ambientes restritos), use:

npm run build
node dist/cli/index.js agent

Build de producao:

npm run build

Executar CLI compilada:

npm run start -- server

Testes

npm test

Uso do Agent CLI

  1. Instale dependencias:
npm install
  1. Configure credenciais:
npm run dev setup
npm run dev login

No fluxo de login da CLI, informe:

  • login EPA
  • senha EPA
  • OpenAI API KEY (somente para CLI/agent, se ainda nao estiver definida)
  1. Inicie o agent:
npm run dev agent
  1. Interaja no terminal com linguagem natural. Exemplos:
  • liste minhas solicitações
  • quais são os tipos disponíveis?
  • crie uma solicitação para ...

O agent escolhe e executa automaticamente as tools MCP (requests.list, requests.types, requests.create, etc.) conforme o contexto da conversa.

Observacao de contexto:

  • O agent usa janela deslizante para limitar o historico enviado ao modelo.
  • Valor padrao: 30 mensagens nao-system.
  • Para ajustar: defina a variavel AGENT_MAX_CONTEXT_MESSAGES.

Uso com Claude Desktop

Local (sem publicar no npm)

  1. Gere o build:
npm run build
  1. Configure o claude_desktop_config.json para executar o entrypoint MCP direto:
{
  "mcpServers": {
    "epa-local": {
      "command": "node",
      "args": [
        "C:\\Users\\renat\\OneDrive\\Documentos\\projetos\\epa_mcp\\dist\\server\\stdioServer.js"
      ],
      "env": {
        "epaApiUrl": "https://dev.sysepa.com.br/epa",
        "epaApiToken": "SEU_TOKEN",
        "epaApiTimeoutMs": "15000"
      }
    }
  }
}
  1. Reinicie o Claude Desktop.

Publicado no npm

npx epa-mcp

CLI como extra (opcional):

npx epa-mcp-cli setup
npx epa-mcp-cli agent

Observacoes

  • Os textos de prompt e mensagens do projeto permanecem em portugues.
  • Os identificadores tecnicos (arquivos, diretorios, classes e nomes de tools) seguem padrao em ingles.