pdc-mcp 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -95,7 +95,8 @@ está logado no painel) e repita o pedido. O token fica em
95
95
  | `pdc_preflight` | Checagem pré-deploy: build, compose, env vazias (`ready`) |
96
96
  | `pdc_deploy` | Dispara o deploy de um ambiente |
97
97
  | `pdc_deployment_status` | Status + timeline + logs de um deployment |
98
- | `pdc_runtime_logs` | Saúde/logs do container (diagnóstico de crash) |
98
+ | `pdc_runtime_logs` | Saúde/logs do container público (diagnóstico de crash) |
99
+ | `pdc_service_logs` | Serviços da stack Compose (estado/health) + log por-serviço — pra achar quem travou um deploy compose (ex.: `migrate`/`minio-init`) |
99
100
  | `pdc_restart` / `pdc_stop` | Controle do app (com confirmação do usuário) |
100
101
 
101
102
  ## Prompts guiados
package/dist/index.js CHANGED
@@ -29533,6 +29533,12 @@ class PdcApi {
29533
29533
  getRuntimeLogs(environmentId) {
29534
29534
  return this.client.get(`/api/project-environments/${environmentId}/runtime-logs`);
29535
29535
  }
29536
+ getServices(environmentId) {
29537
+ return this.client.get(`/api/project-environments/${environmentId}/services`);
29538
+ }
29539
+ getServiceLogs(environmentId, service) {
29540
+ return this.client.get(`/api/project-environments/${environmentId}/services/${encodeURIComponent(service)}/logs`);
29541
+ }
29536
29542
  restartEnvironment(environmentId) {
29537
29543
  return this.client.post(`/api/project-environments/${environmentId}/restart`);
29538
29544
  }
@@ -29712,9 +29718,45 @@ class PdcSession {
29712
29718
  return await loadToken(this.opts.baseUrl, this.opts.configDir) != null;
29713
29719
  }
29714
29720
  }
29721
+ // package.json
29722
+ var package_default = {
29723
+ name: "pdc-mcp",
29724
+ version: "0.5.1",
29725
+ description: "Servidor MCP do PDC Deploy — opere o PDC (criar projetos, deployar, acompanhar builds) pelo seu agente de IA, com login por device code e segredos fora do chat.",
29726
+ type: "module",
29727
+ bin: { "pdc-mcp": "dist/index.js" },
29728
+ files: ["dist/index.js", "README.md", "LICENSE"],
29729
+ engines: { node: ">=18" },
29730
+ publishConfig: { access: "public" },
29731
+ scripts: {
29732
+ build: "bun build src/index.ts --target=node --outfile dist/index.js",
29733
+ prepublishOnly: "bun run build"
29734
+ },
29735
+ keywords: [
29736
+ "mcp",
29737
+ "model-context-protocol",
29738
+ "pdc",
29739
+ "deploy",
29740
+ "coolify",
29741
+ "claude",
29742
+ "cursor"
29743
+ ],
29744
+ license: "MIT",
29745
+ repository: {
29746
+ type: "git",
29747
+ url: "git+https://github.com/pdc-deploy/pdc-mcp.git",
29748
+ directory: "packages/mcp"
29749
+ },
29750
+ homepage: "https://projetos.ltap.ifce.edu.br/docs",
29751
+ devDependencies: {
29752
+ "@modelcontextprotocol/sdk": "^1.29.0",
29753
+ "@pdc/core": "*",
29754
+ zod: "^4.4.3"
29755
+ }
29756
+ };
29715
29757
 
29716
29758
  // src/version.ts
29717
- var MCP_VERSION = "0.4.1";
29759
+ var MCP_VERSION = package_default.version;
29718
29760
 
29719
29761
  // src/update.ts
29720
29762
  var REGISTRY_URL = "https://registry.npmjs.org/pdc-mcp/latest";
@@ -29734,10 +29776,11 @@ function updateBanner(info) {
29734
29776
  return null;
29735
29777
  return `⬆️ O PDC Deploy MCP tem uma atualização disponível: ${info.current} → ${info.latest}. ` + `Se você o instalou globalmente, rode \`npm i -g pdc-mcp@latest\`; ` + `se ele roda via npx (\`npx -y pdc-mcp\`), reinicie a sessão do agente para pegar a última. ` + `Novidades em ${DOCS_URL}.`;
29736
29778
  }
29779
+ var CACHE_TTL_MS = 10 * 60 * 1000;
29737
29780
  var cached2 = null;
29738
- async function checkForUpdate(fetchImpl = fetch) {
29739
- if (cached2)
29740
- return cached2;
29781
+ async function checkForUpdate(fetchImpl = fetch, opts = {}) {
29782
+ if (!opts.force && cached2 && Date.now() - cached2.at < CACHE_TTL_MS)
29783
+ return cached2.info;
29741
29784
  const current = MCP_VERSION;
29742
29785
  try {
29743
29786
  const r = await fetchImpl(REGISTRY_URL, { headers: { accept: "application/json" } });
@@ -29745,11 +29788,12 @@ async function checkForUpdate(fetchImpl = fetch) {
29745
29788
  throw new Error(`registry ${r.status}`);
29746
29789
  const data = await r.json();
29747
29790
  const latest = typeof data.version === "string" ? data.version : null;
29748
- cached2 = { current, latest, updateAvailable: !!latest && compareVersions(latest, current) > 0 };
29791
+ const info = { current, latest, updateAvailable: !!latest && compareVersions(latest, current) > 0 };
29792
+ cached2 = { at: Date.now(), info };
29793
+ return info;
29749
29794
  } catch {
29750
- cached2 = { current, latest: null, updateAvailable: false };
29795
+ return { current, latest: null, updateAvailable: false };
29751
29796
  }
29752
- return cached2;
29753
29797
  }
29754
29798
 
29755
29799
  // src/server.ts
@@ -29815,7 +29859,7 @@ function createPdcMcpServer(opts) {
29815
29859
  description: "Verifica no npm se há uma versão mais nova do PDC Deploy MCP e informa como atualizar. " + "Devolve { current, latest, updateAvailable }. Chame no INÍCIO da sessão; se updateAvailable=true, " + "avise o usuário com a instrução de atualização (é como os MCPs se mantêm atualizados).",
29816
29860
  inputSchema: {}
29817
29861
  }, () => run(async () => {
29818
- const info = await checkForUpdate();
29862
+ const info = await checkForUpdate(fetch, { force: true });
29819
29863
  return { ...info, message: updateBanner(info) ?? `Você está na última versão (${info.current}).` };
29820
29864
  }));
29821
29865
  server.registerTool("pdc_list_orgs", {
@@ -30160,6 +30204,35 @@ function createPdcMcpServer(opts) {
30160
30204
  status: r.status,
30161
30205
  configured: r.configured,
30162
30206
  lastLogLines: r.logs.split(`
30207
+ `).filter(Boolean).slice(-40)
30208
+ };
30209
+ }));
30210
+ server.registerTool("pdc_service_logs", {
30211
+ description: "Logs e estado dos SERVIÇOS de uma stack Docker Compose (postgres, migrate, minio-init, api, web…). " + "Sem `service`: lista todos os serviços com estado/health (use pra achar o que travou). Com `service`: " + "traz as últimas linhas do log daquele serviço. Use quando um deploy compose falhou/travou e o " + "`pdc_runtime_logs` (só o container público) não basta — ex.: um init/migração que não completa " + "bloqueia o resto. Interprete o log e explique a causa (comando errado, banco inacessível, " + "restart-loop de serviço one-shot etc.).",
30212
+ inputSchema: { projectEnvironmentId: exports_external.string(), service: exports_external.string().optional() }
30213
+ }, ({ projectEnvironmentId, service }) => run(async () => {
30214
+ const a = await api2();
30215
+ if (!service) {
30216
+ const r2 = await a.getServices(projectEnvironmentId);
30217
+ if (!r2.configured) {
30218
+ return { configured: false, hint: "Observabilidade de runtime indisponível neste ambiente." };
30219
+ }
30220
+ return {
30221
+ configured: true,
30222
+ services: r2.services.map((s) => ({
30223
+ service: s.service,
30224
+ state: s.state,
30225
+ health: s.health,
30226
+ status: s.status
30227
+ })),
30228
+ hint: "Chame de novo com `service` pra ver o log do serviço suspeito (state restarting/exited)."
30229
+ };
30230
+ }
30231
+ const r = await a.getServiceLogs(projectEnvironmentId, service);
30232
+ return {
30233
+ configured: r.configured,
30234
+ service,
30235
+ lastLogLines: r.logs.split(`
30163
30236
  `).filter(Boolean).slice(-40)
30164
30237
  };
30165
30238
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdc-mcp",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Servidor MCP do PDC Deploy — opere o PDC (criar projetos, deployar, acompanhar builds) pelo seu agente de IA, com login por device code e segredos fora do chat.",
5
5
  "type": "module",
6
6
  "bin": { "pdc-mcp": "dist/index.js" },