@pixeldojo/mcp 0.3.0 → 0.5.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/dist/index.d.cts CHANGED
@@ -1,70 +1,6 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
- import { PixelDojoClientOptions, PixelDojoClient } from '@pixeldojo/sdk';
3
2
  import { z } from 'zod';
4
-
5
- /**
6
- * MCP server bootstrap. Wires the named skills to the MCP `tools/list` +
7
- * `tools/call` handlers and runs over stdio.
8
- *
9
- * Architecture:
10
- * - tools/list: returns every skill's name + description + inputSchema.
11
- * - tools/call: parses input via Zod, dispatches to the skill module,
12
- * converts the SkillResult into MCP content blocks, returns to host.
13
- * - errors are translated at the boundary: provider failures, missing
14
- * API keys, unknown skills all surface as actionable MCP error
15
- * payloads (never raw stack traces).
16
- */
17
-
18
- declare const PACKAGE_VERSION = "0.1.0";
19
- interface ServerOptions {
20
- apiKey: string;
21
- baseUrl?: string;
22
- packageVersion?: string;
23
- /** Inject for tests. Defaults to the real fetch. */
24
- baseFetch?: typeof globalThis.fetch;
25
- }
26
- /**
27
- * Build the configured MCP `Server` instance with handlers wired in.
28
- * Caller is responsible for connecting it to a transport (stdio in
29
- * production, mock in tests).
30
- */
31
- declare function buildServer(options: ServerOptions): Server;
32
- /**
33
- * Run the server over stdio. Used by the CLI; tests use buildServer
34
- * directly with a mock transport.
35
- */
36
- declare function runStdio(options: ServerOptions): Promise<void>;
37
-
38
- /**
39
- * Header-injecting wrapper around `@pixeldojo/sdk`'s PixelDojoClient.
40
- *
41
- * Per Eng review E2 + E3:
42
- * - Depends on @pixeldojo/sdk for run/getJob/listModels/getModelSchema
43
- * (DRY — no /api/v1 client duplication).
44
- * - Injects `x-pixeldojo-source: mcp/<version>` and `x-pixeldojo-skill:
45
- * <skill-name>` headers on every API call so Tool Health can attribute
46
- * MCP traffic separately from raw REST.
47
- *
48
- * The SDK exposes a `fetch` injection point in its constructor — we wrap
49
- * the global `fetch` to add headers without monkey-patching anything.
50
- */
51
-
52
- interface MakeClientOptions extends PixelDojoClientOptions {
53
- /** MCP package version for the `x-pixeldojo-source` header value. */
54
- mcpVersion: string;
55
- /** Optional skill name; if set, written to `x-pixeldojo-skill`. */
56
- skillName?: string;
57
- /** Optional fetch override (tests). Defaults to `globalThis.fetch`. */
58
- baseFetch?: typeof globalThis.fetch;
59
- }
60
- /**
61
- * Build a PixelDojoClient with attribution headers baked in.
62
- *
63
- * Each call's headers include both the source tag and the requesting
64
- * skill so the server can record per-skill error rates without the
65
- * client passing skill metadata explicitly through every call.
66
- */
67
- declare function makeAttributedClient(options: MakeClientOptions): PixelDojoClient;
3
+ import { PixelDojoClient, PixelDojoClientOptions } from '@pixeldojo/sdk';
68
4
 
69
5
  /**
70
6
  * Exponential-backoff job poller with a 30-second sync window.
@@ -193,6 +129,89 @@ interface SkillModule<TInput = unknown> {
193
129
  run(input: TInput, ctx: SkillContext): Promise<SkillResult>;
194
130
  }
195
131
 
132
+ /**
133
+ * MCP server bootstrap. Wires the named skills to the MCP `tools/list` +
134
+ * `tools/call` handlers and runs over stdio.
135
+ *
136
+ * Architecture:
137
+ * - tools/list: returns every skill's name + description + inputSchema.
138
+ * - tools/call: parses input via Zod, dispatches to the skill module,
139
+ * converts the SkillResult into MCP content blocks, returns to host.
140
+ * - errors are translated at the boundary: provider failures, missing
141
+ * API keys, unknown skills all surface as actionable MCP error
142
+ * payloads (never raw stack traces).
143
+ */
144
+
145
+ declare const PACKAGE_VERSION = "0.1.0";
146
+ interface ServerOptions {
147
+ apiKey: string;
148
+ baseUrl?: string;
149
+ packageVersion?: string;
150
+ /** Inject for tests. Defaults to the real fetch. */
151
+ baseFetch?: typeof globalThis.fetch;
152
+ }
153
+ /**
154
+ * Build the configured MCP `Server` instance with handlers wired in.
155
+ * Caller is responsible for connecting it to a transport (stdio in
156
+ * production, mock in tests).
157
+ */
158
+ declare function buildServer(options: ServerOptions): Server;
159
+ /**
160
+ * Translate a SkillResult into MCP content blocks.
161
+ * The host renders these to the LLM; URLs in `assets` are surfaced as
162
+ * extra text blocks so the LLM can quote them directly without needing
163
+ * a separate `assets` shape (no MCP standard for that yet).
164
+ */
165
+ declare function skillResultToMcpResponse(result: SkillResult): {
166
+ isError?: boolean;
167
+ content: Array<{
168
+ type: 'text';
169
+ text: string;
170
+ }>;
171
+ };
172
+ /**
173
+ * Convert SDK / network errors to a single actionable line. Per Eng review:
174
+ * users should never see raw provider stack traces; errors must include
175
+ * what to do next.
176
+ */
177
+ declare function errorToActionableMessage(err: unknown): string;
178
+ /**
179
+ * Run the server over stdio. Used by the CLI; tests use buildServer
180
+ * directly with a mock transport.
181
+ */
182
+ declare function runStdio(options: ServerOptions): Promise<void>;
183
+
184
+ /**
185
+ * Header-injecting wrapper around `@pixeldojo/sdk`'s PixelDojoClient.
186
+ *
187
+ * Per Eng review E2 + E3:
188
+ * - Depends on @pixeldojo/sdk for run/getJob/listModels/getModelSchema
189
+ * (DRY — no /api/v1 client duplication).
190
+ * - Injects `x-pixeldojo-source: mcp/<version>` and `x-pixeldojo-skill:
191
+ * <skill-name>` headers on every API call so Tool Health can attribute
192
+ * MCP traffic separately from raw REST.
193
+ *
194
+ * The SDK exposes a `fetch` injection point in its constructor — we wrap
195
+ * the global `fetch` to add headers without monkey-patching anything.
196
+ */
197
+
198
+ interface MakeClientOptions extends PixelDojoClientOptions {
199
+ /** MCP package version for the `x-pixeldojo-source` header value. */
200
+ mcpVersion: string;
201
+ /** Optional skill name; if set, written to `x-pixeldojo-skill`. */
202
+ skillName?: string;
203
+ /** Optional fetch override (tests). Defaults to `globalThis.fetch`. */
204
+ baseFetch?: typeof globalThis.fetch;
205
+ }
206
+ /**
207
+ * Build a PixelDojoClient with attribution headers baked in.
208
+ *
209
+ * Each call's headers include both the source tag and the requesting
210
+ * skill so the server can record per-skill error rates without the
211
+ * client passing skill metadata explicitly through every call.
212
+ */
213
+ declare function makeAttributedClient(options: MakeClientOptions): PixelDojoClient;
214
+
196
215
  /**
197
216
  * Registry of all named MCP skills shipped by `@pixeldojo/mcp`.
198
217
  *
@@ -238,4 +257,4 @@ declare function makeRedactedLogger(target?: Pick<Console, 'error'>): {
238
257
  error(msg: string, ...args: unknown[]): void;
239
258
  };
240
259
 
241
- export { ALL_SKILLS, type MakeClientOptions, PACKAGE_VERSION, type PollOptions, type PollResult, type PollableJob, type ServerOptions, type SkillContext, type SkillModule, type SkillResult, buildServer, findSkill, makeAttributedClient, makeRedactedLogger, pollJobUntilDoneOrHandoff, redactKeys, redactValue, runStdio };
260
+ export { ALL_SKILLS, type MakeClientOptions, PACKAGE_VERSION, type PollOptions, type PollResult, type PollableJob, type ServerOptions, type SkillContext, type SkillModule, type SkillResult, buildServer, errorToActionableMessage, findSkill, makeAttributedClient, makeRedactedLogger, pollJobUntilDoneOrHandoff, redactKeys, redactValue, runStdio, skillResultToMcpResponse };
package/dist/index.d.ts CHANGED
@@ -1,70 +1,6 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
- import { PixelDojoClientOptions, PixelDojoClient } from '@pixeldojo/sdk';
3
2
  import { z } from 'zod';
4
-
5
- /**
6
- * MCP server bootstrap. Wires the named skills to the MCP `tools/list` +
7
- * `tools/call` handlers and runs over stdio.
8
- *
9
- * Architecture:
10
- * - tools/list: returns every skill's name + description + inputSchema.
11
- * - tools/call: parses input via Zod, dispatches to the skill module,
12
- * converts the SkillResult into MCP content blocks, returns to host.
13
- * - errors are translated at the boundary: provider failures, missing
14
- * API keys, unknown skills all surface as actionable MCP error
15
- * payloads (never raw stack traces).
16
- */
17
-
18
- declare const PACKAGE_VERSION = "0.1.0";
19
- interface ServerOptions {
20
- apiKey: string;
21
- baseUrl?: string;
22
- packageVersion?: string;
23
- /** Inject for tests. Defaults to the real fetch. */
24
- baseFetch?: typeof globalThis.fetch;
25
- }
26
- /**
27
- * Build the configured MCP `Server` instance with handlers wired in.
28
- * Caller is responsible for connecting it to a transport (stdio in
29
- * production, mock in tests).
30
- */
31
- declare function buildServer(options: ServerOptions): Server;
32
- /**
33
- * Run the server over stdio. Used by the CLI; tests use buildServer
34
- * directly with a mock transport.
35
- */
36
- declare function runStdio(options: ServerOptions): Promise<void>;
37
-
38
- /**
39
- * Header-injecting wrapper around `@pixeldojo/sdk`'s PixelDojoClient.
40
- *
41
- * Per Eng review E2 + E3:
42
- * - Depends on @pixeldojo/sdk for run/getJob/listModels/getModelSchema
43
- * (DRY — no /api/v1 client duplication).
44
- * - Injects `x-pixeldojo-source: mcp/<version>` and `x-pixeldojo-skill:
45
- * <skill-name>` headers on every API call so Tool Health can attribute
46
- * MCP traffic separately from raw REST.
47
- *
48
- * The SDK exposes a `fetch` injection point in its constructor — we wrap
49
- * the global `fetch` to add headers without monkey-patching anything.
50
- */
51
-
52
- interface MakeClientOptions extends PixelDojoClientOptions {
53
- /** MCP package version for the `x-pixeldojo-source` header value. */
54
- mcpVersion: string;
55
- /** Optional skill name; if set, written to `x-pixeldojo-skill`. */
56
- skillName?: string;
57
- /** Optional fetch override (tests). Defaults to `globalThis.fetch`. */
58
- baseFetch?: typeof globalThis.fetch;
59
- }
60
- /**
61
- * Build a PixelDojoClient with attribution headers baked in.
62
- *
63
- * Each call's headers include both the source tag and the requesting
64
- * skill so the server can record per-skill error rates without the
65
- * client passing skill metadata explicitly through every call.
66
- */
67
- declare function makeAttributedClient(options: MakeClientOptions): PixelDojoClient;
3
+ import { PixelDojoClient, PixelDojoClientOptions } from '@pixeldojo/sdk';
68
4
 
69
5
  /**
70
6
  * Exponential-backoff job poller with a 30-second sync window.
@@ -193,6 +129,89 @@ interface SkillModule<TInput = unknown> {
193
129
  run(input: TInput, ctx: SkillContext): Promise<SkillResult>;
194
130
  }
195
131
 
132
+ /**
133
+ * MCP server bootstrap. Wires the named skills to the MCP `tools/list` +
134
+ * `tools/call` handlers and runs over stdio.
135
+ *
136
+ * Architecture:
137
+ * - tools/list: returns every skill's name + description + inputSchema.
138
+ * - tools/call: parses input via Zod, dispatches to the skill module,
139
+ * converts the SkillResult into MCP content blocks, returns to host.
140
+ * - errors are translated at the boundary: provider failures, missing
141
+ * API keys, unknown skills all surface as actionable MCP error
142
+ * payloads (never raw stack traces).
143
+ */
144
+
145
+ declare const PACKAGE_VERSION = "0.1.0";
146
+ interface ServerOptions {
147
+ apiKey: string;
148
+ baseUrl?: string;
149
+ packageVersion?: string;
150
+ /** Inject for tests. Defaults to the real fetch. */
151
+ baseFetch?: typeof globalThis.fetch;
152
+ }
153
+ /**
154
+ * Build the configured MCP `Server` instance with handlers wired in.
155
+ * Caller is responsible for connecting it to a transport (stdio in
156
+ * production, mock in tests).
157
+ */
158
+ declare function buildServer(options: ServerOptions): Server;
159
+ /**
160
+ * Translate a SkillResult into MCP content blocks.
161
+ * The host renders these to the LLM; URLs in `assets` are surfaced as
162
+ * extra text blocks so the LLM can quote them directly without needing
163
+ * a separate `assets` shape (no MCP standard for that yet).
164
+ */
165
+ declare function skillResultToMcpResponse(result: SkillResult): {
166
+ isError?: boolean;
167
+ content: Array<{
168
+ type: 'text';
169
+ text: string;
170
+ }>;
171
+ };
172
+ /**
173
+ * Convert SDK / network errors to a single actionable line. Per Eng review:
174
+ * users should never see raw provider stack traces; errors must include
175
+ * what to do next.
176
+ */
177
+ declare function errorToActionableMessage(err: unknown): string;
178
+ /**
179
+ * Run the server over stdio. Used by the CLI; tests use buildServer
180
+ * directly with a mock transport.
181
+ */
182
+ declare function runStdio(options: ServerOptions): Promise<void>;
183
+
184
+ /**
185
+ * Header-injecting wrapper around `@pixeldojo/sdk`'s PixelDojoClient.
186
+ *
187
+ * Per Eng review E2 + E3:
188
+ * - Depends on @pixeldojo/sdk for run/getJob/listModels/getModelSchema
189
+ * (DRY — no /api/v1 client duplication).
190
+ * - Injects `x-pixeldojo-source: mcp/<version>` and `x-pixeldojo-skill:
191
+ * <skill-name>` headers on every API call so Tool Health can attribute
192
+ * MCP traffic separately from raw REST.
193
+ *
194
+ * The SDK exposes a `fetch` injection point in its constructor — we wrap
195
+ * the global `fetch` to add headers without monkey-patching anything.
196
+ */
197
+
198
+ interface MakeClientOptions extends PixelDojoClientOptions {
199
+ /** MCP package version for the `x-pixeldojo-source` header value. */
200
+ mcpVersion: string;
201
+ /** Optional skill name; if set, written to `x-pixeldojo-skill`. */
202
+ skillName?: string;
203
+ /** Optional fetch override (tests). Defaults to `globalThis.fetch`. */
204
+ baseFetch?: typeof globalThis.fetch;
205
+ }
206
+ /**
207
+ * Build a PixelDojoClient with attribution headers baked in.
208
+ *
209
+ * Each call's headers include both the source tag and the requesting
210
+ * skill so the server can record per-skill error rates without the
211
+ * client passing skill metadata explicitly through every call.
212
+ */
213
+ declare function makeAttributedClient(options: MakeClientOptions): PixelDojoClient;
214
+
196
215
  /**
197
216
  * Registry of all named MCP skills shipped by `@pixeldojo/mcp`.
198
217
  *
@@ -238,4 +257,4 @@ declare function makeRedactedLogger(target?: Pick<Console, 'error'>): {
238
257
  error(msg: string, ...args: unknown[]): void;
239
258
  };
240
259
 
241
- export { ALL_SKILLS, type MakeClientOptions, PACKAGE_VERSION, type PollOptions, type PollResult, type PollableJob, type ServerOptions, type SkillContext, type SkillModule, type SkillResult, buildServer, findSkill, makeAttributedClient, makeRedactedLogger, pollJobUntilDoneOrHandoff, redactKeys, redactValue, runStdio };
260
+ export { ALL_SKILLS, type MakeClientOptions, PACKAGE_VERSION, type PollOptions, type PollResult, type PollableJob, type ServerOptions, type SkillContext, type SkillModule, type SkillResult, buildServer, errorToActionableMessage, findSkill, makeAttributedClient, makeRedactedLogger, pollJobUntilDoneOrHandoff, redactKeys, redactValue, runStdio, skillResultToMcpResponse };