@runpod/mcp-server 1.3.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/CHANGELOG.md +61 -0
- package/README.md +177 -47
- package/dist/chunk-ZP3TCVXG.mjs +2116 -0
- package/dist/chunk-ZP3TCVXG.mjs.map +1 -0
- package/dist/http.cjs +1596 -588
- package/dist/http.cjs.map +1 -1
- package/dist/http.mjs +2 -2
- package/dist/stdio.cjs +2141 -634
- package/dist/stdio.cjs.map +1 -1
- package/dist/stdio.mjs +1719 -631
- package/dist/stdio.mjs.map +1 -1
- package/dist/tools.cjs +1596 -586
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +51 -3
- package/dist/tools.d.ts +51 -3
- package/dist/tools.mjs +1 -1
- package/dist/wizard-37ZJSVB5.mjs +402 -0
- package/dist/wizard-37ZJSVB5.mjs.map +1 -0
- package/package.json +6 -2
- package/dist/chunk-CRHHCQRI.mjs +0 -1108
- package/dist/chunk-CRHHCQRI.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @runpod/mcp-server
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 2658e43: **Breaking:** default the REST version to **v2**, and migrate Serverless
|
|
8
|
+
endpoint CRUD to the v2 API.
|
|
9
|
+
|
|
10
|
+
With nothing set, all control-plane resources now use the v2 REST API
|
|
11
|
+
(`v2-rest.runpod.io/v2`); set `RUNPOD_REST_VERSION=v1` to pin the previous v1
|
|
12
|
+
behavior.
|
|
13
|
+
|
|
14
|
+
Why this is a major bump: `create-endpoint`/`update-endpoint` move from the v1
|
|
15
|
+
**template-based** model to the v2 **inline-config** model. On v2,
|
|
16
|
+
`create-endpoint` no longer accepts a `templateId` — it requires `imageName` +
|
|
17
|
+
`gpuPoolIds` (GPU pool names from `list-gpu-types`, e.g. `AMPERE_80`) plus
|
|
18
|
+
optional `workers`/`scaling`. So an existing integration that calls
|
|
19
|
+
`create-endpoint` with `{ templateId }` and no `RUNPOD_REST_VERSION` pin will
|
|
20
|
+
get a clean `400` after upgrading, with no code change on their side. To keep
|
|
21
|
+
the old behavior, pin `RUNPOD_REST_VERSION=v1` (templateId model preserved).
|
|
22
|
+
|
|
23
|
+
`jobs` still resolves to v1 (serverless runtime API, no v2 home). CPU pods are
|
|
24
|
+
still served by v1, and the `auto` stdio probe is unchanged. Version-sensitive
|
|
25
|
+
tests pin their version explicitly so the suite is independent of the default.
|
|
26
|
+
|
|
27
|
+
See the README "REST API version (v1 / v2)" section for the migration note.
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- cdba19c: Add v2-only tools covering the rest of the v2 REST surface:
|
|
32
|
+
- **Tags** — `list-tags`, `get-tag`, `create-tag`, `update-tag`, `delete-tag`,
|
|
33
|
+
and `attach-tag` / `detach-tag` to associate a tag with a pod, network volume,
|
|
34
|
+
cluster, or serverless endpoint.
|
|
35
|
+
- **Billing** — `get-billing` returns time-bucketed spend, either aggregated or
|
|
36
|
+
broken down by resource type (`scope`), windowed by `startTime`/`endTime` or
|
|
37
|
+
`lastN`. The records array is capped via `limit`/`cursor`.
|
|
38
|
+
- **Endpoint workers** — `list-endpoint-workers` lists the workers behind a
|
|
39
|
+
serverless endpoint plus an aggregate summary (capped via `limit`/`cursor`).
|
|
40
|
+
- **Catalog by id** — `get-cpu-type` and `get-data-center` round out the catalog
|
|
41
|
+
alongside the existing `get-gpu-type`.
|
|
42
|
+
|
|
43
|
+
These resources exist only on the v2 REST API, so each returns a clean `501`
|
|
44
|
+
notice on v1 (set `RUNPOD_REST_VERSION=v2`).
|
|
45
|
+
|
|
46
|
+
## 1.4.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- f3ddd6d: Cap list-tool responses so they no longer overflow the agent's context window.
|
|
51
|
+
Every `list-*` tool (`list-pods`, `list-endpoints`, `list-templates`,
|
|
52
|
+
`list-network-volumes`, `list-container-registry-auths`) now accepts optional
|
|
53
|
+
`limit` and `cursor` parameters and returns at most `limit` items (default 20,
|
|
54
|
+
max 100) inside a `{ items, pagination }` envelope that reports `total`,
|
|
55
|
+
`returned`, `truncated`, and a `nextCursor` for fetching the next page.
|
|
56
|
+
|
|
57
|
+
The REST API does not yet support server-side pagination, so this is a
|
|
58
|
+
client-side cap; the `limit`/`cursor` signature is shaped to match the
|
|
59
|
+
cursor-based pagination the REST API will add, so the tool interface will not
|
|
60
|
+
change when server-side pagination lands.
|
|
61
|
+
|
|
62
|
+
- e59fbfe: Add a guided install wizard. Running `npx @runpod/mcp-server@latest add` detects installed agents (Claude Code, Claude Desktop, Cursor, Windsurf, Visual Studio Code), lets you pick which to configure, and writes the MCP configuration for each. It offers two connection modes: a hosted mode that points the agent at the hosted server and authenticates with the "Sign in with Runpod" OAuth flow (no API key stored on disk), and a local mode that runs the server via npx with a `RUNPOD_API_KEY`. `remove` undoes the changes. Existing config files keep their formatting and comments.
|
|
63
|
+
|
|
3
64
|
## 1.3.0
|
|
4
65
|
|
|
5
66
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -2,23 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://smithery.ai/server/@runpod/runpod-mcp-ts)
|
|
4
4
|
|
|
5
|
-
This is the official Runpod Model Context Protocol (MCP) server, published to npm as `@runpod/mcp-server`.
|
|
5
|
+
This is the official Runpod Model Context Protocol (MCP) server, published to npm as `@runpod/mcp-server`. It lets MCP clients such as Claude Code, Claude Desktop, Cursor, Windsurf, and VS Code manage your Runpod Pods, Serverless endpoints, templates, network volumes, and more.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Quick start
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- Hosted Streamable HTTP for Vercel or other HTTP-capable platforms. Each request carries its own `Authorization: Bearer <token>`, which the server forwards directly to the Runpod API. The token can be a Runpod API key or one obtained through the OAuth "Sign in with Runpod" flow.
|
|
9
|
+
The fastest way to get connected is the guided installer pointed at the **hosted Runpod MCP server at `https://mcp.getrunpod.io/`**. The installer detects the agents you have installed, asks which ones to configure, and writes the configuration for you:
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npx @runpod/mcp-server@latest add
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It supports **Claude Code, Claude Desktop, Cursor, Windsurf, and Visual Studio Code**, and offers two connection modes:
|
|
16
|
+
|
|
17
|
+
- **Hosted (recommended).** Points the agent at the hosted server and authenticates with the **"Sign in with Runpod"** OAuth flow, so **no API key is stored on disk**.
|
|
18
|
+
- **Local.** Runs the server through `npx` and stores a `RUNPOD_API_KEY` in the agent's config.
|
|
19
|
+
|
|
20
|
+
To undo the changes later, run:
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npx @runpod/mcp-server@latest remove
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Connect to the hosted server manually
|
|
27
|
+
|
|
28
|
+
If you'd rather configure your client by hand, point it at the hosted server over HTTP (no local process, no API key stored).
|
|
29
|
+
|
|
30
|
+
**Claude Code** — add it as an HTTP server:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
claude mcp add --transport http runpod -s user https://mcp.getrunpod.io/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Other clients** (Cursor, VS Code, Claude Desktop connectors, …) — use a URL-based MCP entry:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"runpod": {
|
|
42
|
+
"url": "https://mcp.getrunpod.io/"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The hosted server uses the "Sign in with Runpod" OAuth flow for authentication, so no API key is stored. An OAuth-capable client starts the sign-in flow automatically on first connect. See [Sign in with Runpod (authorize flow)](#sign-in-with-runpod-authorize-flow) for details.
|
|
49
|
+
|
|
50
|
+
> Prefer your own API key instead of OAuth? Append `--header "Authorization: Bearer YOUR_API_KEY"` to the `claude mcp add` command (or add a `headers` block in the JSON), and the server forwards that key to the Runpod API directly.
|
|
51
|
+
|
|
52
|
+
### Requirements
|
|
15
53
|
|
|
16
54
|
- Node.js 18 or higher.
|
|
17
55
|
- A Runpod account and API key: https://www.runpod.io/console/user/settings
|
|
18
56
|
|
|
19
|
-
##
|
|
57
|
+
## Run locally with `npx`
|
|
20
58
|
|
|
21
|
-
|
|
59
|
+
To run the server as a local `stdio` process with your own API key:
|
|
22
60
|
|
|
23
61
|
```bash
|
|
24
62
|
RUNPOD_API_KEY=YOUR_API_KEY npx -y @runpod/mcp-server@latest
|
|
@@ -30,9 +68,9 @@ RUNPOD_API_KEY=YOUR_API_KEY npx -y @runpod/mcp-server@latest
|
|
|
30
68
|
npx -y @smithery/cli install @runpod/runpod-mcp-ts --client claude
|
|
31
69
|
```
|
|
32
70
|
|
|
33
|
-
## Local MCP
|
|
71
|
+
## Local MCP client setup
|
|
34
72
|
|
|
35
|
-
Local MCP clients should use the default package entrypoint, which is the `stdio` server.
|
|
73
|
+
Local MCP clients should use the default package entrypoint, which is the `stdio` server. The caller sets `RUNPOD_API_KEY` in the environment, and the server forwards it directly to the Runpod API.
|
|
36
74
|
|
|
37
75
|
### Claude Code
|
|
38
76
|
|
|
@@ -80,6 +118,8 @@ Windows:
|
|
|
80
118
|
|
|
81
119
|
Restart Claude Desktop after saving.
|
|
82
120
|
|
|
121
|
+
For remote clients such as Claude's connector, use the hosted HTTP server instead (the [Quick start](#quick-start) above). The client then runs the OAuth "Sign in with Runpod" flow, and the resulting Runpod API key is forwarded to the Runpod API on each request.
|
|
122
|
+
|
|
83
123
|
### Cursor
|
|
84
124
|
|
|
85
125
|
Add this to `.cursor/mcp.json` in your project or `~/.cursor/mcp.json` globally:
|
|
@@ -108,9 +148,42 @@ Use the same pattern:
|
|
|
108
148
|
|
|
109
149
|
For a broader list of MCP clients, see https://modelcontextprotocol.io/clients
|
|
110
150
|
|
|
151
|
+
## Usage examples
|
|
152
|
+
|
|
153
|
+
### List all Pods
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
Can you list all my Runpod Pods?
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Create a new Pod
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
Create a new Runpod Pod with the following specifications:
|
|
163
|
+
- Name: test-pod
|
|
164
|
+
- Image: runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel-ubuntu22.04
|
|
165
|
+
- GPU Type: NVIDIA GeForce RTX 4090
|
|
166
|
+
- GPU Count: 1
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Create a Serverless endpoint
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
Create a Runpod Serverless endpoint with the following configuration:
|
|
173
|
+
- Name: my-endpoint
|
|
174
|
+
- Image: runpod/test-output:0.0.1
|
|
175
|
+
- GPU pool: AMPERE_80 (a "pool" value from list-gpu-types)
|
|
176
|
+
- Minimum workers: 0
|
|
177
|
+
- Maximum workers: 3
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
On the v2 API (the default) endpoints are image-based — pass an image and a GPU
|
|
181
|
+
pool, not a template. To use the legacy template-based model, pin
|
|
182
|
+
`RUNPOD_REST_VERSION=v1` and provide a `Template ID` instead.
|
|
183
|
+
|
|
111
184
|
## Hosted HTTP deployment
|
|
112
185
|
|
|
113
|
-
The package also exports a Streamable HTTP entrypoint at `@runpod/mcp-server/http`, and this repo includes a Vercel function in `api/index.ts`.
|
|
186
|
+
The package also exports a Streamable HTTP entrypoint at `@runpod/mcp-server/http`, and this repo includes a Vercel function in `api/index.ts`. This is what powers the hosted server at `https://mcp.getrunpod.io/`.
|
|
114
187
|
|
|
115
188
|
The hosted transport is stateless:
|
|
116
189
|
|
|
@@ -190,12 +263,6 @@ This validates:
|
|
|
190
263
|
- A public GraphQL-backed tool call.
|
|
191
264
|
- An authenticated REST-backed tool call.
|
|
192
265
|
|
|
193
|
-
## Claude Desktop and hosted MCP
|
|
194
|
-
|
|
195
|
-
Use the local `stdio` integration for Claude Desktop today.
|
|
196
|
-
|
|
197
|
-
For remote clients such as Claude's connector, deploy the hosted HTTP server. The client then runs the OAuth "Sign in with Runpod" flow, and the resulting Runpod API key is forwarded to the Runpod API on each request.
|
|
198
|
-
|
|
199
266
|
## Local development
|
|
200
267
|
|
|
201
268
|
```bash
|
|
@@ -230,42 +297,20 @@ RUNPOD_API_KEY=YOUR_API_KEY pnpm build
|
|
|
230
297
|
RUNPOD_API_KEY=YOUR_API_KEY pnpm smoke:stdio
|
|
231
298
|
```
|
|
232
299
|
|
|
233
|
-
## Usage examples
|
|
234
|
-
|
|
235
|
-
### List all Pods
|
|
236
|
-
|
|
237
|
-
```text
|
|
238
|
-
Can you list all my Runpod Pods?
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Create a new Pod
|
|
242
|
-
|
|
243
|
-
```text
|
|
244
|
-
Create a new Runpod Pod with the following specifications:
|
|
245
|
-
- Name: test-pod
|
|
246
|
-
- Image: runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel-ubuntu22.04
|
|
247
|
-
- GPU Type: NVIDIA GeForce RTX 4090
|
|
248
|
-
- GPU Count: 1
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Create a Serverless endpoint
|
|
252
|
-
|
|
253
|
-
```text
|
|
254
|
-
Create a Runpod Serverless endpoint with the following configuration:
|
|
255
|
-
- Name: my-endpoint
|
|
256
|
-
- Template ID: 30zmvf89kd
|
|
257
|
-
- Minimum workers: 0
|
|
258
|
-
- Maximum workers: 3
|
|
259
|
-
```
|
|
260
|
-
|
|
261
300
|
## Contributing
|
|
262
301
|
|
|
263
302
|
The source is now split by responsibility:
|
|
264
303
|
|
|
265
|
-
- `src/stdio.ts`: local `stdio` entrypoint.
|
|
304
|
+
- `src/stdio.ts`: local `stdio` entrypoint (runs the v2 probe at startup for `auto` mode).
|
|
266
305
|
- `src/http.ts`: bearer-token extraction and the per-request MCP session for the Streamable HTTP transport.
|
|
267
|
-
- `src/tools.ts`:
|
|
306
|
+
- `src/tools.ts`: thin orchestrator — builds the shared runtime and calls each per-resource registrar.
|
|
307
|
+
- `src/tools/<resource>.ts`: the tools for one resource (`pods`, `endpoints`, `jobs`, `templates`, `network-volumes`, `registries`, `catalog`), each with a description + MCP annotations.
|
|
308
|
+
- `src/tools/runtime.ts`: the shared per-server runtime (caller-tracking, the authenticated REST/Serverless/GraphQL clients, the v1/v2 backend resolver) threaded into every registrar.
|
|
268
309
|
- `src/server.ts`: shared server metadata and construction.
|
|
310
|
+
- `src/_shared/backend.ts`: v1/v2 routing adapter — version resolution, per-resource paths, list-envelope unwrap, and the v2 probe.
|
|
311
|
+
- `src/_shared/http.ts`: unified authenticated JSON client + `HttpError`.
|
|
312
|
+
- `src/_shared/tracking.ts`: caller-tracking header construction.
|
|
313
|
+
- `src/_shared/mappers.ts`: v1→v2 request-body mappers.
|
|
269
314
|
- `api/index.ts`: Vercel adapter and the OAuth authorization-server routes (`/.well-known/*`, `/register`, `/authorize`, `/token`).
|
|
270
315
|
|
|
271
316
|
After changes:
|
|
@@ -273,9 +318,27 @@ After changes:
|
|
|
273
318
|
```bash
|
|
274
319
|
pnpm type-check
|
|
275
320
|
pnpm lint
|
|
321
|
+
pnpm test
|
|
276
322
|
pnpm build
|
|
277
323
|
```
|
|
278
324
|
|
|
325
|
+
`pnpm test` runs the offline unit suite (outbound-request goldens, adapter, mappers, http client) — no network or API key required.
|
|
326
|
+
|
|
327
|
+
### v2 spec parity gate
|
|
328
|
+
|
|
329
|
+
`tests/spec-parity.test.ts` walks every operation in the vendored v2 OpenAPI spec (`tests/fixtures/v2-openapi.yaml`) and fails if a v2 endpoint has no MCP tool covering it (and isn't explicitly allowlisted) — the drift gate that flags when the API grows an endpoint we don't expose yet. It also runs the reverse check (no tool is left unaccounted for). It's part of `pnpm test`, hermetic (parses the committed spec; no network, no API key).
|
|
330
|
+
|
|
331
|
+
Refresh the vendored spec when the v2 API changes:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
pnpm tsx scripts/fetch-v2-spec.ts # re-fetch tests/fixtures/v2-openapi.yaml
|
|
335
|
+
pnpm test # parity test shows any newly-uncovered endpoint
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
The serverless runtime tools (`run-endpoint`, `get-job-status`, …) target `api.runpod.ai/v2`, which is a different service from the v2 REST control plane, so they are allowlisted as intentionally spec-unmapped. The spec has no logs/artifacts endpoints, so there are no such tools.
|
|
339
|
+
|
|
340
|
+
An optional live shape check (skipped by default) verifies the live endpoints still return the envelopes the list tools unwrap; run it with `MCP_LIVE_V2_KEY=<dev-key> pnpm test` (optionally `MCP_LIVE_V2_BASE`).
|
|
341
|
+
|
|
279
342
|
For transport validation:
|
|
280
343
|
|
|
281
344
|
```bash
|
|
@@ -283,10 +346,77 @@ pnpm smoke:stdio
|
|
|
283
346
|
pnpm smoke:http
|
|
284
347
|
```
|
|
285
348
|
|
|
349
|
+
To exercise a real create→get→delete lifecycle against a **dev account** (free resources only — templates and registry auths — with fail-closed teardown):
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
RUNPOD_API_KEY=YOUR_DEV_KEY \
|
|
353
|
+
RUNPOD_REST_V2_API_URL=https://v2-rest.runpod.dev/v2 \
|
|
354
|
+
pnpm smoke:crud v1 v2
|
|
355
|
+
```
|
|
356
|
+
|
|
286
357
|
This project uses [changesets](https://github.com/changesets/changesets) for versioning and npm publishing. Every PR with user-facing changes needs a changeset file at `.changeset/DESCRIPTIVE_NAME.md`.
|
|
287
358
|
|
|
288
359
|
See `CLAUDE.md` and `docs/context.md` for contributor guidance.
|
|
289
360
|
|
|
361
|
+
## Reference
|
|
362
|
+
|
|
363
|
+
### Deployment modes
|
|
364
|
+
|
|
365
|
+
The server supports two deployment modes:
|
|
366
|
+
|
|
367
|
+
- Local `stdio` for Claude Desktop, Claude Code, Cursor, VS Code, and other MCP clients that launch a local process. The caller sets `RUNPOD_API_KEY` in the environment.
|
|
368
|
+
- Hosted Streamable HTTP for Vercel or other HTTP-capable platforms. Each request carries its own `Authorization: Bearer <token>`, which the server forwards directly to the Runpod API. The token can be a Runpod API key or one obtained through the OAuth "Sign in with Runpod" flow.
|
|
369
|
+
|
|
370
|
+
The server never holds a credential of its own and never shares one across users.
|
|
371
|
+
|
|
372
|
+
### REST API version (v1 / v2)
|
|
373
|
+
|
|
374
|
+
The server can target either the v1 REST API (`rest.runpod.io/v1`) or the newer v2 REST API (`v2-rest.runpod.io/v2`). It **defaults to v2**; set `RUNPOD_REST_VERSION=v1` to pin the previous v1 behavior. These environment variables are read once at startup:
|
|
375
|
+
|
|
376
|
+
| Variable | Values | Default | Effect |
|
|
377
|
+
| -------------------------------- | ---------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
378
|
+
| `RUNPOD_REST_VERSION` | `v1` \| `v2` \| `auto` | `v2` | Version used for all resources. |
|
|
379
|
+
| `RUNPOD_REST_VERSION_<RESOURCE>` | `v1` \| `v2` \| `auto` | — | Per-resource override (e.g. `RUNPOD_REST_VERSION_PODS=v2`). Takes precedence over the global setting. |
|
|
380
|
+
| `RUNPOD_REST_V2_API_URL` | URL | `https://v2-rest.runpod.io/v2` | v2 base URL. Override to target a non-prod host. |
|
|
381
|
+
| `RUNPOD_REST_API_URL` | URL | `https://rest.runpod.io/v1` | v1 base URL. |
|
|
382
|
+
| `RUNPOD_SERVERLESS_API_URL` | URL | `https://api.runpod.ai/v2` | Serverless runtime base URL. |
|
|
383
|
+
|
|
384
|
+
Notes:
|
|
385
|
+
|
|
386
|
+
- **Default is v2** — with nothing set, every control-plane resource uses the v2 REST API. Set `RUNPOD_REST_VERSION=v1` to pin the previous v1 behavior.
|
|
387
|
+
- **Pinning a deployment** — the env var is read once at startup, so set `RUNPOD_REST_VERSION` (`v1` or `v2`) in the host's environment (e.g. a Vercel project env var) and redeploy; no code change. Hosted HTTP honors this default like any other transport.
|
|
388
|
+
- **What `auto` does:** it probes v2 once at startup and falls back to v1 — but **only on the `stdio` transport** (one process = one key). On hosted HTTP `auto` resolves to **v1**, because a warm instance serves many users and a cached probe verdict could leak across them. `auto` is a stdio-only convenience; on HTTP, rely on the default or pin the version explicitly.
|
|
389
|
+
- `jobs` (serverless runtime) always uses v1 regardless of the setting — it has no v2 REST home (it targets `api.runpod.ai/v2`, a different service).
|
|
390
|
+
- The v2-only tools (`list-cpu-types`, `get-gpu-type`, `restart-pod`) return a clear "v2 only" notice when called under v1.
|
|
391
|
+
|
|
392
|
+
> **⚠️ Migration note — `create-endpoint` / `update-endpoint` changed shape in v2.** Serverless endpoints now use the v2 API (`/v2/serverless`) with an **inline config** instead of a `templateId`. On v2, `create-endpoint` requires `imageName` + `gpuPoolIds` (GPU **pool** names from `list-gpu-types` — the `pool` field, e.g. `AMPERE_80`), plus optional `workersMin`/`workersMax`, `scalerType`/`scalerValue`/`idleTimeout`, `containerDiskInGb`, `env`, `flashboot`, etc. It no longer accepts `templateId`. **If you previously called `create-endpoint` with `{ templateId }` and have no `RUNPOD_REST_VERSION` set, that call now returns a clean `400` after upgrading** — switch to the inline fields, or pin `RUNPOD_REST_VERSION=v1` to keep the legacy template-based model.
|
|
393
|
+
|
|
394
|
+
- `create-pod` for a **CPU pod** (`computeType: "CPU"`) on v2 is transparently served by the **v1** API — v2 has no CPU pods yet — and the reply is flagged `_servedBy: "v1"`. Because that fallback hits the **v1 base**, set `RUNPOD_REST_API_URL` to match your environment when running v2 against a non-prod host (otherwise CPU creates land on v1 **prod**). On v2 a create with neither `gpuTypeIds` nor `computeType` is rejected — absence is never silently turned into a CPU pod.
|
|
395
|
+
|
|
396
|
+
Example (stdio client config) — v2 against prod:
|
|
397
|
+
|
|
398
|
+
```json
|
|
399
|
+
"env": {
|
|
400
|
+
"RUNPOD_API_KEY": "YOUR_API_KEY",
|
|
401
|
+
"RUNPOD_REST_VERSION": "v2"
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Targeting a **non-prod (dev) environment** — point **both** bases at it (the v1 base matters even in v2 mode, for the CPU-pod fallback above):
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
"env": {
|
|
409
|
+
"RUNPOD_API_KEY": "YOUR_DEV_KEY",
|
|
410
|
+
"RUNPOD_REST_VERSION": "v2",
|
|
411
|
+
"RUNPOD_REST_V2_API_URL": "https://v2-rest.runpod.dev/v2",
|
|
412
|
+
"RUNPOD_REST_API_URL": "https://rest.runpod.dev/v1"
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Large tool output
|
|
417
|
+
|
|
418
|
+
Resource **lists** are paginated (default 20 items, `nextCursor`), so a big account can't flood the agent's context. But **serverless job output** — `run-endpoint`, `runsync-endpoint`, `get-job-status`, and especially `stream-job` (which accumulates every chunk) — is returned **as-is and is not size-capped**. It's a single opaque payload, not a list, so there's no cursor to page. A very large or long-streaming result can exceed the context window. If output may be huge, have the agent **write it to a file** instead of returning it inline, or set `s3Config` on the job so large outputs go to object storage.
|
|
419
|
+
|
|
290
420
|
## Security considerations
|
|
291
421
|
|
|
292
422
|
This server acts with the full permissions of the supplied `RUNPOD_API_KEY`.
|