@smithery/api 0.24.0 → 0.26.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 +22 -0
- package/client.d.mts +9 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -7
- 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/core/pagination.d.mts +14 -0
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +14 -0
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +25 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +23 -0
- package/core/pagination.mjs.map +1 -1
- package/lib/mcp-transport.d.mts +20 -15
- package/lib/mcp-transport.d.mts.map +1 -1
- package/lib/mcp-transport.d.ts +20 -15
- package/lib/mcp-transport.d.ts.map +1 -1
- package/lib/mcp-transport.js +39 -19
- package/lib/mcp-transport.js.map +1 -1
- package/lib/mcp-transport.mjs +37 -17
- package/lib/mcp-transport.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/connect/connect.d.mts +6 -2
- package/resources/beta/connect/connect.d.mts.map +1 -1
- package/resources/beta/connect/connect.d.ts +6 -2
- package/resources/beta/connect/connect.d.ts.map +1 -1
- package/resources/beta/connect/connect.js +4 -0
- package/resources/beta/connect/connect.js.map +1 -1
- package/resources/beta/connect/connect.mjs +4 -0
- 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 +2 -1
- package/resources/beta/connect/index.d.mts.map +1 -1
- package/resources/beta/connect/index.d.ts +2 -1
- package/resources/beta/connect/index.d.ts.map +1 -1
- package/resources/beta/connect/index.js +3 -1
- package/resources/beta/connect/index.js.map +1 -1
- package/resources/beta/connect/index.mjs +1 -0
- package/resources/beta/connect/index.mjs.map +1 -1
- package/resources/beta/connect/tools.d.mts +51 -0
- package/resources/beta/connect/tools.d.mts.map +1 -0
- package/resources/beta/connect/tools.d.ts +51 -0
- package/resources/beta/connect/tools.d.ts.map +1 -0
- package/resources/beta/connect/tools.js +26 -0
- package/resources/beta/connect/tools.js.map +1 -0
- package/resources/beta/connect/tools.mjs +22 -0
- package/resources/beta/connect/tools.mjs.map +1 -0
- 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 +28 -5
- package/src/core/pagination.ts +47 -0
- package/src/lib/mcp-transport.ts +47 -24
- package/src/resources/beta/connect/connect.ts +14 -2
- package/src/resources/beta/connect/connections.ts +53 -35
- package/src/resources/beta/connect/index.ts +3 -1
- package/src/resources/beta/connect/tools.ts +73 -0
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.mts","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"tokens.d.mts","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAG3F;AAED;;;GAGG;AACH,MAAM,MAA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CAAC,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
package/resources/tokens.d.ts
CHANGED
|
@@ -9,57 +9,83 @@ export declare class Tokens extends APIResource {
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
11
|
* const createTokenResponse = await client.tokens.create({
|
|
12
|
-
*
|
|
13
|
-
* connections: { can: ['read', 'write'] },
|
|
14
|
-
* 'connections.rpc': { can: ['write'] },
|
|
15
|
-
* },
|
|
12
|
+
* allow: {},
|
|
16
13
|
* ttlSeconds: 3600,
|
|
17
14
|
* });
|
|
18
15
|
* ```
|
|
19
16
|
*/
|
|
20
17
|
create(body: TokenCreateParams, options?: RequestOptions): APIPromise<CreateTokenResponse>;
|
|
21
18
|
}
|
|
22
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Permission action. 'read' allows reading/listing. 'write' allows
|
|
21
|
+
* create/modify/delete.
|
|
22
|
+
*/
|
|
23
|
+
export type Action = 'read' | 'write';
|
|
24
|
+
/**
|
|
25
|
+
* Permission grants with per-resource scoping. Each resource defines its own
|
|
26
|
+
* namespaces and constraints.
|
|
27
|
+
*/
|
|
28
|
+
export interface Allow {
|
|
29
|
+
/**
|
|
30
|
+
* Scope for managing MCP connections.
|
|
31
|
+
*/
|
|
32
|
+
connections?: ConnectionScope;
|
|
33
|
+
/**
|
|
34
|
+
* Scope for deployment operations.
|
|
35
|
+
*/
|
|
36
|
+
deployments?: ResourceScope;
|
|
37
|
+
/**
|
|
38
|
+
* Scope for namespace management.
|
|
39
|
+
*/
|
|
40
|
+
namespaces?: ResourceScope;
|
|
41
|
+
/**
|
|
42
|
+
* Scope for making RPC calls on connections.
|
|
43
|
+
*/
|
|
44
|
+
rpc?: RpcScope;
|
|
45
|
+
/**
|
|
46
|
+
* Scope for server metadata and configuration.
|
|
47
|
+
*/
|
|
48
|
+
servers?: ResourceScope;
|
|
23
49
|
/**
|
|
24
|
-
*
|
|
50
|
+
* Scope for token creation.
|
|
25
51
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
52
|
+
tokens?: ResourceScope;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Scope for connection operations.
|
|
56
|
+
*/
|
|
57
|
+
export interface ConnectionScope {
|
|
58
|
+
/**
|
|
59
|
+
* Actions allowed on connections.
|
|
60
|
+
*/
|
|
61
|
+
actions: Array<Action>;
|
|
62
|
+
/**
|
|
63
|
+
* Namespaces this scope applies to. Use '\*' for all namespaces.
|
|
64
|
+
*/
|
|
65
|
+
namespaces: Array<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Filter access to connections with matching metadata. All keys must match (AND
|
|
68
|
+
* semantics).
|
|
69
|
+
*/
|
|
70
|
+
metadata?: {
|
|
71
|
+
[key: string]: string;
|
|
28
72
|
};
|
|
73
|
+
}
|
|
74
|
+
export interface CreateTokenRequest {
|
|
29
75
|
/**
|
|
30
|
-
*
|
|
76
|
+
* Per-resource permission grants. Format: { [resource]: { actions: [...],
|
|
77
|
+
* namespaces: [...], metadata?: {...} } }
|
|
31
78
|
*/
|
|
32
|
-
|
|
79
|
+
allow: Allow;
|
|
33
80
|
/**
|
|
34
|
-
*
|
|
81
|
+
* Token TTL in seconds. Required. Max 86400 (24 hours).
|
|
35
82
|
*/
|
|
36
|
-
|
|
83
|
+
ttlSeconds: number;
|
|
37
84
|
/**
|
|
38
85
|
* Profile to scope the token to. If not provided, uses the default profile.
|
|
39
86
|
*/
|
|
40
87
|
profileSlug?: string;
|
|
41
88
|
}
|
|
42
|
-
export declare namespace CreateTokenRequest {
|
|
43
|
-
interface Permissions {
|
|
44
|
-
/**
|
|
45
|
-
* Actions granted on this subject.
|
|
46
|
-
*/
|
|
47
|
-
can: Array<'read' | 'write'>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Optional constraints to limit token access.
|
|
51
|
-
*/
|
|
52
|
-
interface Constraints {
|
|
53
|
-
/**
|
|
54
|
-
* Limit access to specific namespace IDs.
|
|
55
|
-
*/
|
|
56
|
-
namespaceIds?: Array<string>;
|
|
57
|
-
/**
|
|
58
|
-
* Limit access to specific server qualified names.
|
|
59
|
-
*/
|
|
60
|
-
serverQualifiedNames?: Array<string>;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
89
|
export interface CreateTokenResponse {
|
|
64
90
|
/**
|
|
65
91
|
* The signed service token (PASETO v4).
|
|
@@ -70,48 +96,55 @@ export interface CreateTokenResponse {
|
|
|
70
96
|
*/
|
|
71
97
|
expiresAt: string;
|
|
72
98
|
}
|
|
73
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Scope for resource operations.
|
|
101
|
+
*/
|
|
102
|
+
export interface ResourceScope {
|
|
74
103
|
/**
|
|
75
|
-
*
|
|
104
|
+
* Actions allowed on this resource.
|
|
76
105
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
actions: Array<Action>;
|
|
107
|
+
/**
|
|
108
|
+
* Namespaces this scope applies to. Use '\*' for all namespaces.
|
|
109
|
+
*/
|
|
110
|
+
namespaces: Array<string>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Scope for RPC operations on connections.
|
|
114
|
+
*/
|
|
115
|
+
export interface RpcScope {
|
|
116
|
+
/**
|
|
117
|
+
* Actions allowed for RPC calls.
|
|
118
|
+
*/
|
|
119
|
+
actions: Array<Action>;
|
|
120
|
+
/**
|
|
121
|
+
* Namespaces this scope applies to. Use '\*' for all namespaces.
|
|
122
|
+
*/
|
|
123
|
+
namespaces: Array<string>;
|
|
124
|
+
/**
|
|
125
|
+
* Filter access to connections with matching metadata. All keys must match (AND
|
|
126
|
+
* semantics).
|
|
127
|
+
*/
|
|
128
|
+
metadata?: {
|
|
129
|
+
[key: string]: string;
|
|
79
130
|
};
|
|
131
|
+
}
|
|
132
|
+
export interface TokenCreateParams {
|
|
80
133
|
/**
|
|
81
|
-
*
|
|
134
|
+
* Per-resource permission grants. Format: { [resource]: { actions: [...],
|
|
135
|
+
* namespaces: [...], metadata?: {...} } }
|
|
82
136
|
*/
|
|
83
|
-
|
|
137
|
+
allow: Allow;
|
|
84
138
|
/**
|
|
85
|
-
*
|
|
139
|
+
* Token TTL in seconds. Required. Max 86400 (24 hours).
|
|
86
140
|
*/
|
|
87
|
-
|
|
141
|
+
ttlSeconds: number;
|
|
88
142
|
/**
|
|
89
143
|
* Profile to scope the token to. If not provided, uses the default profile.
|
|
90
144
|
*/
|
|
91
145
|
profileSlug?: string;
|
|
92
146
|
}
|
|
93
|
-
export declare namespace TokenCreateParams {
|
|
94
|
-
interface Permissions {
|
|
95
|
-
/**
|
|
96
|
-
* Actions granted on this subject.
|
|
97
|
-
*/
|
|
98
|
-
can: Array<'read' | 'write'>;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Optional constraints to limit token access.
|
|
102
|
-
*/
|
|
103
|
-
interface Constraints {
|
|
104
|
-
/**
|
|
105
|
-
* Limit access to specific namespace IDs.
|
|
106
|
-
*/
|
|
107
|
-
namespaceIds?: Array<string>;
|
|
108
|
-
/**
|
|
109
|
-
* Limit access to specific server qualified names.
|
|
110
|
-
*/
|
|
111
|
-
serverQualifiedNames?: Array<string>;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
147
|
export declare namespace Tokens {
|
|
115
|
-
export { type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type TokenCreateParams as TokenCreateParams, };
|
|
148
|
+
export { type Action as Action, type Allow as Allow, type ConnectionScope as ConnectionScope, type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type ResourceScope as ResourceScope, type RpcScope as RpcScope, type TokenCreateParams as TokenCreateParams, };
|
|
116
149
|
}
|
|
117
150
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAG3F;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAE3B;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,C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M,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
package/resources/tokens.js
CHANGED
|
@@ -11,10 +11,7 @@ class Tokens extends resource_1.APIResource {
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* const createTokenResponse = await client.tokens.create({
|
|
14
|
-
*
|
|
15
|
-
* connections: { can: ['read', 'write'] },
|
|
16
|
-
* 'connections.rpc': { can: ['write'] },
|
|
17
|
-
* },
|
|
14
|
+
* allow: {},
|
|
18
15
|
* ttlSeconds: 3600,
|
|
19
16
|
* });
|
|
20
17
|
* ```
|
package/resources/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,MAAO,SAAQ,sBAAW;IACrC
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF;AAhBD,wBAgBC"}
|
package/resources/tokens.mjs
CHANGED
|
@@ -8,10 +8,7 @@ export class Tokens extends APIResource {
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
10
|
* const createTokenResponse = await client.tokens.create({
|
|
11
|
-
*
|
|
12
|
-
* connections: { can: ['read', 'write'] },
|
|
13
|
-
* 'connections.rpc': { can: ['write'] },
|
|
14
|
-
* },
|
|
11
|
+
* allow: {},
|
|
15
12
|
* ttlSeconds: 3600,
|
|
16
13
|
* });
|
|
17
14
|
* ```
|
package/resources/tokens.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.mjs","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"tokens.mjs","sourceRoot":"","sources":["../src/resources/tokens.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -17,6 +17,8 @@ import * as Errors from './core/error';
|
|
|
17
17
|
import * as Pagination from './core/pagination';
|
|
18
18
|
import {
|
|
19
19
|
AbstractPage,
|
|
20
|
+
type ConnectToolsCursorParams,
|
|
21
|
+
ConnectToolsCursorResponse,
|
|
20
22
|
type SkillsPageParams,
|
|
21
23
|
SkillsPageResponse,
|
|
22
24
|
type SmitheryPageParams,
|
|
@@ -29,13 +31,23 @@ import * as API from './resources/index';
|
|
|
29
31
|
import { APIPromise } from './core/api-promise';
|
|
30
32
|
import { Health, HealthCheckResponse } from './resources/health';
|
|
31
33
|
import {
|
|
32
|
-
NamespaceCreateParams,
|
|
33
34
|
NamespaceCreateResponse,
|
|
34
35
|
NamespaceListResponse,
|
|
36
|
+
NamespaceSetResponse,
|
|
35
37
|
Namespaces,
|
|
36
38
|
} from './resources/namespaces';
|
|
37
39
|
import { SkillListParams, SkillListResponse, SkillListResponsesSkillsPage, Skills } from './resources/skills';
|
|
38
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
Action,
|
|
42
|
+
Allow,
|
|
43
|
+
ConnectionScope,
|
|
44
|
+
CreateTokenRequest,
|
|
45
|
+
CreateTokenResponse,
|
|
46
|
+
ResourceScope,
|
|
47
|
+
RpcScope,
|
|
48
|
+
TokenCreateParams,
|
|
49
|
+
Tokens,
|
|
50
|
+
} from './resources/tokens';
|
|
39
51
|
import { Uplink, UplinkCreateTokenResponse } from './resources/uplink';
|
|
40
52
|
import { Beta } from './resources/beta/beta';
|
|
41
53
|
import {
|
|
@@ -43,10 +55,10 @@ import {
|
|
|
43
55
|
DeploymentTarget,
|
|
44
56
|
ProjectConfig,
|
|
45
57
|
ServerDeleteResponse,
|
|
58
|
+
ServerGetResponse,
|
|
46
59
|
ServerListParams,
|
|
47
60
|
ServerListResponse,
|
|
48
61
|
ServerListResponsesSmitheryPage,
|
|
49
|
-
ServerRetrieveResponse,
|
|
50
62
|
Servers,
|
|
51
63
|
} from './resources/servers/servers';
|
|
52
64
|
import { type Fetch } from './internal/builtin-types';
|
|
@@ -778,6 +790,12 @@ export declare namespace Smithery {
|
|
|
778
790
|
export import ToolsPage = Pagination.ToolsPage;
|
|
779
791
|
export { type ToolsPageParams as ToolsPageParams, type ToolsPageResponse as ToolsPageResponse };
|
|
780
792
|
|
|
793
|
+
export import ConnectToolsCursor = Pagination.ConnectToolsCursor;
|
|
794
|
+
export {
|
|
795
|
+
type ConnectToolsCursorParams as ConnectToolsCursorParams,
|
|
796
|
+
type ConnectToolsCursorResponse as ConnectToolsCursorResponse,
|
|
797
|
+
};
|
|
798
|
+
|
|
781
799
|
export { Health as Health, type HealthCheckResponse as HealthCheckResponse };
|
|
782
800
|
|
|
783
801
|
export {
|
|
@@ -785,9 +803,9 @@ export declare namespace Smithery {
|
|
|
785
803
|
type BuildConfig as BuildConfig,
|
|
786
804
|
type DeploymentTarget as DeploymentTarget,
|
|
787
805
|
type ProjectConfig as ProjectConfig,
|
|
788
|
-
type ServerRetrieveResponse as ServerRetrieveResponse,
|
|
789
806
|
type ServerListResponse as ServerListResponse,
|
|
790
807
|
type ServerDeleteResponse as ServerDeleteResponse,
|
|
808
|
+
type ServerGetResponse as ServerGetResponse,
|
|
791
809
|
type ServerListResponsesSmitheryPage as ServerListResponsesSmitheryPage,
|
|
792
810
|
type ServerListParams as ServerListParams,
|
|
793
811
|
};
|
|
@@ -805,13 +823,18 @@ export declare namespace Smithery {
|
|
|
805
823
|
Namespaces as Namespaces,
|
|
806
824
|
type NamespaceCreateResponse as NamespaceCreateResponse,
|
|
807
825
|
type NamespaceListResponse as NamespaceListResponse,
|
|
808
|
-
type
|
|
826
|
+
type NamespaceSetResponse as NamespaceSetResponse,
|
|
809
827
|
};
|
|
810
828
|
|
|
811
829
|
export {
|
|
812
830
|
Tokens as Tokens,
|
|
831
|
+
type Action as Action,
|
|
832
|
+
type Allow as Allow,
|
|
833
|
+
type ConnectionScope as ConnectionScope,
|
|
813
834
|
type CreateTokenRequest as CreateTokenRequest,
|
|
814
835
|
type CreateTokenResponse as CreateTokenResponse,
|
|
836
|
+
type ResourceScope as ResourceScope,
|
|
837
|
+
type RpcScope as RpcScope,
|
|
815
838
|
type TokenCreateParams as TokenCreateParams,
|
|
816
839
|
};
|
|
817
840
|
|
package/src/core/pagination.ts
CHANGED
|
@@ -283,3 +283,50 @@ export class ToolsPage<Item> extends AbstractPage<Item> implements ToolsPageResp
|
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
+
|
|
287
|
+
export interface ConnectToolsCursorResponse<Item> {
|
|
288
|
+
tools: Array<Item>;
|
|
289
|
+
|
|
290
|
+
next_cursor: string | null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface ConnectToolsCursorParams {
|
|
294
|
+
cursor?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export class ConnectToolsCursor<Item> extends AbstractPage<Item> implements ConnectToolsCursorResponse<Item> {
|
|
298
|
+
tools: Array<Item>;
|
|
299
|
+
|
|
300
|
+
next_cursor: string | null;
|
|
301
|
+
|
|
302
|
+
constructor(
|
|
303
|
+
client: Smithery,
|
|
304
|
+
response: Response,
|
|
305
|
+
body: ConnectToolsCursorResponse<Item>,
|
|
306
|
+
options: FinalRequestOptions,
|
|
307
|
+
) {
|
|
308
|
+
super(client, response, body, options);
|
|
309
|
+
|
|
310
|
+
this.tools = body.tools || [];
|
|
311
|
+
this.next_cursor = body.next_cursor || null;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
getPaginatedItems(): Item[] {
|
|
315
|
+
return this.tools ?? [];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
nextPageRequestOptions(): PageRequestOptions | null {
|
|
319
|
+
const cursor = this.next_cursor;
|
|
320
|
+
if (!cursor) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return {
|
|
325
|
+
...this.options,
|
|
326
|
+
query: {
|
|
327
|
+
...maybeObj(this.options.query),
|
|
328
|
+
cursor,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
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,16 @@
|
|
|
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
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* const transport = new SmitheryConnectTransport({
|
|
19
|
-
* client: smithery,
|
|
20
|
-
* namespace: 'my-namespace',
|
|
16
|
+
* // Simple usage - client auto-created using SMITHERY_API_KEY env var
|
|
17
|
+
* const transport = new SmitheryTransport({
|
|
21
18
|
* mcpUrl: 'https://mcp.example.com/sse',
|
|
22
19
|
* });
|
|
23
20
|
*
|
|
24
|
-
* //
|
|
25
|
-
* const
|
|
21
|
+
* // Or with explicit client
|
|
22
|
+
* const smithery = new Smithery({ apiKey: process.env.SMITHERY_API_KEY });
|
|
23
|
+
* const transport2 = new SmitheryTransport({
|
|
26
24
|
* client: smithery,
|
|
27
25
|
* namespace: 'my-namespace',
|
|
28
26
|
* connectionId: 'my-connection',
|
|
@@ -40,19 +38,21 @@
|
|
|
40
38
|
|
|
41
39
|
import type { Transport, TransportSendOptions } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
42
40
|
import type { JSONRPCMessage, JSONRPCResponse, ServerCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
43
|
-
import
|
|
41
|
+
import { Smithery } from '../client';
|
|
44
42
|
import type { Connection } from '../resources/beta/connect/connections';
|
|
45
43
|
|
|
46
|
-
export interface
|
|
44
|
+
export interface SmitheryTransportOptions {
|
|
47
45
|
/**
|
|
48
46
|
* The Smithery client instance to use for making RPC calls.
|
|
47
|
+
* If not provided, a new client will be created using the SMITHERY_API_KEY environment variable.
|
|
49
48
|
*/
|
|
50
|
-
client
|
|
49
|
+
client?: Smithery;
|
|
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,8 +101,8 @@ export class SmitheryConnectTransport implements Transport {
|
|
|
101
101
|
return this._connectionId;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
constructor(options:
|
|
105
|
-
this._client = options.client;
|
|
104
|
+
constructor(options: SmitheryTransportOptions) {
|
|
105
|
+
this._client = options.client ?? new Smithery();
|
|
106
106
|
this._namespace = options.namespace;
|
|
107
107
|
this._connectionId = options.connectionId;
|
|
108
108
|
this._mcpUrl = options.mcpUrl;
|
|
@@ -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,
|
|
@@ -15,16 +16,26 @@ import {
|
|
|
15
16
|
} from './connections';
|
|
16
17
|
import * as RpcAPI from './rpc';
|
|
17
18
|
import { JsonRpcRequest, JsonRpcResponse, Rpc, RpcCallParams } from './rpc';
|
|
19
|
+
import * as ToolsAPI from './tools';
|
|
20
|
+
import { ToolSearchParams, ToolSearchResponse, Tools } from './tools';
|
|
18
21
|
|
|
19
22
|
export class Connect extends APIResource {
|
|
23
|
+
tools: ToolsAPI.Tools = new ToolsAPI.Tools(this._client);
|
|
20
24
|
connections: ConnectionsAPI.Connections = new ConnectionsAPI.Connections(this._client);
|
|
21
25
|
rpc: RpcAPI.Rpc = new RpcAPI.Rpc(this._client);
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
Connect.Tools = Tools;
|
|
24
29
|
Connect.Connections = Connections;
|
|
25
30
|
Connect.Rpc = Rpc;
|
|
26
31
|
|
|
27
32
|
export declare namespace Connect {
|
|
33
|
+
export {
|
|
34
|
+
Tools as Tools,
|
|
35
|
+
type ToolSearchResponse as ToolSearchResponse,
|
|
36
|
+
type ToolSearchParams as ToolSearchParams,
|
|
37
|
+
};
|
|
38
|
+
|
|
28
39
|
export {
|
|
29
40
|
Connections as Connections,
|
|
30
41
|
type Connection as Connection,
|
|
@@ -32,8 +43,9 @@ export declare namespace Connect {
|
|
|
32
43
|
type CreateConnectionRequest as CreateConnectionRequest,
|
|
33
44
|
type ConnectionDeleteResponse as ConnectionDeleteResponse,
|
|
34
45
|
type ConnectionCreateParams as ConnectionCreateParams,
|
|
35
|
-
type
|
|
46
|
+
type ConnectionListParams as ConnectionListParams,
|
|
36
47
|
type ConnectionDeleteParams as ConnectionDeleteParams,
|
|
48
|
+
type ConnectionGetParams as ConnectionGetParams,
|
|
37
49
|
type ConnectionSetParams as ConnectionSetParams,
|
|
38
50
|
};
|
|
39
51
|
|