@smithery/api 0.24.0 → 0.25.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 +13 -0
- package/client.d.mts +6 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -6
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/lib/mcp-transport.d.mts +16 -11
- package/lib/mcp-transport.d.mts.map +1 -1
- package/lib/mcp-transport.d.ts +16 -11
- package/lib/mcp-transport.d.ts.map +1 -1
- package/lib/mcp-transport.js +36 -16
- package/lib/mcp-transport.js.map +1 -1
- package/lib/mcp-transport.mjs +34 -14
- package/lib/mcp-transport.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/connect/connect.d.mts +2 -2
- package/resources/beta/connect/connect.d.mts.map +1 -1
- package/resources/beta/connect/connect.d.ts +2 -2
- package/resources/beta/connect/connect.d.ts.map +1 -1
- package/resources/beta/connect/connect.js.map +1 -1
- package/resources/beta/connect/connect.mjs.map +1 -1
- package/resources/beta/connect/connections.d.mts +38 -24
- package/resources/beta/connect/connections.d.mts.map +1 -1
- package/resources/beta/connect/connections.d.ts +38 -24
- package/resources/beta/connect/connections.d.ts.map +1 -1
- package/resources/beta/connect/connections.js +21 -21
- package/resources/beta/connect/connections.js.map +1 -1
- package/resources/beta/connect/connections.mjs +21 -21
- package/resources/beta/connect/connections.mjs.map +1 -1
- package/resources/beta/connect/index.d.mts +1 -1
- package/resources/beta/connect/index.d.mts.map +1 -1
- package/resources/beta/connect/index.d.ts +1 -1
- package/resources/beta/connect/index.d.ts.map +1 -1
- package/resources/beta/connect/index.js.map +1 -1
- package/resources/beta/connect/index.mjs.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/namespaces.d.mts +11 -16
- package/resources/namespaces.d.mts.map +1 -1
- package/resources/namespaces.d.ts +11 -16
- package/resources/namespaces.d.ts.map +1 -1
- package/resources/namespaces.js +12 -15
- package/resources/namespaces.js.map +1 -1
- package/resources/namespaces.mjs +12 -15
- package/resources/namespaces.mjs.map +1 -1
- package/resources/servers/deployments.d.mts +30 -27
- package/resources/servers/deployments.d.mts.map +1 -1
- package/resources/servers/deployments.d.ts +30 -27
- package/resources/servers/deployments.d.ts.map +1 -1
- package/resources/servers/deployments.js +7 -7
- package/resources/servers/deployments.js.map +1 -1
- package/resources/servers/deployments.mjs +7 -7
- package/resources/servers/deployments.mjs.map +1 -1
- package/resources/servers/index.d.mts +2 -2
- package/resources/servers/index.d.mts.map +1 -1
- package/resources/servers/index.d.ts +2 -2
- package/resources/servers/index.d.ts.map +1 -1
- package/resources/servers/servers.d.mts +30 -30
- package/resources/servers/servers.d.mts.map +1 -1
- package/resources/servers/servers.d.ts +30 -30
- package/resources/servers/servers.d.ts.map +1 -1
- package/resources/servers/servers.js +6 -6
- package/resources/servers/servers.js.map +1 -1
- package/resources/servers/servers.mjs +6 -6
- package/resources/servers/servers.mjs.map +1 -1
- package/resources/tokens.d.mts +96 -63
- package/resources/tokens.d.mts.map +1 -1
- package/resources/tokens.d.ts +96 -63
- package/resources/tokens.d.ts.map +1 -1
- package/resources/tokens.js +1 -4
- package/resources/tokens.js.map +1 -1
- package/resources/tokens.mjs +1 -4
- package/resources/tokens.mjs.map +1 -1
- package/src/client.ts +20 -5
- package/src/lib/mcp-transport.ts +42 -19
- package/src/resources/beta/connect/connect.ts +4 -2
- package/src/resources/beta/connect/connections.ts +53 -35
- package/src/resources/beta/connect/index.ts +2 -1
- package/src/resources/index.ts +13 -3
- package/src/resources/namespaces.ts +17 -17
- package/src/resources/servers/deployments.ts +45 -47
- package/src/resources/servers/index.ts +3 -3
- package/src/resources/servers/servers.ts +49 -49
- package/src/resources/tokens.ts +103 -58
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/lib/mcp-transport.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* SmitheryTransport - An MCP Transport that routes JSON-RPC messages through Smithery Connect.
|
|
3
3
|
*
|
|
4
4
|
* This allows you to use the official MCP SDK's Client class with Smithery Connect as the transport layer.
|
|
5
5
|
*
|
|
@@ -11,18 +11,17 @@
|
|
|
11
11
|
* ```typescript
|
|
12
12
|
* import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
13
13
|
* import Smithery from '@smithery/api';
|
|
14
|
-
* import {
|
|
14
|
+
* import { SmitheryTransport } from '@smithery/api/mcp';
|
|
15
15
|
*
|
|
16
16
|
* const smithery = new Smithery({ apiKey: process.env.SMITHERY_API_KEY });
|
|
17
|
-
* // Option 1: Let Smithery generate a connection ID
|
|
18
|
-
* const transport = new
|
|
17
|
+
* // Option 1: Let Smithery generate a connection ID and use default namespace
|
|
18
|
+
* const transport = new SmitheryTransport({
|
|
19
19
|
* client: smithery,
|
|
20
|
-
* namespace: 'my-namespace',
|
|
21
20
|
* mcpUrl: 'https://mcp.example.com/sse',
|
|
22
21
|
* });
|
|
23
22
|
*
|
|
24
|
-
* // Option 2: Use a specific connection ID
|
|
25
|
-
* const transport2 = new
|
|
23
|
+
* // Option 2: Use a specific namespace and connection ID
|
|
24
|
+
* const transport2 = new SmitheryTransport({
|
|
26
25
|
* client: smithery,
|
|
27
26
|
* namespace: 'my-namespace',
|
|
28
27
|
* connectionId: 'my-connection',
|
|
@@ -43,7 +42,7 @@ import type { JSONRPCMessage, JSONRPCResponse, ServerCapabilities } from '@model
|
|
|
43
42
|
import type { Smithery } from '../client';
|
|
44
43
|
import type { Connection } from '../resources/beta/connect/connections';
|
|
45
44
|
|
|
46
|
-
export interface
|
|
45
|
+
export interface SmitheryTransportOptions {
|
|
47
46
|
/**
|
|
48
47
|
* The Smithery client instance to use for making RPC calls.
|
|
49
48
|
*/
|
|
@@ -51,8 +50,9 @@ export interface SmitheryConnectTransportOptions {
|
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* The namespace for the Smithery Connect connection.
|
|
53
|
+
* If not provided, uses the first existing namespace or creates a new one.
|
|
54
54
|
*/
|
|
55
|
-
namespace
|
|
55
|
+
namespace?: string;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* The connection ID for the Smithery Connect connection.
|
|
@@ -77,9 +77,9 @@ export interface SmitheryConnectTransportOptions {
|
|
|
77
77
|
// MCP protocol version
|
|
78
78
|
const LATEST_PROTOCOL_VERSION = '2024-11-05';
|
|
79
79
|
|
|
80
|
-
export class
|
|
80
|
+
export class SmitheryTransport implements Transport {
|
|
81
81
|
private _client: Smithery;
|
|
82
|
-
private _namespace: string;
|
|
82
|
+
private _namespace: string | undefined;
|
|
83
83
|
private _connectionId: string | undefined;
|
|
84
84
|
private _mcpUrl: string | undefined;
|
|
85
85
|
private _started = false;
|
|
@@ -101,7 +101,7 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
101
101
|
return this._connectionId;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
constructor(options:
|
|
104
|
+
constructor(options: SmitheryTransportOptions) {
|
|
105
105
|
this._client = options.client;
|
|
106
106
|
this._namespace = options.namespace;
|
|
107
107
|
this._connectionId = options.connectionId;
|
|
@@ -124,7 +124,7 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
124
124
|
async start(): Promise<void> {
|
|
125
125
|
if (this._started) {
|
|
126
126
|
throw new Error(
|
|
127
|
-
'
|
|
127
|
+
'SmitheryTransport already started! If using Client class, note that connect() calls start() automatically.',
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
if (this._closed) {
|
|
@@ -134,6 +134,26 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
134
134
|
this._started = true;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Lazily ensures a namespace is available.
|
|
139
|
+
* If no namespace was provided, uses the first existing namespace or creates a new one.
|
|
140
|
+
*/
|
|
141
|
+
private async _ensureNamespace(): Promise<string> {
|
|
142
|
+
if (this._namespace) {
|
|
143
|
+
return this._namespace;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const { namespaces } = await this._client.namespaces.list();
|
|
147
|
+
if (namespaces.length > 0) {
|
|
148
|
+
this._namespace = namespaces[0]!.name;
|
|
149
|
+
} else {
|
|
150
|
+
// Create a new namespace with server-generated name
|
|
151
|
+
const { name } = await this._client.namespaces.create();
|
|
152
|
+
this._namespace = name;
|
|
153
|
+
}
|
|
154
|
+
return this._namespace;
|
|
155
|
+
}
|
|
156
|
+
|
|
137
157
|
/**
|
|
138
158
|
* Lazily ensures the Smithery Connect connection exists.
|
|
139
159
|
* Called on first message to defer network IO until actually needed.
|
|
@@ -143,17 +163,19 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
143
163
|
return;
|
|
144
164
|
}
|
|
145
165
|
|
|
166
|
+
const namespace = await this._ensureNamespace();
|
|
167
|
+
|
|
146
168
|
if (this._connectionId) {
|
|
147
|
-
// Connection ID provided: try to
|
|
169
|
+
// Connection ID provided: try to get, or create if mcpUrl is provided
|
|
148
170
|
try {
|
|
149
|
-
this._connection = await this._client.beta.connect.connections.
|
|
150
|
-
namespace
|
|
171
|
+
this._connection = await this._client.beta.connect.connections.get(this._connectionId, {
|
|
172
|
+
namespace,
|
|
151
173
|
});
|
|
152
174
|
} catch (error) {
|
|
153
175
|
// If connection doesn't exist and we have mcpUrl, create it with the specified ID
|
|
154
176
|
if (this._mcpUrl) {
|
|
155
177
|
this._connection = await this._client.beta.connect.connections.set(this._connectionId, {
|
|
156
|
-
namespace
|
|
178
|
+
namespace,
|
|
157
179
|
mcpUrl: this._mcpUrl,
|
|
158
180
|
});
|
|
159
181
|
} else {
|
|
@@ -163,7 +185,7 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
163
185
|
} else {
|
|
164
186
|
// No connection ID: create a new connection with auto-generated ID
|
|
165
187
|
// mcpUrl is guaranteed to be present (validated in constructor)
|
|
166
|
-
this._connection = await this._client.beta.connect.connections.create(
|
|
188
|
+
this._connection = await this._client.beta.connect.connections.create(namespace, {
|
|
167
189
|
mcpUrl: this._mcpUrl!,
|
|
168
190
|
});
|
|
169
191
|
// Store the generated connection ID for subsequent RPC calls
|
|
@@ -221,8 +243,9 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
221
243
|
|
|
222
244
|
try {
|
|
223
245
|
// Build the RPC call params, only including id if it's defined
|
|
246
|
+
// _namespace is guaranteed to be set after _ensureConnection
|
|
224
247
|
const rpcParams: Parameters<typeof this._client.beta.connect.rpc.call>[1] = {
|
|
225
|
-
namespace: this._namespace
|
|
248
|
+
namespace: this._namespace!,
|
|
226
249
|
jsonrpc: '2.0',
|
|
227
250
|
method: message.method,
|
|
228
251
|
};
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
ConnectionCreateParams,
|
|
8
8
|
ConnectionDeleteParams,
|
|
9
9
|
ConnectionDeleteResponse,
|
|
10
|
-
|
|
10
|
+
ConnectionGetParams,
|
|
11
|
+
ConnectionListParams,
|
|
11
12
|
ConnectionSetParams,
|
|
12
13
|
Connections,
|
|
13
14
|
ConnectionsListResponse,
|
|
@@ -32,8 +33,9 @@ export declare namespace Connect {
|
|
|
32
33
|
type CreateConnectionRequest as CreateConnectionRequest,
|
|
33
34
|
type ConnectionDeleteResponse as ConnectionDeleteResponse,
|
|
34
35
|
type ConnectionCreateParams as ConnectionCreateParams,
|
|
35
|
-
type
|
|
36
|
+
type ConnectionListParams as ConnectionListParams,
|
|
36
37
|
type ConnectionDeleteParams as ConnectionDeleteParams,
|
|
38
|
+
type ConnectionGetParams as ConnectionGetParams,
|
|
37
39
|
type ConnectionSetParams as ConnectionSetParams,
|
|
38
40
|
};
|
|
39
41
|
|
|
@@ -24,30 +24,8 @@ export class Connections extends APIResource {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const connection =
|
|
33
|
-
* await client.beta.connect.connections.retrieve(
|
|
34
|
-
* 'connectionId',
|
|
35
|
-
* { namespace: 'namespace' },
|
|
36
|
-
* );
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
retrieve(
|
|
40
|
-
connectionID: string,
|
|
41
|
-
params: ConnectionRetrieveParams,
|
|
42
|
-
options?: RequestOptions,
|
|
43
|
-
): APIPromise<Connection> {
|
|
44
|
-
const { namespace } = params;
|
|
45
|
-
return this._client.get(path`/connect/${namespace}/${connectionID}`, options);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* List all connections in a namespace. Requires service token with
|
|
50
|
-
* connections:read scope.
|
|
27
|
+
* List all connections in a namespace. Supports filtering by metadata using
|
|
28
|
+
* `metadata.{key}={value}` query params (e.g., `metadata.userId=alice`).
|
|
51
29
|
*
|
|
52
30
|
* @example
|
|
53
31
|
* ```ts
|
|
@@ -55,8 +33,12 @@ export class Connections extends APIResource {
|
|
|
55
33
|
* await client.beta.connect.connections.list('namespace');
|
|
56
34
|
* ```
|
|
57
35
|
*/
|
|
58
|
-
list(
|
|
59
|
-
|
|
36
|
+
list(
|
|
37
|
+
namespace: string,
|
|
38
|
+
query: ConnectionListParams | null | undefined = {},
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<ConnectionsListResponse> {
|
|
41
|
+
return this._client.get(path`/connect/${namespace}`, { query, ...options });
|
|
60
42
|
}
|
|
61
43
|
|
|
62
44
|
/**
|
|
@@ -81,6 +63,24 @@ export class Connections extends APIResource {
|
|
|
81
63
|
return this._client.delete(path`/connect/${namespace}/${connectionID}`, options);
|
|
82
64
|
}
|
|
83
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Get details for a specific connection. Requires service token with
|
|
68
|
+
* connections:read scope.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const connection =
|
|
73
|
+
* await client.beta.connect.connections.get(
|
|
74
|
+
* 'connectionId',
|
|
75
|
+
* { namespace: 'namespace' },
|
|
76
|
+
* );
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
get(connectionID: string, params: ConnectionGetParams, options?: RequestOptions): APIPromise<Connection> {
|
|
80
|
+
const { namespace } = params;
|
|
81
|
+
return this._client.get(path`/connect/${namespace}/${connectionID}`, options);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
84
|
/**
|
|
85
85
|
* Create a new MCP connection with the given ID. Returns 409 if connection already
|
|
86
86
|
* exists - delete it first to recreate. Requires API key and namespace ownership.
|
|
@@ -137,9 +137,9 @@ export interface Connection {
|
|
|
137
137
|
* Connection status after initialization (only returned on create)
|
|
138
138
|
*/
|
|
139
139
|
status?:
|
|
140
|
-
| Connection.
|
|
141
|
-
| Connection.
|
|
142
|
-
| Connection.
|
|
140
|
+
| Connection.ConnectionStatusConnected
|
|
141
|
+
| Connection.ConnectionStatusAuthRequired
|
|
142
|
+
| Connection.ConnectionStatusError;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export namespace Connection {
|
|
@@ -172,11 +172,11 @@ export namespace Connection {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
export interface
|
|
175
|
+
export interface ConnectionStatusConnected {
|
|
176
176
|
state: 'connected';
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
export interface
|
|
179
|
+
export interface ConnectionStatusAuthRequired {
|
|
180
180
|
state: 'auth_required';
|
|
181
181
|
|
|
182
182
|
/**
|
|
@@ -185,7 +185,7 @@ export namespace Connection {
|
|
|
185
185
|
authorizationUrl?: string;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
export interface
|
|
188
|
+
export interface ConnectionStatusError {
|
|
189
189
|
/**
|
|
190
190
|
* Error message
|
|
191
191
|
*/
|
|
@@ -254,14 +254,31 @@ export interface ConnectionCreateParams {
|
|
|
254
254
|
name?: string;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
export interface
|
|
258
|
-
|
|
257
|
+
export interface ConnectionListParams {
|
|
258
|
+
/**
|
|
259
|
+
* Pagination cursor from previous response's nextCursor
|
|
260
|
+
*/
|
|
261
|
+
cursor?: string;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Maximum number of items to return (default 100, max 100)
|
|
265
|
+
*/
|
|
266
|
+
limit?: number;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Filter by exact connection name
|
|
270
|
+
*/
|
|
271
|
+
name?: string;
|
|
259
272
|
}
|
|
260
273
|
|
|
261
274
|
export interface ConnectionDeleteParams {
|
|
262
275
|
namespace: string;
|
|
263
276
|
}
|
|
264
277
|
|
|
278
|
+
export interface ConnectionGetParams {
|
|
279
|
+
namespace: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
265
282
|
export interface ConnectionSetParams {
|
|
266
283
|
/**
|
|
267
284
|
* Path param
|
|
@@ -297,8 +314,9 @@ export declare namespace Connections {
|
|
|
297
314
|
type CreateConnectionRequest as CreateConnectionRequest,
|
|
298
315
|
type ConnectionDeleteResponse as ConnectionDeleteResponse,
|
|
299
316
|
type ConnectionCreateParams as ConnectionCreateParams,
|
|
300
|
-
type
|
|
317
|
+
type ConnectionListParams as ConnectionListParams,
|
|
301
318
|
type ConnectionDeleteParams as ConnectionDeleteParams,
|
|
319
|
+
type ConnectionGetParams as ConnectionGetParams,
|
|
302
320
|
type ConnectionSetParams as ConnectionSetParams,
|
|
303
321
|
};
|
|
304
322
|
}
|
|
@@ -8,8 +8,9 @@ export {
|
|
|
8
8
|
type CreateConnectionRequest,
|
|
9
9
|
type ConnectionDeleteResponse,
|
|
10
10
|
type ConnectionCreateParams,
|
|
11
|
-
type
|
|
11
|
+
type ConnectionListParams,
|
|
12
12
|
type ConnectionDeleteParams,
|
|
13
|
+
type ConnectionGetParams,
|
|
13
14
|
type ConnectionSetParams,
|
|
14
15
|
} from './connections';
|
|
15
16
|
export { Rpc, type JsonRpcRequest, type JsonRpcResponse, type RpcCallParams } from './rpc';
|
package/src/resources/index.ts
CHANGED
|
@@ -6,16 +6,16 @@ export {
|
|
|
6
6
|
Namespaces,
|
|
7
7
|
type NamespaceCreateResponse,
|
|
8
8
|
type NamespaceListResponse,
|
|
9
|
-
type
|
|
9
|
+
type NamespaceSetResponse,
|
|
10
10
|
} from './namespaces';
|
|
11
11
|
export {
|
|
12
12
|
Servers,
|
|
13
13
|
type BuildConfig,
|
|
14
14
|
type DeploymentTarget,
|
|
15
15
|
type ProjectConfig,
|
|
16
|
-
type ServerRetrieveResponse,
|
|
17
16
|
type ServerListResponse,
|
|
18
17
|
type ServerDeleteResponse,
|
|
18
|
+
type ServerGetResponse,
|
|
19
19
|
type ServerListParams,
|
|
20
20
|
type ServerListResponsesSmitheryPage,
|
|
21
21
|
} from './servers/servers';
|
|
@@ -25,5 +25,15 @@ export {
|
|
|
25
25
|
type SkillListParams,
|
|
26
26
|
type SkillListResponsesSkillsPage,
|
|
27
27
|
} from './skills';
|
|
28
|
-
export {
|
|
28
|
+
export {
|
|
29
|
+
Tokens,
|
|
30
|
+
type Action,
|
|
31
|
+
type Allow,
|
|
32
|
+
type ConnectionScope,
|
|
33
|
+
type CreateTokenRequest,
|
|
34
|
+
type CreateTokenResponse,
|
|
35
|
+
type ResourceScope,
|
|
36
|
+
type RpcScope,
|
|
37
|
+
type TokenCreateParams,
|
|
38
|
+
} from './tokens';
|
|
29
39
|
export { Uplink, type UplinkCreateTokenResponse } from './uplink';
|
|
@@ -3,33 +3,31 @@
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
import { path } from '../internal/utils/path';
|
|
6
7
|
|
|
7
8
|
export class Namespaces extends APIResource {
|
|
8
9
|
/**
|
|
9
|
-
* Create a new namespace owned by the
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const namespace = await client.namespaces.create({
|
|
14
|
-
* name: 'myorg',
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
10
|
+
* Create a new namespace with a server-generated human-readable name, owned by the
|
|
11
|
+
* authenticated user
|
|
17
12
|
*/
|
|
18
|
-
create(
|
|
19
|
-
return this._client.
|
|
13
|
+
create(options?: RequestOptions): APIPromise<NamespaceCreateResponse> {
|
|
14
|
+
return this._client.post('/namespaces', options);
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
18
|
* Get a list of all namespaces owned by the authenticated user
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const namespaces = await client.namespaces.list();
|
|
28
|
-
* ```
|
|
29
19
|
*/
|
|
30
20
|
list(options?: RequestOptions): APIPromise<NamespaceListResponse> {
|
|
31
21
|
return this._client.get('/namespaces', options);
|
|
32
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Create a new namespace with a user-specified name, owned by the authenticated
|
|
26
|
+
* user
|
|
27
|
+
*/
|
|
28
|
+
set(name: string, options?: RequestOptions): APIPromise<NamespaceSetResponse> {
|
|
29
|
+
return this._client.put(path`/namespaces/${name}`, options);
|
|
30
|
+
}
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export interface NamespaceCreateResponse {
|
|
@@ -50,7 +48,9 @@ export namespace NamespaceListResponse {
|
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
export interface
|
|
51
|
+
export interface NamespaceSetResponse {
|
|
52
|
+
createdAt: string;
|
|
53
|
+
|
|
54
54
|
name: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -58,6 +58,6 @@ export declare namespace Namespaces {
|
|
|
58
58
|
export {
|
|
59
59
|
type NamespaceCreateResponse as NamespaceCreateResponse,
|
|
60
60
|
type NamespaceListResponse as NamespaceListResponse,
|
|
61
|
-
type
|
|
61
|
+
type NamespaceSetResponse as NamespaceSetResponse,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -8,18 +8,6 @@ import { multipartFormRequestOptions } from '../../internal/uploads';
|
|
|
8
8
|
import { path } from '../../internal/utils/path';
|
|
9
9
|
|
|
10
10
|
export class Deployments extends APIResource {
|
|
11
|
-
/**
|
|
12
|
-
* Get deployment status
|
|
13
|
-
*/
|
|
14
|
-
retrieve(
|
|
15
|
-
id: string,
|
|
16
|
-
params: DeploymentRetrieveParams,
|
|
17
|
-
options?: RequestOptions,
|
|
18
|
-
): APIPromise<DeploymentRetrieveResponse> {
|
|
19
|
-
const { qualifiedName } = params;
|
|
20
|
-
return this._client.get(path`/servers/${qualifiedName}/deployments/${id}`, options);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
/**
|
|
24
12
|
* List deployments for a server
|
|
25
13
|
*/
|
|
@@ -41,6 +29,14 @@ export class Deployments extends APIResource {
|
|
|
41
29
|
);
|
|
42
30
|
}
|
|
43
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Get deployment status
|
|
34
|
+
*/
|
|
35
|
+
get(id: string, params: DeploymentGetParams, options?: RequestOptions): APIPromise<DeploymentGetResponse> {
|
|
36
|
+
const { qualifiedName } = params;
|
|
37
|
+
return this._client.get(path`/servers/${qualifiedName}/deployments/${id}`, options);
|
|
38
|
+
}
|
|
39
|
+
|
|
44
40
|
/**
|
|
45
41
|
* Use id='latest' to resume the most recent deployment
|
|
46
42
|
*/
|
|
@@ -72,6 +68,8 @@ export interface ExternalDeployPayload {
|
|
|
72
68
|
upstreamUrl: string;
|
|
73
69
|
|
|
74
70
|
configSchema?: { [key: string]: unknown };
|
|
71
|
+
|
|
72
|
+
scanCredentials?: { [key: string]: string };
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
export interface HostedDeployPayload {
|
|
@@ -302,7 +300,33 @@ export namespace StdioDeployPayload {
|
|
|
302
300
|
}
|
|
303
301
|
}
|
|
304
302
|
|
|
305
|
-
export
|
|
303
|
+
export type DeploymentListResponse = Array<DeploymentListResponse.DeploymentListResponseItem>;
|
|
304
|
+
|
|
305
|
+
export namespace DeploymentListResponse {
|
|
306
|
+
export interface DeploymentListResponseItem {
|
|
307
|
+
id: string;
|
|
308
|
+
|
|
309
|
+
createdAt: string;
|
|
310
|
+
|
|
311
|
+
status: string;
|
|
312
|
+
|
|
313
|
+
updatedAt: string;
|
|
314
|
+
|
|
315
|
+
mcpUrl?: string;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface DeploymentDeployResponse {
|
|
320
|
+
deploymentId: string;
|
|
321
|
+
|
|
322
|
+
mcpUrl: string;
|
|
323
|
+
|
|
324
|
+
status: string;
|
|
325
|
+
|
|
326
|
+
warnings?: Array<string>;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface DeploymentGetResponse {
|
|
306
330
|
id: string;
|
|
307
331
|
|
|
308
332
|
createdAt: string;
|
|
@@ -311,12 +335,12 @@ export interface DeploymentRetrieveResponse {
|
|
|
311
335
|
|
|
312
336
|
updatedAt: string;
|
|
313
337
|
|
|
314
|
-
logs?: Array<
|
|
338
|
+
logs?: Array<DeploymentGetResponse.Log>;
|
|
315
339
|
|
|
316
340
|
mcpUrl?: string;
|
|
317
341
|
}
|
|
318
342
|
|
|
319
|
-
export namespace
|
|
343
|
+
export namespace DeploymentGetResponse {
|
|
320
344
|
export interface Log {
|
|
321
345
|
level: string;
|
|
322
346
|
|
|
@@ -336,42 +360,12 @@ export namespace DeploymentRetrieveResponse {
|
|
|
336
360
|
}
|
|
337
361
|
}
|
|
338
362
|
|
|
339
|
-
export type DeploymentListResponse = Array<DeploymentListResponse.DeploymentListResponseItem>;
|
|
340
|
-
|
|
341
|
-
export namespace DeploymentListResponse {
|
|
342
|
-
export interface DeploymentListResponseItem {
|
|
343
|
-
id: string;
|
|
344
|
-
|
|
345
|
-
createdAt: string;
|
|
346
|
-
|
|
347
|
-
status: string;
|
|
348
|
-
|
|
349
|
-
updatedAt: string;
|
|
350
|
-
|
|
351
|
-
mcpUrl?: string;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export interface DeploymentDeployResponse {
|
|
356
|
-
deploymentId: string;
|
|
357
|
-
|
|
358
|
-
mcpUrl: string;
|
|
359
|
-
|
|
360
|
-
status: string;
|
|
361
|
-
|
|
362
|
-
warnings?: Array<string>;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
363
|
export interface DeploymentResumeResponse {
|
|
366
364
|
deploymentId: string;
|
|
367
365
|
|
|
368
366
|
status: string;
|
|
369
367
|
}
|
|
370
368
|
|
|
371
|
-
export interface DeploymentRetrieveParams {
|
|
372
|
-
qualifiedName: string;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
369
|
export interface DeploymentDeployParams {
|
|
376
370
|
/**
|
|
377
371
|
* JSON-encoded deployment payload. See DeployPayload schema for structure.
|
|
@@ -394,6 +388,10 @@ export interface DeploymentDeployParams {
|
|
|
394
388
|
sourcemap?: Uploadable;
|
|
395
389
|
}
|
|
396
390
|
|
|
391
|
+
export interface DeploymentGetParams {
|
|
392
|
+
qualifiedName: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
397
395
|
export interface DeploymentResumeParams {
|
|
398
396
|
qualifiedName: string;
|
|
399
397
|
}
|
|
@@ -405,12 +403,12 @@ export declare namespace Deployments {
|
|
|
405
403
|
type HostedDeployPayload as HostedDeployPayload,
|
|
406
404
|
type ServerCard as ServerCard,
|
|
407
405
|
type StdioDeployPayload as StdioDeployPayload,
|
|
408
|
-
type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
|
|
409
406
|
type DeploymentListResponse as DeploymentListResponse,
|
|
410
407
|
type DeploymentDeployResponse as DeploymentDeployResponse,
|
|
408
|
+
type DeploymentGetResponse as DeploymentGetResponse,
|
|
411
409
|
type DeploymentResumeResponse as DeploymentResumeResponse,
|
|
412
|
-
type DeploymentRetrieveParams as DeploymentRetrieveParams,
|
|
413
410
|
type DeploymentDeployParams as DeploymentDeployParams,
|
|
411
|
+
type DeploymentGetParams as DeploymentGetParams,
|
|
414
412
|
type DeploymentResumeParams as DeploymentResumeParams,
|
|
415
413
|
};
|
|
416
414
|
}
|
|
@@ -7,12 +7,12 @@ export {
|
|
|
7
7
|
type HostedDeployPayload,
|
|
8
8
|
type ServerCard,
|
|
9
9
|
type StdioDeployPayload,
|
|
10
|
-
type DeploymentRetrieveResponse,
|
|
11
10
|
type DeploymentListResponse,
|
|
12
11
|
type DeploymentDeployResponse,
|
|
12
|
+
type DeploymentGetResponse,
|
|
13
13
|
type DeploymentResumeResponse,
|
|
14
|
-
type DeploymentRetrieveParams,
|
|
15
14
|
type DeploymentDeployParams,
|
|
15
|
+
type DeploymentGetParams,
|
|
16
16
|
type DeploymentResumeParams,
|
|
17
17
|
} from './deployments';
|
|
18
18
|
export { Logs, type LogListResponse, type LogListParams } from './logs';
|
|
@@ -29,9 +29,9 @@ export {
|
|
|
29
29
|
type BuildConfig,
|
|
30
30
|
type DeploymentTarget,
|
|
31
31
|
type ProjectConfig,
|
|
32
|
-
type ServerRetrieveResponse,
|
|
33
32
|
type ServerListResponse,
|
|
34
33
|
type ServerDeleteResponse,
|
|
34
|
+
type ServerGetResponse,
|
|
35
35
|
type ServerListParams,
|
|
36
36
|
type ServerListResponsesSmitheryPage,
|
|
37
37
|
} from './servers';
|