@smithery/api 0.33.0 → 0.34.1

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.
@@ -3,92 +3,52 @@ import { APIPromise } from "../core/api-promise.mjs";
3
3
  import { RequestOptions } from "../internal/request-options.mjs";
4
4
  export declare class Tokens extends APIResource {
5
5
  /**
6
- * Create a service token for machine-to-machine authentication. Requires API key
7
- * authentication.
8
- *
9
- * @example
10
- * ```ts
11
- * const createTokenResponse = await client.tokens.create({
12
- * allow: {},
13
- * ttlSeconds: 3600,
14
- * });
15
- * ```
6
+ * Create a service token for machine-to-machine authentication. Accepts API key or
7
+ * bearer token. Optionally apply restrictions.
16
8
  */
17
- create(body: TokenCreateParams, options?: RequestOptions): APIPromise<CreateTokenResponse>;
9
+ create(body?: TokenCreateParams | null | undefined, options?: RequestOptions): APIPromise<CreateTokenResponse>;
18
10
  }
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 {
11
+ export interface Constraint {
29
12
  /**
30
- * Scope for managing MCP connections.
13
+ * Metadata filter facts. Each object is an OR condition; keys within are AND-ed.
31
14
  */
32
- connections?: ConnectionScope;
33
- /**
34
- * Scope for deployment operations.
35
- */
36
- deployments?: ResourceScope;
37
- /**
38
- * Scope for MCP protocol operations on connections.
39
- */
40
- mcp?: McpScope;
41
- /**
42
- * Scope for namespace management.
43
- */
44
- namespaces?: ResourceScope;
45
- /**
46
- * Scope for server metadata and configuration.
47
- */
48
- servers?: ResourceScope;
15
+ metadata?: {
16
+ [key: string]: string;
17
+ } | Array<{
18
+ [key: string]: string;
19
+ }>;
49
20
  /**
50
- * Scope for token creation.
21
+ * Restrict token to specific namespaces.
51
22
  */
52
- tokens?: ResourceScope;
53
- }
54
- /**
55
- * Scope for connection operations.
56
- */
57
- export interface ConnectionScope {
23
+ namespaces?: string | Array<string>;
58
24
  /**
59
- * Actions allowed on connections.
25
+ * Restrict token to specific operations.
60
26
  */
61
- actions: Array<Action>;
27
+ operations?: 'read' | 'write' | 'execute' | Array<'read' | 'write' | 'execute'>;
62
28
  /**
63
- * Namespaces this scope applies to. Use '\*' for all namespaces.
29
+ * Restrict token to specific resource types.
64
30
  */
65
- namespaces: Array<string>;
31
+ resources?: 'connections' | 'servers' | 'namespaces' | 'skills' | Array<'connections' | 'servers' | 'namespaces' | 'skills'>;
66
32
  /**
67
- * Filter access to connections with matching metadata. All keys must match (AND
68
- * semantics).
33
+ * TTL as seconds or duration string ("1h", "30m", "20s").
69
34
  */
70
- metadata?: {
71
- [key: string]: string;
72
- };
35
+ ttl?: string | number;
73
36
  }
74
37
  export interface CreateTokenRequest {
75
38
  /**
76
- * Per-resource permission grants. Format: { [resource]: { actions: [...],
77
- * namespaces: [...], metadata?: {...} } }
78
- */
79
- allow: Allow;
80
- /**
81
- * Token TTL in seconds. Required. Max 86400 (24 hours).
39
+ * Constraint objects to restrict the token. Cannot be combined with profileSlug.
40
+ * Each constraint may include a `ttl` field (max 24 hours). Default TTL is 1 hour.
41
+ * Maximum is 24 hours.
82
42
  */
83
- ttlSeconds: number;
43
+ policy?: Array<Constraint>;
84
44
  /**
85
- * Profile to scope the token to. If not provided, uses the default profile.
45
+ * Profile slug for legacy token minting. Cannot be combined with policy.
86
46
  */
87
47
  profileSlug?: string;
88
48
  }
89
49
  export interface CreateTokenResponse {
90
50
  /**
91
- * The signed service token (PASETO v4).
51
+ * The signed service token.
92
52
  */
93
53
  token: string;
94
54
  /**
@@ -96,55 +56,19 @@ export interface CreateTokenResponse {
96
56
  */
97
57
  expiresAt: string;
98
58
  }
99
- /**
100
- * Scope for MCP operations on connections.
101
- */
102
- export interface McpScope {
103
- /**
104
- * Actions allowed for MCP calls.
105
- */
106
- actions: Array<Action>;
107
- /**
108
- * Namespaces this scope applies to. Use '\*' for all namespaces.
109
- */
110
- namespaces: Array<string>;
111
- /**
112
- * Filter access to connections with matching metadata. All keys must match (AND
113
- * semantics).
114
- */
115
- metadata?: {
116
- [key: string]: string;
117
- };
118
- }
119
- /**
120
- * Scope for resource operations.
121
- */
122
- export interface ResourceScope {
123
- /**
124
- * Actions allowed on this resource.
125
- */
126
- actions: Array<Action>;
127
- /**
128
- * Namespaces this scope applies to. Use '\*' for all namespaces.
129
- */
130
- namespaces: Array<string>;
131
- }
132
59
  export interface TokenCreateParams {
133
60
  /**
134
- * Per-resource permission grants. Format: { [resource]: { actions: [...],
135
- * namespaces: [...], metadata?: {...} } }
136
- */
137
- allow: Allow;
138
- /**
139
- * Token TTL in seconds. Required. Max 86400 (24 hours).
61
+ * Constraint objects to restrict the token. Cannot be combined with profileSlug.
62
+ * Each constraint may include a `ttl` field (max 24 hours). Default TTL is 1 hour.
63
+ * Maximum is 24 hours.
140
64
  */
141
- ttlSeconds: number;
65
+ policy?: Array<Constraint>;
142
66
  /**
143
- * Profile to scope the token to. If not provided, uses the default profile.
67
+ * Profile slug for legacy token minting. Cannot be combined with policy.
144
68
  */
145
69
  profileSlug?: string;
146
70
  }
147
71
  export declare namespace Tokens {
148
- export { type Action as Action, type Allow as Allow, type ConnectionScope as ConnectionScope, type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type McpScope as McpScope, type ResourceScope as ResourceScope, type TokenCreateParams as TokenCreateParams, };
72
+ export { type Constraint as Constraint, type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type TokenCreateParams as TokenCreateParams, };
149
73
  }
150
74
  //# sourceMappingURL=tokens.d.mts.map
@@ -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;;;;;;;;;;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,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IAExE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAEpC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAEhF;;OAEG;IACH,SAAS,CAAC,EACN,aAAa,GACb,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,KAAK,CAAC,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC;IAE/D;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
@@ -3,92 +3,52 @@ import { APIPromise } from "../core/api-promise.js";
3
3
  import { RequestOptions } from "../internal/request-options.js";
4
4
  export declare class Tokens extends APIResource {
5
5
  /**
6
- * Create a service token for machine-to-machine authentication. Requires API key
7
- * authentication.
8
- *
9
- * @example
10
- * ```ts
11
- * const createTokenResponse = await client.tokens.create({
12
- * allow: {},
13
- * ttlSeconds: 3600,
14
- * });
15
- * ```
6
+ * Create a service token for machine-to-machine authentication. Accepts API key or
7
+ * bearer token. Optionally apply restrictions.
16
8
  */
17
- create(body: TokenCreateParams, options?: RequestOptions): APIPromise<CreateTokenResponse>;
9
+ create(body?: TokenCreateParams | null | undefined, options?: RequestOptions): APIPromise<CreateTokenResponse>;
18
10
  }
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 {
11
+ export interface Constraint {
29
12
  /**
30
- * Scope for managing MCP connections.
13
+ * Metadata filter facts. Each object is an OR condition; keys within are AND-ed.
31
14
  */
32
- connections?: ConnectionScope;
33
- /**
34
- * Scope for deployment operations.
35
- */
36
- deployments?: ResourceScope;
37
- /**
38
- * Scope for MCP protocol operations on connections.
39
- */
40
- mcp?: McpScope;
41
- /**
42
- * Scope for namespace management.
43
- */
44
- namespaces?: ResourceScope;
45
- /**
46
- * Scope for server metadata and configuration.
47
- */
48
- servers?: ResourceScope;
15
+ metadata?: {
16
+ [key: string]: string;
17
+ } | Array<{
18
+ [key: string]: string;
19
+ }>;
49
20
  /**
50
- * Scope for token creation.
21
+ * Restrict token to specific namespaces.
51
22
  */
52
- tokens?: ResourceScope;
53
- }
54
- /**
55
- * Scope for connection operations.
56
- */
57
- export interface ConnectionScope {
23
+ namespaces?: string | Array<string>;
58
24
  /**
59
- * Actions allowed on connections.
25
+ * Restrict token to specific operations.
60
26
  */
61
- actions: Array<Action>;
27
+ operations?: 'read' | 'write' | 'execute' | Array<'read' | 'write' | 'execute'>;
62
28
  /**
63
- * Namespaces this scope applies to. Use '\*' for all namespaces.
29
+ * Restrict token to specific resource types.
64
30
  */
65
- namespaces: Array<string>;
31
+ resources?: 'connections' | 'servers' | 'namespaces' | 'skills' | Array<'connections' | 'servers' | 'namespaces' | 'skills'>;
66
32
  /**
67
- * Filter access to connections with matching metadata. All keys must match (AND
68
- * semantics).
33
+ * TTL as seconds or duration string ("1h", "30m", "20s").
69
34
  */
70
- metadata?: {
71
- [key: string]: string;
72
- };
35
+ ttl?: string | number;
73
36
  }
74
37
  export interface CreateTokenRequest {
75
38
  /**
76
- * Per-resource permission grants. Format: { [resource]: { actions: [...],
77
- * namespaces: [...], metadata?: {...} } }
78
- */
79
- allow: Allow;
80
- /**
81
- * Token TTL in seconds. Required. Max 86400 (24 hours).
39
+ * Constraint objects to restrict the token. Cannot be combined with profileSlug.
40
+ * Each constraint may include a `ttl` field (max 24 hours). Default TTL is 1 hour.
41
+ * Maximum is 24 hours.
82
42
  */
83
- ttlSeconds: number;
43
+ policy?: Array<Constraint>;
84
44
  /**
85
- * Profile to scope the token to. If not provided, uses the default profile.
45
+ * Profile slug for legacy token minting. Cannot be combined with policy.
86
46
  */
87
47
  profileSlug?: string;
88
48
  }
89
49
  export interface CreateTokenResponse {
90
50
  /**
91
- * The signed service token (PASETO v4).
51
+ * The signed service token.
92
52
  */
93
53
  token: string;
94
54
  /**
@@ -96,55 +56,19 @@ export interface CreateTokenResponse {
96
56
  */
97
57
  expiresAt: string;
98
58
  }
99
- /**
100
- * Scope for MCP operations on connections.
101
- */
102
- export interface McpScope {
103
- /**
104
- * Actions allowed for MCP calls.
105
- */
106
- actions: Array<Action>;
107
- /**
108
- * Namespaces this scope applies to. Use '\*' for all namespaces.
109
- */
110
- namespaces: Array<string>;
111
- /**
112
- * Filter access to connections with matching metadata. All keys must match (AND
113
- * semantics).
114
- */
115
- metadata?: {
116
- [key: string]: string;
117
- };
118
- }
119
- /**
120
- * Scope for resource operations.
121
- */
122
- export interface ResourceScope {
123
- /**
124
- * Actions allowed on this resource.
125
- */
126
- actions: Array<Action>;
127
- /**
128
- * Namespaces this scope applies to. Use '\*' for all namespaces.
129
- */
130
- namespaces: Array<string>;
131
- }
132
59
  export interface TokenCreateParams {
133
60
  /**
134
- * Per-resource permission grants. Format: { [resource]: { actions: [...],
135
- * namespaces: [...], metadata?: {...} } }
136
- */
137
- allow: Allow;
138
- /**
139
- * Token TTL in seconds. Required. Max 86400 (24 hours).
61
+ * Constraint objects to restrict the token. Cannot be combined with profileSlug.
62
+ * Each constraint may include a `ttl` field (max 24 hours). Default TTL is 1 hour.
63
+ * Maximum is 24 hours.
140
64
  */
141
- ttlSeconds: number;
65
+ policy?: Array<Constraint>;
142
66
  /**
143
- * Profile to scope the token to. If not provided, uses the default profile.
67
+ * Profile slug for legacy token minting. Cannot be combined with policy.
144
68
  */
145
69
  profileSlug?: string;
146
70
  }
147
71
  export declare namespace Tokens {
148
- export { type Action as Action, type Allow as Allow, type ConnectionScope as ConnectionScope, type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type McpScope as McpScope, type ResourceScope as ResourceScope, type TokenCreateParams as TokenCreateParams, };
72
+ export { type Constraint as Constraint, type CreateTokenRequest as CreateTokenRequest, type CreateTokenResponse as CreateTokenResponse, type TokenCreateParams as TokenCreateParams, };
149
73
  }
150
74
  //# 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;;;;;;;;;;;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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,CAAC;IAEhF;;OAEG;IACH,SAAS,CAAC,EACN,aAAa,GACb,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,KAAK,CAAC,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC;IAE/D;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
@@ -5,18 +5,10 @@ exports.Tokens = void 0;
5
5
  const resource_1 = require("../core/resource.js");
6
6
  class Tokens extends resource_1.APIResource {
7
7
  /**
8
- * Create a service token for machine-to-machine authentication. Requires API key
9
- * authentication.
10
- *
11
- * @example
12
- * ```ts
13
- * const createTokenResponse = await client.tokens.create({
14
- * allow: {},
15
- * ttlSeconds: 3600,
16
- * });
17
- * ```
8
+ * Create a service token for machine-to-machine authentication. Accepts API key or
9
+ * bearer token. Optionally apply restrictions.
18
10
  */
19
- create(body, options) {
11
+ create(body = {}, options) {
20
12
  return this._client.post('/tokens', { body, ...options });
21
13
  }
22
14
  }
@@ -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;;;;;;;;;;;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"}
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;;;OAGG;IACH,MAAM,CACJ,OAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF;AAXD,wBAWC"}
@@ -2,18 +2,10 @@
2
2
  import { APIResource } from "../core/resource.mjs";
3
3
  export class Tokens extends APIResource {
4
4
  /**
5
- * Create a service token for machine-to-machine authentication. Requires API key
6
- * authentication.
7
- *
8
- * @example
9
- * ```ts
10
- * const createTokenResponse = await client.tokens.create({
11
- * allow: {},
12
- * ttlSeconds: 3600,
13
- * });
14
- * ```
5
+ * Create a service token for machine-to-machine authentication. Accepts API key or
6
+ * bearer token. Optionally apply restrictions.
15
7
  */
16
- create(body, options) {
8
+ create(body = {}, options) {
17
9
  return this._client.post('/tokens', { body, ...options });
18
10
  }
19
11
  }
@@ -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;;;;;;;;;;;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"}
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;;;OAGG;IACH,MAAM,CACJ,OAA6C,EAAE,EAC/C,OAAwB;QAExB,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
@@ -28,13 +28,9 @@ import { APIPromise } from './core/api-promise';
28
28
  import { Health, HealthCheckResponse } from './resources/health';
29
29
  import { SkillListParams, SkillListResponse, SkillListResponsesSkillsPage, Skills } from './resources/skills';
30
30
  import {
31
- Action,
32
- Allow,
33
- ConnectionScope,
31
+ Constraint,
34
32
  CreateTokenRequest,
35
33
  CreateTokenResponse,
36
- McpScope,
37
- ResourceScope,
38
34
  TokenCreateParams,
39
35
  Tokens,
40
36
  } from './resources/tokens';
@@ -536,9 +532,10 @@ export class Smithery {
536
532
  controller: AbortController,
537
533
  ): Promise<Response> {
538
534
  const { signal, method, ...options } = init || {};
539
- if (signal) signal.addEventListener('abort', () => controller.abort());
535
+ const abort = controller.abort.bind(controller);
536
+ if (signal) signal.addEventListener('abort', abort, { once: true });
540
537
 
541
- const timeout = setTimeout(() => controller.abort(), ms);
538
+ const timeout = setTimeout(abort, ms);
542
539
 
543
540
  const isReadableBody =
544
541
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -823,13 +820,9 @@ export declare namespace Smithery {
823
820
 
824
821
  export {
825
822
  Tokens as Tokens,
826
- type Action as Action,
827
- type Allow as Allow,
828
- type ConnectionScope as ConnectionScope,
823
+ type Constraint as Constraint,
829
824
  type CreateTokenRequest as CreateTokenRequest,
830
825
  type CreateTokenResponse as CreateTokenResponse,
831
- type McpScope as McpScope,
832
- type ResourceScope as ResourceScope,
833
826
  type TokenCreateParams as TokenCreateParams,
834
827
  };
835
828
 
@@ -43,6 +43,12 @@ export async function defaultParseResponse<T>(client: Smithery, props: APIRespon
43
43
  const mediaType = contentType?.split(';')[0]?.trim();
44
44
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
45
45
  if (isJSON) {
46
+ const contentLength = response.headers.get('content-length');
47
+ if (contentLength === '0') {
48
+ // if there is no content we can't do anything
49
+ return undefined as T;
50
+ }
51
+
46
52
  const json = await response.json();
47
53
  return json as T;
48
54
  }
@@ -31,13 +31,9 @@ export {
31
31
  } from './skills';
32
32
  export {
33
33
  Tokens,
34
- type Action,
35
- type Allow,
36
- type ConnectionScope,
34
+ type Constraint,
37
35
  type CreateTokenRequest,
38
36
  type CreateTokenResponse,
39
- type McpScope,
40
- type ResourceScope,
41
37
  type TokenCreateParams,
42
38
  } from './tokens';
43
39
  export { Uplink, type UplinkCreateTokenResponse } from './uplink';