Skip to content

Commit a6f483f

Browse files
feat(devbox): add mcp configuration to devbox create (#7341)
1 parent 061f3ec commit a6f483f

9 files changed

Lines changed: 95 additions & 8 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-eb90951855ef91c431a7b07ea6a42c1c470c1a0c905e19e4926b48e8039bf4cb.yml
3-
openapi_spec_hash: e98232f95d6fd27f1200e354cee0059a
1+
configured_endpoints: 117
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-15b7fd06098d8cb3639efb3b401a03d7d97a8ab4960b08077aa871f0cacb33d3.yml
3+
openapi_spec_hash: 93ab2fe88f9e57d8f262ad6d1179190e
44
config_hash: eb28692edd68a6ae95cf92af931c9976

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,14 @@ Methods:
263263

264264
Types:
265265

266+
- <code><a href="./src/resources/scenarios/scorers.ts">ScorerCreateResponse</a></code>
266267
- <code><a href="./src/resources/scenarios/scorers.ts">ScorerRetrieveResponse</a></code>
267268
- <code><a href="./src/resources/scenarios/scorers.ts">ScorerUpdateResponse</a></code>
268269
- <code><a href="./src/resources/scenarios/scorers.ts">ScorerListResponse</a></code>
269270

270271
Methods:
271272

273+
- <code title="post /v1/scenarios/scorers">client.scenarios.scorers.<a href="./src/resources/scenarios/scorers.ts">create</a>({ ...params }) -> ScorerCreateResponse</code>
272274
- <code title="get /v1/scenarios/scorers/{id}">client.scenarios.scorers.<a href="./src/resources/scenarios/scorers.ts">retrieve</a>(id) -> ScorerRetrieveResponse</code>
273275
- <code title="post /v1/scenarios/scorers/{id}">client.scenarios.scorers.<a href="./src/resources/scenarios/scorers.ts">update</a>(id, { ...params }) -> ScorerUpdateResponse</code>
274276
- <code title="get /v1/scenarios/scorers">client.scenarios.scorers.<a href="./src/resources/scenarios/scorers.ts">list</a>({ ...params }) -> ScorerListResponsesScenarioScorersCursorIDPage</code>

src/resources/devboxes/devboxes.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,14 @@ export interface DevboxCreateParams {
11041104
*/
11051105
launch_parameters?: Shared.LaunchParameters | null;
11061106

1107+
/**
1108+
* [Beta] (Optional) MCP specifications for MCP server access. Each spec links an
1109+
* MCP config to a secret. The devbox will receive environment variables
1110+
* (RL_MCP_URL, RL_MCP_TOKEN) for accessing MCP servers through the MCP hub.
1111+
* Example: [{'mcp_config': 'github-readonly', 'secret': 'MY_GITHUB_TOKEN'}]
1112+
*/
1113+
mcp?: Array<DevboxCreateParams.Mcp> | null;
1114+
11071115
/**
11081116
* User defined metadata to attach to the devbox for organization.
11091117
*/
@@ -1164,6 +1172,24 @@ export namespace DevboxCreateParams {
11641172
secret: string;
11651173
}
11661174

1175+
/**
1176+
* [Beta] McpSpec links an MCP configuration to a secret for MCP server access in a
1177+
* devbox. The MCP hub will proxy requests to upstream MCP servers using the
1178+
* specified credential, with tool-level access control based on the MCP config's
1179+
* allowed_tools.
1180+
*/
1181+
export interface Mcp {
1182+
/**
1183+
* The MCP config to use. Can be an MCP config ID (mcp_xxx) or name.
1184+
*/
1185+
mcp_config: string;
1186+
1187+
/**
1188+
* The secret containing the MCP server credential. Can be a secret ID or name.
1189+
*/
1190+
secret: string;
1191+
}
1192+
11671193
/**
11681194
* (Optional) Configuration for creating a V2 tunnel at Devbox launch time. When
11691195
* specified, a tunnel will be automatically provisioned and the tunnel details

src/resources/mcp-configs.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,6 @@ export interface McpConfigView {
184184
*/
185185
name: string;
186186

187-
/**
188-
* The account ID that owns this config.
189-
*/
190-
account_id?: string | null;
191-
192187
/**
193188
* Optional description for this MCP configuration.
194189
*/

src/resources/scenarios/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ export {
2828
export {
2929
ScorerListResponsesScenarioScorersCursorIDPage,
3030
Scorers,
31+
type ScorerCreateResponse,
3132
type ScorerRetrieveResponse,
3233
type ScorerUpdateResponse,
3334
type ScorerListResponse,
35+
type ScorerCreateParams,
3436
type ScorerUpdateParams,
3537
type ScorerListParams,
3638
} from './scorers';

src/resources/scenarios/scenarios.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import * as RunsAPI from './runs';
88
import { RunListParams, Runs } from './runs';
99
import * as ScorersAPI from './scorers';
1010
import {
11+
ScorerCreateParams,
12+
ScorerCreateResponse,
1113
ScorerListParams,
1214
ScorerListResponse,
1315
ScorerListResponsesScenarioScorersCursorIDPage,
@@ -874,10 +876,12 @@ export declare namespace Scenarios {
874876

875877
export {
876878
Scorers as Scorers,
879+
type ScorerCreateResponse as ScorerCreateResponse,
877880
type ScorerRetrieveResponse as ScorerRetrieveResponse,
878881
type ScorerUpdateResponse as ScorerUpdateResponse,
879882
type ScorerListResponse as ScorerListResponse,
880883
ScorerListResponsesScenarioScorersCursorIDPage as ScorerListResponsesScenarioScorersCursorIDPage,
884+
type ScorerCreateParams as ScorerCreateParams,
881885
type ScorerUpdateParams as ScorerUpdateParams,
882886
type ScorerListParams as ScorerListParams,
883887
};

src/resources/scenarios/scorers.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import * as Core from '../../core';
66
import { ScenarioScorersCursorIDPage, type ScenarioScorersCursorIDPageParams } from '../../pagination';
77

88
export class Scorers extends APIResource {
9+
/**
10+
* Create a custom scenario scorer.
11+
*/
12+
create(body: ScorerCreateParams, options?: Core.RequestOptions): Core.APIPromise<ScorerCreateResponse> {
13+
return this._client.post('/v1/scenarios/scorers', { body, ...options });
14+
}
15+
916
/**
1017
* Retrieve Scenario Scorer.
1118
*/
@@ -50,6 +57,26 @@ export class Scorers extends APIResource {
5057

5158
export class ScorerListResponsesScenarioScorersCursorIDPage extends ScenarioScorersCursorIDPage<ScorerListResponse> {}
5259

60+
/**
61+
* A ScenarioScorerView represents a custom scoring function for a Scenario.
62+
*/
63+
export interface ScorerCreateResponse {
64+
/**
65+
* ID for the scenario scorer.
66+
*/
67+
id: string;
68+
69+
/**
70+
* Bash script that takes in $RL_SCORER_CONTEXT as env variable and runs scoring.
71+
*/
72+
bash_script: string;
73+
74+
/**
75+
* Name of the type of scenario scorer.
76+
*/
77+
type: string;
78+
}
79+
5380
/**
5481
* A ScenarioScorerView represents a custom scoring function for a Scenario.
5582
*/
@@ -110,6 +137,19 @@ export interface ScorerListResponse {
110137
type: string;
111138
}
112139

140+
export interface ScorerCreateParams {
141+
/**
142+
* Bash script for the custom scorer taking context as a json object
143+
* $RL_SCORER_CONTEXT.
144+
*/
145+
bash_script: string;
146+
147+
/**
148+
* Name of the type of custom scorer.
149+
*/
150+
type: string;
151+
}
152+
113153
export interface ScorerUpdateParams {
114154
/**
115155
* Bash script for the custom scorer taking context as a json object
@@ -129,10 +169,12 @@ Scorers.ScorerListResponsesScenarioScorersCursorIDPage = ScorerListResponsesScen
129169

130170
export declare namespace Scorers {
131171
export {
172+
type ScorerCreateResponse as ScorerCreateResponse,
132173
type ScorerRetrieveResponse as ScorerRetrieveResponse,
133174
type ScorerUpdateResponse as ScorerUpdateResponse,
134175
type ScorerListResponse as ScorerListResponse,
135176
ScorerListResponsesScenarioScorersCursorIDPage as ScorerListResponsesScenarioScorersCursorIDPage,
177+
type ScorerCreateParams as ScorerCreateParams,
136178
type ScorerUpdateParams as ScorerUpdateParams,
137179
type ScorerListParams as ScorerListParams,
138180
};

tests/api-resources/devboxes/devboxes.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe('resource devboxes', () => {
6161
resource_size_request: 'X_SMALL',
6262
user_parameters: { uid: 0, username: 'username' },
6363
},
64+
mcp: [{ mcp_config: 'mcp_config', secret: 'secret' }],
6465
metadata: { foo: 'string' },
6566
mounts: [
6667
{

tests/api-resources/scenarios/scorers.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ const client = new Runloop({
99
});
1010

1111
describe('resource scorers', () => {
12+
test('create: only required params', async () => {
13+
const responsePromise = client.scenarios.scorers.create({ bash_script: 'bash_script', type: 'type' });
14+
const rawResponse = await responsePromise.asResponse();
15+
expect(rawResponse).toBeInstanceOf(Response);
16+
const response = await responsePromise;
17+
expect(response).not.toBeInstanceOf(Response);
18+
const dataAndResponse = await responsePromise.withResponse();
19+
expect(dataAndResponse.data).toBe(response);
20+
expect(dataAndResponse.response).toBe(rawResponse);
21+
});
22+
23+
test('create: required and optional params', async () => {
24+
const response = await client.scenarios.scorers.create({ bash_script: 'bash_script', type: 'type' });
25+
});
26+
1227
test('retrieve', async () => {
1328
const responsePromise = client.scenarios.scorers.retrieve('id');
1429
const rawResponse = await responsePromise.asResponse();

0 commit comments

Comments
 (0)