@runpod/mcp-server 1.4.0 → 2.0.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/tools.d.cts CHANGED
@@ -1,5 +1,30 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
 
3
+ interface RequestInitLike {
4
+ method: string;
5
+ headers: Record<string, string>;
6
+ body?: string;
7
+ }
8
+ type FetchLike = (url: string, init: RequestInitLike) => Promise<HttpResponseLike>;
9
+ interface HttpResponseLike {
10
+ ok: boolean;
11
+ status: number;
12
+ text(): Promise<string>;
13
+ json(): Promise<unknown>;
14
+ headers: {
15
+ get(name: string): string | null;
16
+ };
17
+ }
18
+ interface HttpClient {
19
+ (url: string, method?: string, body?: Record<string, unknown>): Promise<unknown>;
20
+ }
21
+ declare function createHttpClient(deps: {
22
+ apiKey: string;
23
+ fetch: FetchLike;
24
+ tracking: () => Record<string, string>;
25
+ errorPrefix: string;
26
+ }): HttpClient;
27
+
3
28
  /**
4
29
  * Context passed to every tool handler. Contains the API key used to
5
30
  * authenticate against the Runpod REST and Serverless APIs, the transport the
@@ -12,10 +37,33 @@ interface ToolContext {
12
37
  clientUserAgent?: string;
13
38
  serverVersion?: string;
14
39
  }
40
+ type HttpFetch = Parameters<typeof createHttpClient>[0]['fetch'];
41
+ interface ToolDeps {
42
+ fetch?: HttpFetch;
43
+ v2Available?: boolean;
44
+ streamSse?: StreamSse;
45
+ }
46
+ interface StreamSseResult {
47
+ raw: string;
48
+ truncated: boolean;
49
+ }
50
+ type StreamSse = (url: string, opts: {
51
+ maxWaitMs: number;
52
+ maxBytes: number;
53
+ }) => Promise<StreamSseResult>;
54
+
15
55
  /**
16
- * Register all Runpod tools on the given MCP server instance. The provided
17
- * context supplies the API key that authenticated request helpers will use.
56
+ * Register all Runpod tools on the given MCP server instance.
57
+ *
58
+ * The tool surface is split by resource under `src/tools/<resource>.ts`; this
59
+ * function builds the shared runtime (caller-tracking, authenticated REST/
60
+ * Serverless/GraphQL clients, the v1/v2 backend resolver) once and threads it
61
+ * into each per-resource registrar.
62
+ *
63
+ * @param ctx supplies the API key the request helpers authenticate with.
64
+ * @param deps optional test seam (inject a fake fetch / the resolved v2-probe
65
+ * verdict). Production passes nothing.
18
66
  */
19
- declare function registerTools(server: McpServer, ctx: ToolContext): void;
67
+ declare function registerTools(server: McpServer, ctx: ToolContext, deps?: ToolDeps): void;
20
68
 
21
69
  export { type ToolContext, registerTools };
package/dist/tools.d.ts CHANGED
@@ -1,5 +1,30 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
 
3
+ interface RequestInitLike {
4
+ method: string;
5
+ headers: Record<string, string>;
6
+ body?: string;
7
+ }
8
+ type FetchLike = (url: string, init: RequestInitLike) => Promise<HttpResponseLike>;
9
+ interface HttpResponseLike {
10
+ ok: boolean;
11
+ status: number;
12
+ text(): Promise<string>;
13
+ json(): Promise<unknown>;
14
+ headers: {
15
+ get(name: string): string | null;
16
+ };
17
+ }
18
+ interface HttpClient {
19
+ (url: string, method?: string, body?: Record<string, unknown>): Promise<unknown>;
20
+ }
21
+ declare function createHttpClient(deps: {
22
+ apiKey: string;
23
+ fetch: FetchLike;
24
+ tracking: () => Record<string, string>;
25
+ errorPrefix: string;
26
+ }): HttpClient;
27
+
3
28
  /**
4
29
  * Context passed to every tool handler. Contains the API key used to
5
30
  * authenticate against the Runpod REST and Serverless APIs, the transport the
@@ -12,10 +37,33 @@ interface ToolContext {
12
37
  clientUserAgent?: string;
13
38
  serverVersion?: string;
14
39
  }
40
+ type HttpFetch = Parameters<typeof createHttpClient>[0]['fetch'];
41
+ interface ToolDeps {
42
+ fetch?: HttpFetch;
43
+ v2Available?: boolean;
44
+ streamSse?: StreamSse;
45
+ }
46
+ interface StreamSseResult {
47
+ raw: string;
48
+ truncated: boolean;
49
+ }
50
+ type StreamSse = (url: string, opts: {
51
+ maxWaitMs: number;
52
+ maxBytes: number;
53
+ }) => Promise<StreamSseResult>;
54
+
15
55
  /**
16
- * Register all Runpod tools on the given MCP server instance. The provided
17
- * context supplies the API key that authenticated request helpers will use.
56
+ * Register all Runpod tools on the given MCP server instance.
57
+ *
58
+ * The tool surface is split by resource under `src/tools/<resource>.ts`; this
59
+ * function builds the shared runtime (caller-tracking, authenticated REST/
60
+ * Serverless/GraphQL clients, the v1/v2 backend resolver) once and threads it
61
+ * into each per-resource registrar.
62
+ *
63
+ * @param ctx supplies the API key the request helpers authenticate with.
64
+ * @param deps optional test seam (inject a fake fetch / the resolved v2-probe
65
+ * verdict). Production passes nothing.
18
66
  */
19
- declare function registerTools(server: McpServer, ctx: ToolContext): void;
67
+ declare function registerTools(server: McpServer, ctx: ToolContext, deps?: ToolDeps): void;
20
68
 
21
69
  export { type ToolContext, registerTools };
package/dist/tools.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerTools
3
- } from "./chunk-D4AEYJ2O.mjs";
3
+ } from "./chunk-ZP3TCVXG.mjs";
4
4
  export {
5
5
  registerTools
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runpod/mcp-server",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "description": "MCP server for interacting with Runpod API",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -88,6 +88,7 @@
88
88
  "oauth-e2e": "tsx scripts/oauth-e2e.ts",
89
89
  "changeset": "changeset",
90
90
  "changeset:version": "changeset version",
91
- "changeset:publish": "changeset publish"
91
+ "changeset:publish": "changeset publish",
92
+ "smoke:crud": "tsx scripts/smoke-crud.ts"
92
93
  }
93
94
  }