@debugg-ai/debugg-ai-mcp 3.3.0 → 3.4.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to the DebuggAI MCP project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.4.0]
9
+
10
+ ### Added — MCP Resources (browse projects / environments / executions)
11
+
12
+ The server now declares the `resources` capability and exposes the read-only
13
+ entities as addressable resources, so clients can browse and @-mention them as
14
+ context instead of only calling tools:
15
+
16
+ - **Collections** (`resources/list`): `debugg-ai://projects`, `debugg-ai://environments`, `debugg-ai://executions`
17
+ - **Templates** (`resources/templates/list`): `debugg-ai://project/{uuid}`, `debugg-ai://environment/{uuid}`, `debugg-ai://execution/{uuid}`
18
+ - **`resources/read`** dispatches each URI to the same entity handler the tools
19
+ use — identical data + auth, no drift — and returns the JSON payload.
20
+
21
+ Additive: clients without resource support keep using the tools unchanged.
22
+ Implementation in `handlers/resourcesHandler.ts`.
23
+
8
24
  ## [3.3.0]
9
25
 
10
26
  ### Added — Run artifacts returned as resource links
package/README.md CHANGED
@@ -158,6 +158,24 @@ Every filter-mode response is paginated. Response shape:
158
158
 
159
159
  Pass optional `page` (1-indexed, default 1) and `pageSize` (default 20, max 200; oversized values are clamped). No response is ever silently truncated.
160
160
 
161
+ ## Resources
162
+
163
+ Alongside tools, the server exposes the read-only entities as MCP **resources**
164
+ so clients can browse and @-mention them as context:
165
+
166
+ | URI | What |
167
+ |---|---|
168
+ | `debugg-ai://projects` | All projects (first page) |
169
+ | `debugg-ai://environments` | Environments for the auto-detected project |
170
+ | `debugg-ai://executions` | Recent executions (first page) |
171
+ | `debugg-ai://project/{uuid}` | One project, full detail |
172
+ | `debugg-ai://environment/{uuid}` | One environment (credentials inline, passwords redacted) |
173
+ | `debugg-ai://execution/{uuid}` | One execution, full node detail + artifact links |
174
+
175
+ Reads dispatch to the same handlers as the `project` / `environment` /
176
+ `executions` tools, so the data and auth are identical. Resources are additive —
177
+ clients without resource support keep using the tools.
178
+
161
179
  ### Security invariants
162
180
 
163
181
  - Passwords are write-only. They never appear in any response body from any tool.
@@ -0,0 +1,127 @@
1
+ /**
2
+ * MCP Resources (epic pglam).
3
+ *
4
+ * Exposes the read-only entities (projects / environments / executions) as
5
+ * addressable resources so clients can browse and @-mention them as context
6
+ * instead of (or alongside) calling the `project`/`environment`/`executions`
7
+ * tools. Reads reuse the exact tool handlers — same data, same auth, no drift.
8
+ *
9
+ * Collections (resources/list): debugg-ai://projects | environments | executions
10
+ * Items (resources/templates/list): debugg-ai://project/{uuid}
11
+ * debugg-ai://environment/{uuid}
12
+ * debugg-ai://execution/{uuid}
13
+ *
14
+ * Resources are additive: clients that don't support the capability simply
15
+ * keep using the tools.
16
+ */
17
+ import { config } from '../config/index.js';
18
+ import { MCPError, MCPErrorCode, } from '../types/index.js';
19
+ import { projectHandler } from './projectHandler.js';
20
+ import { environmentHandler } from './environmentHandler.js';
21
+ import { executionsHandler } from './executionsHandler.js';
22
+ const SCHEME = 'debugg-ai';
23
+ const JSON_MIME = 'application/json';
24
+ /** Concrete collection resources returned by resources/list. */
25
+ export const RESOURCE_COLLECTIONS = [
26
+ {
27
+ uri: `${SCHEME}://projects`,
28
+ name: 'projects',
29
+ title: 'DebuggAI Projects',
30
+ description: 'All projects visible to this API key (first page).',
31
+ mimeType: JSON_MIME,
32
+ },
33
+ {
34
+ uri: `${SCHEME}://environments`,
35
+ name: 'environments',
36
+ title: 'DebuggAI Environments',
37
+ description: 'Environments for the auto-detected project (credentials redacted).',
38
+ mimeType: JSON_MIME,
39
+ },
40
+ {
41
+ uri: `${SCHEME}://executions`,
42
+ name: 'executions',
43
+ title: 'DebuggAI Executions',
44
+ description: 'Recent workflow executions (first page).',
45
+ mimeType: JSON_MIME,
46
+ },
47
+ ];
48
+ /** URI templates returned by resources/templates/list. */
49
+ export const RESOURCE_TEMPLATES = [
50
+ {
51
+ uriTemplate: `${SCHEME}://project/{uuid}`,
52
+ name: 'project',
53
+ title: 'DebuggAI Project',
54
+ description: 'A single project by UUID, with full detail.',
55
+ mimeType: JSON_MIME,
56
+ },
57
+ {
58
+ uriTemplate: `${SCHEME}://environment/{uuid}`,
59
+ name: 'environment',
60
+ title: 'DebuggAI Environment',
61
+ description: 'A single environment by UUID, with credentials inline (passwords redacted).',
62
+ mimeType: JSON_MIME,
63
+ },
64
+ {
65
+ uriTemplate: `${SCHEME}://execution/{uuid}`,
66
+ name: 'execution',
67
+ title: 'DebuggAI Execution',
68
+ description: 'A single execution by UUID, with full node detail + artifact links.',
69
+ mimeType: JSON_MIME,
70
+ },
71
+ ];
72
+ function readContext() {
73
+ return { timestamp: new Date() };
74
+ }
75
+ /** Pull the JSON payload that every entity handler emits as its single text block. */
76
+ function payloadText(res) {
77
+ const text = res.content?.find((c) => c.type === 'text')?.text;
78
+ return typeof text === 'string' ? text : '{}';
79
+ }
80
+ // debugg-ai://<kind> (collection)
81
+ // debugg-ai://<kind>/<uuid> (item)
82
+ const URI_RE = new RegExp(`^${SCHEME}://([a-z]+)(?:/([^/?#]+))?$`);
83
+ /**
84
+ * Resolve a debugg-ai:// resource URI by dispatching to the matching tool
85
+ * handler and wrapping its JSON payload as a resource content block.
86
+ */
87
+ export async function readResource(uri) {
88
+ if (!config.api.key) {
89
+ throw new MCPError(MCPErrorCode.CONFIGURATION_ERROR, 'DEBUGGAI_API_KEY is not set. Configure it in your MCP server registration. Get a key at https://debugg.ai.', { missingEnvVars: ['DEBUGGAI_API_KEY'] });
90
+ }
91
+ const match = URI_RE.exec(uri);
92
+ if (!match) {
93
+ throw new MCPError(MCPErrorCode.INVALID_PARAMS, `Unrecognized resource URI: ${uri}`);
94
+ }
95
+ const [, kind, id] = match;
96
+ const ctx = readContext();
97
+ const requireId = () => {
98
+ if (!id) {
99
+ throw new MCPError(MCPErrorCode.INVALID_PARAMS, `Resource ${uri} requires a UUID: ${SCHEME}://${kind}/{uuid}`);
100
+ }
101
+ return id;
102
+ };
103
+ let res;
104
+ switch (kind) {
105
+ case 'projects':
106
+ res = await projectHandler({ action: 'list' }, ctx);
107
+ break;
108
+ case 'project':
109
+ res = await projectHandler({ action: 'get', uuid: requireId() }, ctx);
110
+ break;
111
+ case 'environments':
112
+ res = await environmentHandler({ action: 'list' }, ctx);
113
+ break;
114
+ case 'environment':
115
+ res = await environmentHandler({ action: 'get', uuid: requireId() }, ctx);
116
+ break;
117
+ case 'executions':
118
+ res = await executionsHandler({ action: 'list' }, ctx);
119
+ break;
120
+ case 'execution':
121
+ res = await executionsHandler({ action: 'get', uuid: requireId() }, ctx);
122
+ break;
123
+ default:
124
+ throw new MCPError(MCPErrorCode.INVALID_PARAMS, `Unknown resource kind "${kind}" in ${uri}`);
125
+ }
126
+ return { contents: [{ uri, mimeType: JSON_MIME, text: payloadText(res) }] };
127
+ }
package/dist/index.js CHANGED
@@ -18,9 +18,10 @@
18
18
  */
19
19
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
20
20
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
21
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
21
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
22
22
  import { config } from "./config/index.js";
23
23
  import { initTools, getTools, getTool } from "./tools/index.js";
24
+ import { readResource, RESOURCE_COLLECTIONS, RESOURCE_TEMPLATES } from "./handlers/resourcesHandler.js";
24
25
  import { Logger, validateInput, createErrorResponse, toMCPError, handleConfigurationError, Telemetry, TelemetryEvents, withStructuredContent, } from "./utils/index.js";
25
26
  import { MCPErrorCode, MCPError, } from "./types/index.js";
26
27
  // Logger and server are initialized lazily in main() to avoid triggering
@@ -39,6 +40,9 @@ function createMCPServer() {
39
40
  tools: {
40
41
  listChanged: false,
41
42
  },
43
+ resources: {
44
+ listChanged: false,
45
+ },
42
46
  },
43
47
  });
44
48
  }
@@ -135,6 +139,28 @@ function registerHandlers() {
135
139
  logger.info('Tools list requested', { toolCount: tools.length });
136
140
  return { tools };
137
141
  });
142
+ // Resources (epic pglam): browse projects/environments/executions as
143
+ // addressable read URIs. Reads dispatch to the same entity handlers as the
144
+ // tools, so data + auth stay consistent.
145
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
146
+ logger.info('Resources list requested', { resourceCount: RESOURCE_COLLECTIONS.length });
147
+ return { resources: RESOURCE_COLLECTIONS };
148
+ });
149
+ server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
150
+ return { resourceTemplates: RESOURCE_TEMPLATES };
151
+ });
152
+ server.setRequestHandler(ReadResourceRequestSchema, async (req) => {
153
+ const uri = req.params?.uri;
154
+ logger.info('Resource read requested', { uri });
155
+ try {
156
+ return await readResource(uri);
157
+ }
158
+ catch (error) {
159
+ const mcpError = toMCPError(error, 'resource read');
160
+ logger.error('Resource read failed', { uri, errorCode: mcpError.code, message: mcpError.message });
161
+ throw mcpError;
162
+ }
163
+ });
138
164
  }
139
165
  /**
140
166
  * Main server initialization and startup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugg-ai/debugg-ai-mcp",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.",
5
5
  "type": "module",
6
6
  "bin": {