@inferencesh/sdk 0.26.0 → 0.26.2

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 CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ Added: `mcpTool(name, { server, toolName, credentialId? })` names the MCP server by its slug (the API's model: a server declares the provider it signs in through); `credentialId` pins one connection. The old `mcpTool(name, credentialId, toolName)` still works (deprecated): the API saves such a tool with the server the connection's provider is declared by. `MCPServerUpdateBody` gains `credentials`; its `auth_type`, `oauth_client_id` and `oauth_secret_key` are no longer read by the API (the provider's OAuth app is set through `PUT /credentials/{slug}/app`). Generated types: `MCPToolConfig.server`; `MCPServerDTO.oauth_client_id`, `CredentialProviderMCP` and `CredentialTypeMCP` are gone from the API.
11
+
12
+ ### Changed
13
+
14
+ - Generated types follow the API: `MCPToolConfig` is `{ server, tool_name, credential_id? }`; `MCPServerDTO` loses `oauth_client_id`; `CredentialProviderMCP` and `CredentialTypeMCP` are gone (a credential of an MCP provider has type `oauth` or `api_key` and the provider slug the server declares in `credential_slug`).
15
+
16
+ ## [0.26.1] - 2026-10-12
17
+
18
+ ### Added
19
+
20
+ - Generated types follow the API: `AuthSchemeSpec` gains `resource`, `issuer`, `authorization_response_iss_parameter_supported`, `callback` and `profile`, and `AuthSchemeClientAuth` adds `"none"`.
21
+
10
22
  ## [0.26.0] - 2026-10-12
11
23
 
12
24
  Breaking (types only, following the API's credential model): `CredentialRequirement.provider` is now a `ProviderSeed` object (`{ name?, website? }`) instead of a string, and the requirement's `name`, `website` and `key` fields moved into it. Requirements are keyed by slug.
package/README.md CHANGED
@@ -377,7 +377,7 @@ Use the fluent builders to define `AgentTool` schemas. Client tools (`tool`) run
377
377
  | `agentTool(name, agentRef)` | Server | Delegate to a sub-agent |
378
378
  | `httpTool(name, url)` / `callTool(name, url)` | Server | HTTP request with credential injection (preferred over `webhookTool`) |
379
379
  | `webhookTool(name, url)` | Server | Unsigned webhook (legacy; use `httpTool` for new tools) |
380
- | `mcpTool(name, credentialId, toolName)` | Server | Call a tool through a connected MCP credential |
380
+ | `mcpTool(name, { server, toolName, credentialId? })` | Server | Call a tool on an MCP server (by slug), signed in through the server's provider; `credentialId` pins one connection. `mcpTool(name, credentialId, toolName)` still works and is saved with the connection's server |
381
381
  | `internalTools()` | Server | Built-in tools: plan, memory, widget, finish, skills, meta, remote, knowledge, artifact, agent |
382
382
 
383
383
  ```typescript
@@ -420,7 +420,8 @@ const imageGen = appTool('generate_image', 'infsh/flux-schnell@abc123')
420
420
  .requireApproval()
421
421
  .build();
422
422
 
423
- const mcpSearch = mcpTool('notion_search', 'your-mcp-credential-id', 'search')
423
+ // MCP server by slug; the runner's connection to its provider signs the call
424
+ const mcpSearch = mcpTool('notion_search', { server: 'notion', toolName: 'search' })
424
425
  .describe('Search Notion pages')
425
426
  .param('query', string('Search query'))
426
427
  .build();
@@ -689,8 +690,8 @@ try {
689
690
 
690
691
  | Constant group | Values |
691
692
  |----------------|--------|
692
- | `CredentialProvider*` | `google`, `slack`, `notion`, `github`, `x`, `microsoft`, `salesforce`, `discord`, `gcp`, `mcp`, `reddit` |
693
- | `CredentialType*` | `service_account`, `oauth`, `api_key`, `wif`, `mcp` |
693
+ | `CredentialProvider*` | `google`, `google-sa`, `slack`, `notion`, `github`, `x`, `microsoft`, `salesforce`, `discord`, `gcp`, `reddit` |
694
+ | `CredentialType*` | `service_account`, `oauth`, `api_key`, `wif` |
694
695
  | `CredentialStatus*` | `connected`, `disconnected`, `expired`, `error` |
695
696
 
696
697
  ## Instance Status Constants
@@ -12,7 +12,7 @@
12
12
  * chats, engines and teams send PATCH; apps.patch and flows.patch are the
13
13
  * partial siblings of the POST updates that also edit a version.
14
14
  */
15
- import type { AgentConfigInput, AgentImages, AppDTO, ChatDTO, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO, MCPServerAuthType, ProjectDTO, TeamDTO, Visibility } from '../types.js';
15
+ import type { AgentConfigInput, AgentImages, AppDTO, ChatDTO, CredentialRequirements, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO, ProjectDTO, TeamDTO, Visibility } from '../types.js';
16
16
  /**
17
17
  * POST /agents/{id}. Visibility and images, and a new version when
18
18
  * `version` is set. Name, title, harness, placement: set at creation.
@@ -88,9 +88,12 @@ export type TeamUpdateBody = Partial<Pick<TeamDTO, 'name' | 'email' | 'avatar_ur
88
88
  /**
89
89
  * PUT /mcp-servers/{id}. A field left out keeps its value. Title,
90
90
  * description, icon URL and documentation URL take what is sent, and ""
91
- * clears them; slug, name, server URL, auth type and the OAuth client
92
- * change only to a non-empty value. Headers sent replace the set ({}
93
- * clears it). Visibility: `POST /mcp-servers/{id}/visibility`.
91
+ * clears them; slug, name and server URL change only to a non-empty value.
92
+ * Headers sent replace the set ({} clears it); default scopes sent replace
93
+ * the list; `credentials` sent replace the declaration of the provider the
94
+ * server signs in through ([] clears it). Auth type is the server's own
95
+ * report. The provider's OAuth app: `PUT /credentials/{slug}/app`.
96
+ * Visibility: `POST /mcp-servers/{id}/visibility`.
94
97
  */
95
98
  export interface MCPServerUpdateBody {
96
99
  slug?: string;
@@ -99,12 +102,10 @@ export interface MCPServerUpdateBody {
99
102
  description?: string;
100
103
  icon_url?: string;
101
104
  server_url?: string;
102
- auth_type?: MCPServerAuthType;
103
- oauth_client_id?: string;
104
- oauth_secret_key?: string;
105
105
  default_scopes?: string[];
106
106
  headers?: {
107
107
  [key: string]: string;
108
108
  };
109
109
  documentation_url?: string;
110
+ credentials?: CredentialRequirements;
110
111
  }
@@ -113,13 +113,29 @@ export declare const webhookTool: (name: string, url: string) => WebhookToolBuil
113
113
  export declare const httpTool: (name: string, url: string) => HTTPToolBuilder;
114
114
  /** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
115
115
  export declare const callTool: (name: string, url: string) => HTTPToolBuilder;
116
- /** Create an MCP connector tool (calls a tool on a connected MCP server) */
117
- /** `credentialId` is the MCP credential the tool runs through. */
118
- export declare const mcpTool: (name: string, credentialId: string, toolName: string) => MCPToolBuilder;
116
+ /** What an MCP tool calls: a tool on a server, named by the server's slug. */
117
+ export interface MCPToolTarget {
118
+ /** The MCP server's slug (a workspace registration or a directory entry). */
119
+ server: string;
120
+ toolName: string;
121
+ /** Pins one connection to the server's provider; by default the runner's own is used. */
122
+ credentialId?: string;
123
+ }
124
+ /**
125
+ * Create an MCP tool: `toolName` on the MCP server `target.server` (its slug).
126
+ * The call signs in with the runner's connection to the server's provider;
127
+ * `credentialId` pins one connection instead.
128
+ *
129
+ * The older form `mcpTool(name, credentialId, toolName)` (a string second
130
+ * argument) still works: a tool naming only a connection is saved with the
131
+ * server that connection's provider is declared by.
132
+ */
133
+ export declare function mcpTool(name: string, target: MCPToolTarget | string, toolName?: string): MCPToolBuilder;
119
134
  declare class MCPToolBuilder extends ToolBuilder {
120
- private credentialId;
121
- private toolName;
122
- constructor(name: string, credentialId: string, toolName: string);
135
+ private target;
136
+ constructor(name: string, target: Partial<MCPToolTarget> & {
137
+ toolName: string;
138
+ });
123
139
  build(): AgentTool;
124
140
  }
125
141
  declare class InternalToolsBuilder {
@@ -236,14 +236,25 @@ export const webhookTool = (name, url) => new WebhookToolBuilder(name, url);
236
236
  export const httpTool = (name, url) => new HTTPToolBuilder(name, url);
237
237
  /** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
238
238
  export const callTool = (name, url) => new HTTPToolBuilder(name, url);
239
- /** Create an MCP connector tool (calls a tool on a connected MCP server) */
240
- /** `credentialId` is the MCP credential the tool runs through. */
241
- export const mcpTool = (name, credentialId, toolName) => new MCPToolBuilder(name, credentialId, toolName);
239
+ /**
240
+ * Create an MCP tool: `toolName` on the MCP server `target.server` (its slug).
241
+ * The call signs in with the runner's connection to the server's provider;
242
+ * `credentialId` pins one connection instead.
243
+ *
244
+ * The older form `mcpTool(name, credentialId, toolName)` (a string second
245
+ * argument) still works: a tool naming only a connection is saved with the
246
+ * server that connection's provider is declared by.
247
+ */
248
+ export function mcpTool(name, target, toolName) {
249
+ if (typeof target === 'string') {
250
+ return new MCPToolBuilder(name, { toolName: toolName ?? '', credentialId: target });
251
+ }
252
+ return new MCPToolBuilder(name, target);
253
+ }
242
254
  class MCPToolBuilder extends ToolBuilder {
243
- constructor(name, credentialId, toolName) {
255
+ constructor(name, target) {
244
256
  super(name);
245
- this.credentialId = credentialId;
246
- this.toolName = toolName;
257
+ this.target = target;
247
258
  }
248
259
  build() {
249
260
  return {
@@ -252,7 +263,11 @@ class MCPToolBuilder extends ToolBuilder {
252
263
  description: this.desc,
253
264
  type: ToolTypeMCP,
254
265
  require_approval: this.approval || undefined,
255
- mcp: { credential_id: this.credentialId, tool_name: this.toolName },
266
+ mcp: {
267
+ tool_name: this.target.toolName,
268
+ ...(this.target.server ? { server: this.target.server } : {}),
269
+ ...(this.target.credentialId ? { credential_id: this.target.credentialId } : {}),
270
+ },
256
271
  };
257
272
  }
258
273
  }
package/dist/types.d.ts CHANGED
@@ -200,9 +200,18 @@ export interface HTTPToolConfig {
200
200
  input_schema?: any;
201
201
  output_schema?: any;
202
202
  }
203
+ /**
204
+ * MCPToolConfig is a tool of an MCP server: the server by its slug (the
205
+ * agent's team's registration, its org's or the directory's) and the tool
206
+ * to call. CredentialID pins the connection the call signs in with; without
207
+ * it the runner's connection to the server's provider is used. A tool
208
+ * written with only a connection is saved with the server that
209
+ * connection's provider is declared by.
210
+ */
203
211
  export interface MCPToolConfig {
204
- credential_id?: string;
212
+ server?: string;
205
213
  tool_name: string;
214
+ credential_id?: string;
206
215
  }
207
216
  export interface AppToolConfigDTO {
208
217
  ref: string;
@@ -253,8 +262,9 @@ export interface HTTPToolConfigDTO {
253
262
  output_schema?: any;
254
263
  }
255
264
  export interface MCPToolConfigDTO {
256
- credential_id: string;
265
+ server: string;
257
266
  tool_name: string;
267
+ credential_id?: string;
258
268
  }
259
269
  /**
260
270
  * AgentImages contains display images for an agent
@@ -4016,7 +4026,6 @@ export interface MCPServerDTO {
4016
4026
  icon_url: string;
4017
4027
  server_url: string;
4018
4028
  auth_type: MCPServerAuthType;
4019
- oauth_client_id?: string;
4020
4029
  default_scopes: StringSlice;
4021
4030
  /**
4022
4031
  * Headers are static HTTP headers sent on every request to the server,
@@ -5563,7 +5572,7 @@ export interface SecretField {
5563
5572
  * AuthSchemeClientAuth is how client_id/client_secret reach the token
5564
5573
  * endpoint. Most providers accept either; a few insist on one.
5565
5574
  */
5566
- export type AuthSchemeClientAuth = "basic" | "body";
5575
+ export type AuthSchemeClientAuth = "basic" | "body" | "none";
5567
5576
  /**
5568
5577
  * AuthSchemeClientAuthBasic sends them as an HTTP Basic Authorization
5569
5578
  * header (RFC 6749 §2.3.1, the default).
@@ -5573,6 +5582,14 @@ export declare const AuthSchemeClientAuthBasic: AuthSchemeClientAuth;
5573
5582
  * AuthSchemeClientAuthBody sends them as form fields in the request body.
5574
5583
  */
5575
5584
  export declare const AuthSchemeClientAuthBody: AuthSchemeClientAuth;
5585
+ /**
5586
+ * AuthSchemeClientAuthNone is a public client (RFC 8414
5587
+ * token_endpoint_auth_method "none"): the client id goes in the body,
5588
+ * there is no secret, and PKCE is what proves the client. Its OAuth app
5589
+ * is complete with a client id alone (a dynamically registered client,
5590
+ * or a Client ID Metadata Document URL).
5591
+ */
5592
+ export declare const AuthSchemeClientAuthNone: AuthSchemeClientAuth;
5576
5593
  /**
5577
5594
  * AuthSchemeTokenRequest is the token request's body encoding.
5578
5595
  */
@@ -5781,6 +5798,35 @@ export interface AuthSchemeSpec {
5781
5798
  * is asked for again.
5782
5799
  */
5783
5800
  incremental_add_scopes?: boolean;
5801
+ /**
5802
+ * Resource is the RFC 8707 resource indicator: the protected resource
5803
+ * the token is minted for (an MCP server's URL). Sent on the authorize,
5804
+ * code and refresh requests when the profile takes one. Empty = none.
5805
+ */
5806
+ resource?: string;
5807
+ /**
5808
+ * Issuer is the authorization server's RFC 8414 issuer. With
5809
+ * AuthorizationResponseIssParameterSupported, the callback's iss must
5810
+ * name it (RFC 9207, against mix-up); an issuer alone still refuses a
5811
+ * callback naming another one.
5812
+ */
5813
+ issuer?: string;
5814
+ authorization_response_iss_parameter_supported?: boolean;
5815
+ /**
5816
+ * Callback is the name of the redirect URI the app was registered with
5817
+ * (<app>/settings/secrets/oauth/<callback>). Empty = the slug. Schemes
5818
+ * whose clients are registered once for many slugs share one (an MCP
5819
+ * server's dynamically registered client and the Client ID Metadata
5820
+ * Document name the "mcp" callback); the flow's provider then comes
5821
+ * from the connect intent, never from the callback's path.
5822
+ */
5823
+ callback?: string;
5824
+ /**
5825
+ * Profile names the authorization server's deviations from the specs
5826
+ * (authprovider.AuthServerProfile: endpoints placed by app fields,
5827
+ * scopes on refresh, actionable errors, admin consent). Empty = none.
5828
+ */
5829
+ profile?: string;
5784
5830
  token_endpoint?: string;
5785
5831
  /**
5786
5832
  * RevocationEndpoint is the RFC 7009 endpoint, when the provider has
@@ -6427,9 +6473,24 @@ export interface StreamDelta {
6427
6473
  export interface LLMOutput {
6428
6474
  response: string;
6429
6475
  reasoning?: string;
6476
+ reasoning_state?: ReasoningState;
6430
6477
  tool_calls?: ToolCall[];
6431
6478
  usage?: LLMUsage;
6432
6479
  }
6480
+ /**
6481
+ * ReasoningState is the opaque state a model hands back with a response for
6482
+ * the next request to carry: a signature over its reasoning (Anthropic
6483
+ * thinking, Gemini thought_signature) or the reasoning itself encrypted
6484
+ * (OpenAI). The platform never reads it. An app writes its own entry under
6485
+ * its own key and, replaying a conversation, places only the entries it
6486
+ * wrote: another provider's signature in its request is refused. The agent
6487
+ * loop stores every assistant message's state and sends all of it back, so a
6488
+ * conversation that moves between models keeps each one's state for it.
6489
+ * Not on LLMDelta: the state is whole only on the final output.
6490
+ */
6491
+ export type ReasoningState = {
6492
+ [key: string]: any;
6493
+ };
6433
6494
  /**
6434
6495
  * LLMDelta is a streaming delta for LLMOutput.
6435
6496
  */
@@ -6575,6 +6636,11 @@ export interface LLMContextMessage {
6575
6636
  role: ChatMessageRole;
6576
6637
  text?: string;
6577
6638
  reasoning?: string;
6639
+ /**
6640
+ * ReasoningState is what the model's output carried, on an assistant
6641
+ * message: see ReasoningState.
6642
+ */
6643
+ reasoning_state?: ReasoningState;
6578
6644
  images?: string[];
6579
6645
  files?: string[];
6580
6646
  tools?: Tool[];
@@ -6839,7 +6905,7 @@ export declare const ContentUnrated: ContentRating;
6839
6905
  /**
6840
6906
  * CredentialProvider names the external service a credential is for.
6841
6907
  */
6842
- export type CredentialProvider = "google" | "google-sa" | "slack" | "notion" | "github" | "x" | "microsoft" | "salesforce" | "discord" | "gcp" | "mcp" | "reddit";
6908
+ export type CredentialProvider = "google" | "google-sa" | "slack" | "notion" | "github" | "x" | "microsoft" | "salesforce" | "discord" | "gcp" | "reddit";
6843
6909
  /**
6844
6910
  * Credential.Provider is a plain string; cast with string(...) when assigning.
6845
6911
  */
@@ -6880,10 +6946,6 @@ export declare const CredentialProviderDiscord: CredentialProvider;
6880
6946
  * Credential.Provider is a plain string; cast with string(...) when assigning.
6881
6947
  */
6882
6948
  export declare const CredentialProviderGCP: CredentialProvider;
6883
- /**
6884
- * Credential.Provider is a plain string; cast with string(...) when assigning.
6885
- */
6886
- export declare const CredentialProviderMCP: CredentialProvider;
6887
6949
  /**
6888
6950
  * Credential.Provider is a plain string; cast with string(...) when assigning.
6889
6951
  */
@@ -6891,10 +6953,9 @@ export declare const CredentialProviderReddit: CredentialProvider;
6891
6953
  /**
6892
6954
  * CredentialType describes the credential category.
6893
6955
  */
6894
- export type CredentialType = "oauth" | "api_key" | "mcp" | "service_account" | "wif";
6956
+ export type CredentialType = "oauth" | "api_key" | "service_account" | "wif";
6895
6957
  export declare const CredentialTypeOAuth: CredentialType;
6896
6958
  export declare const CredentialTypeAPIKey: CredentialType;
6897
- export declare const CredentialTypeMCP: CredentialType;
6898
6959
  export declare const CredentialTypeServiceAccount: CredentialType;
6899
6960
  export declare const CredentialTypeWIF: CredentialType;
6900
6961
  /**
package/dist/types.js CHANGED
@@ -786,6 +786,14 @@ export const AuthSchemeClientAuthBasic = "basic";
786
786
  * AuthSchemeClientAuthBody sends them as form fields in the request body.
787
787
  */
788
788
  export const AuthSchemeClientAuthBody = "body";
789
+ /**
790
+ * AuthSchemeClientAuthNone is a public client (RFC 8414
791
+ * token_endpoint_auth_method "none"): the client id goes in the body,
792
+ * there is no secret, and PKCE is what proves the client. Its OAuth app
793
+ * is complete with a client id alone (a dynamically registered client,
794
+ * or a Client ID Metadata Document URL).
795
+ */
796
+ export const AuthSchemeClientAuthNone = "none";
789
797
  export const AuthSchemeTokenRequestForm = "form";
790
798
  export const AuthSchemeTokenRequestJSON = "json";
791
799
  /**
@@ -1230,17 +1238,12 @@ export const CredentialProviderDiscord = "discord";
1230
1238
  * Credential.Provider is a plain string; cast with string(...) when assigning.
1231
1239
  */
1232
1240
  export const CredentialProviderGCP = "gcp";
1233
- /**
1234
- * Credential.Provider is a plain string; cast with string(...) when assigning.
1235
- */
1236
- export const CredentialProviderMCP = "mcp";
1237
1241
  /**
1238
1242
  * Credential.Provider is a plain string; cast with string(...) when assigning.
1239
1243
  */
1240
1244
  export const CredentialProviderReddit = "reddit";
1241
1245
  export const CredentialTypeOAuth = "oauth";
1242
1246
  export const CredentialTypeAPIKey = "api_key";
1243
- export const CredentialTypeMCP = "mcp";
1244
1247
  export const CredentialTypeServiceAccount = "service_account";
1245
1248
  export const CredentialTypeWIF = "wif";
1246
1249
  export const CredentialStatusPending = "pending";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.26.2",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",