@engini/sdk 0.17.0 → 0.18.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/README.md +13 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +10 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/resources/mcp.d.ts +51 -0
- package/dist/resources/mcp.js +101 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,6 +59,19 @@ const openaiTools = client.provider.wrapTools(await toolset.tools()); // plain
|
|
|
59
59
|
const results = await toolset.handleToolCalls(llmResponse); // runs the calls, returns results
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
`client.mcp` inspects and maintains the account's MCP servers — the endpoints Engini
|
|
63
|
+
*exposes* over the Model Context Protocol:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const servers = await client.mcp.list(); // includes deactivated ones
|
|
67
|
+
await client.mcp.deactivate(servers[0].mcpServerToken); // reversible; sends only isActive
|
|
68
|
+
const tools = await client.mcp.availableTools(token, 2139); // candidates for toolSlugs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`update()` replaces `connections`/`workflows` rather than merging them, and every
|
|
72
|
+
connection entry needs an explicit `connectionId` (MCP servers are account-wide, so there
|
|
73
|
+
is no per-user default). There is no `create`/`delete`: those stay in the engini.io UI.
|
|
74
|
+
|
|
62
75
|
`client.toolset(...)` builds a local toolset (no I/O until used) or loads a server one via
|
|
63
76
|
`client.toolset({ toolsetId })`.
|
|
64
77
|
|
package/dist/client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Provider } from "./providers/base.js";
|
|
|
4
4
|
import { ToolsResource } from "./resources/tools.js";
|
|
5
5
|
import { ConnectionsResource } from "./resources/connections.js";
|
|
6
6
|
import { ToolsetsResource } from "./resources/toolsets.js";
|
|
7
|
+
import { McpResource } from "./resources/mcp.js";
|
|
7
8
|
import { ApplicationsResource } from "./resources/applications.js";
|
|
8
9
|
import { AuthResource } from "./resources/auth.js";
|
|
9
10
|
import { Toolset, type ConnectionBinding } from "./toolset.js";
|
|
@@ -47,6 +48,7 @@ export declare class Engini {
|
|
|
47
48
|
readonly tools: ToolsResource;
|
|
48
49
|
readonly connections: ConnectionsResource;
|
|
49
50
|
readonly toolsets: ToolsetsResource;
|
|
51
|
+
readonly mcp: McpResource;
|
|
50
52
|
readonly applications: ApplicationsResource;
|
|
51
53
|
readonly auth: AuthResource;
|
|
52
54
|
readonly provider: Provider;
|
package/dist/client.js
CHANGED
|
@@ -5,6 +5,7 @@ import { OpenAIProvider } from "./providers/openai.js";
|
|
|
5
5
|
import { ToolsResource } from "./resources/tools.js";
|
|
6
6
|
import { ConnectionsResource } from "./resources/connections.js";
|
|
7
7
|
import { ToolsetsResource } from "./resources/toolsets.js";
|
|
8
|
+
import { McpResource } from "./resources/mcp.js";
|
|
8
9
|
import { ApplicationsResource } from "./resources/applications.js";
|
|
9
10
|
import { AuthResource } from "./resources/auth.js";
|
|
10
11
|
import { Toolset } from "./toolset.js";
|
|
@@ -14,6 +15,7 @@ export class Engini {
|
|
|
14
15
|
tools;
|
|
15
16
|
connections;
|
|
16
17
|
toolsets;
|
|
18
|
+
mcp;
|
|
17
19
|
applications;
|
|
18
20
|
auth;
|
|
19
21
|
provider;
|
|
@@ -66,6 +68,7 @@ export class Engini {
|
|
|
66
68
|
this.tools = new ToolsResource(this);
|
|
67
69
|
this.connections = new ConnectionsResource(this);
|
|
68
70
|
this.toolsets = new ToolsetsResource(this);
|
|
71
|
+
this.mcp = new McpResource(this);
|
|
69
72
|
this.applications = new ApplicationsResource(this);
|
|
70
73
|
this.auth = new AuthResource(this);
|
|
71
74
|
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -48,6 +48,16 @@ export declare class EnginiToolsetError extends EnginiError {
|
|
|
48
48
|
*/
|
|
49
49
|
export declare class EnginiToolsetNotFoundError extends EnginiToolsetError {
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Unknown MCP server token (a 404 remapped for a friendlier message by
|
|
53
|
+
* `McpResource.get`/`update`/`availableTools`). Mirrors the Python SDK's
|
|
54
|
+
* `EnginiMcpServerNotFoundError` so both sides map to the same CLI exit code.
|
|
55
|
+
* Unlike the toolset case there is no wider sibling error to sit under: an MCP
|
|
56
|
+
* server is addressed only by token, so there is no ambiguous-name resolution
|
|
57
|
+
* to distinguish it from.
|
|
58
|
+
*/
|
|
59
|
+
export declare class EnginiMcpServerNotFoundError extends EnginiError {
|
|
60
|
+
}
|
|
51
61
|
/** A polled asynchronous job (e.g. a connection refresh) did not finish in time. */
|
|
52
62
|
export declare class EnginiTimeoutError extends EnginiError {
|
|
53
63
|
}
|
package/dist/errors.js
CHANGED
|
@@ -51,6 +51,16 @@ export class EnginiToolsetError extends EnginiError {
|
|
|
51
51
|
*/
|
|
52
52
|
export class EnginiToolsetNotFoundError extends EnginiToolsetError {
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Unknown MCP server token (a 404 remapped for a friendlier message by
|
|
56
|
+
* `McpResource.get`/`update`/`availableTools`). Mirrors the Python SDK's
|
|
57
|
+
* `EnginiMcpServerNotFoundError` so both sides map to the same CLI exit code.
|
|
58
|
+
* Unlike the toolset case there is no wider sibling error to sit under: an MCP
|
|
59
|
+
* server is addressed only by token, so there is no ambiguous-name resolution
|
|
60
|
+
* to distinguish it from.
|
|
61
|
+
*/
|
|
62
|
+
export class EnginiMcpServerNotFoundError extends EnginiError {
|
|
63
|
+
}
|
|
54
64
|
/** A polled asynchronous job (e.g. a connection refresh) did not finish in time. */
|
|
55
65
|
export class EnginiTimeoutError extends EnginiError {
|
|
56
66
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export type { Auth } from "./auth.js";
|
|
|
5
5
|
export { composeUserAgent } from "./http.js";
|
|
6
6
|
export type { Verify } from "./http.js";
|
|
7
7
|
export { VERSION } from "./version.js";
|
|
8
|
-
export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, EnginiNotFoundError, EnginiValidationError, EnginiRateLimitError, EnginiConflictError, EnginiServerError, EnginiClientError, EnginiConnectionError, EnginiToolsetError, EnginiToolsetNotFoundError, EnginiTimeoutError, EnginiToolExecutionError, } from "./errors.js";
|
|
9
|
-
export { ToolsResource, ConnectionsResource, ToolsetsResource, ApplicationsResource, refreshFailed, } from "./resources/index.js";
|
|
8
|
+
export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, EnginiNotFoundError, EnginiValidationError, EnginiRateLimitError, EnginiConflictError, EnginiServerError, EnginiClientError, EnginiConnectionError, EnginiToolsetError, EnginiToolsetNotFoundError, EnginiMcpServerNotFoundError, EnginiTimeoutError, EnginiToolExecutionError, } from "./errors.js";
|
|
9
|
+
export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, ApplicationsResource, refreshFailed, } from "./resources/index.js";
|
|
10
10
|
export type { ToolsGetOptions, ToolsExecuteOptions, ApplicationsListOptions } from "./resources/index.js";
|
|
11
11
|
export { Toolset } from "./toolset.js";
|
|
12
12
|
export type { ConnectionBinding, ToolsetExecuteOptions } from "./toolset.js";
|
|
@@ -14,6 +14,7 @@ export { File } from "./files.js";
|
|
|
14
14
|
export type { FileWire } from "./files.js";
|
|
15
15
|
export type { ToolSchema, Filter, Sort, ToolExecuteResult, Application, ApplicationDetail, Connection, ConnectionDetail, ConnectionObject, WhoAmI, } from "./types.js";
|
|
16
16
|
export type { ToolsetConnectionDto, ToolsetConnectionRequest, ToolsetDto } from "@engini/client";
|
|
17
|
+
export type { McpServerPublicDto, McpServerConnectionDto, McpServerConnectionRequest, McpServerWorkflowDto, McpServerWorkflowRequest, McpAvailableToolDto, } from "@engini/client";
|
|
17
18
|
export type { Provider, ToolCall, ToolResultOptions } from "./providers/base.js";
|
|
18
19
|
export { OpenAIProvider } from "./providers/openai.js";
|
|
19
20
|
export type { OpenAIToolDef, OpenAIFunctionDef } from "./providers/openai.js";
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ export { Engini, DEFAULT_BASE_URL } from "./client.js";
|
|
|
2
2
|
export { ApiKeyAuth, BearerAuth, ENV_API_KEY_VAR, ENV_TOKEN_VAR, ENV_COMPANY_TOKEN_VAR, } from "./auth.js";
|
|
3
3
|
export { composeUserAgent } from "./http.js";
|
|
4
4
|
export { VERSION } from "./version.js";
|
|
5
|
-
export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, EnginiNotFoundError, EnginiValidationError, EnginiRateLimitError, EnginiConflictError, EnginiServerError, EnginiClientError, EnginiConnectionError, EnginiToolsetError, EnginiToolsetNotFoundError, EnginiTimeoutError, EnginiToolExecutionError, } from "./errors.js";
|
|
6
|
-
export { ToolsResource, ConnectionsResource, ToolsetsResource, ApplicationsResource, refreshFailed, } from "./resources/index.js";
|
|
5
|
+
export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, EnginiNotFoundError, EnginiValidationError, EnginiRateLimitError, EnginiConflictError, EnginiServerError, EnginiClientError, EnginiConnectionError, EnginiToolsetError, EnginiToolsetNotFoundError, EnginiMcpServerNotFoundError, EnginiTimeoutError, EnginiToolExecutionError, } from "./errors.js";
|
|
6
|
+
export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, ApplicationsResource, refreshFailed, } from "./resources/index.js";
|
|
7
7
|
export { Toolset } from "./toolset.js";
|
|
8
8
|
export { File } from "./files.js";
|
|
9
9
|
export { OpenAIProvider } from "./providers/openai.js";
|
|
@@ -2,5 +2,6 @@ export { ToolsResource } from "./tools.js";
|
|
|
2
2
|
export type { ToolsGetOptions, ToolsExecuteOptions } from "./tools.js";
|
|
3
3
|
export { ConnectionsResource, refreshFailed } from "./connections.js";
|
|
4
4
|
export { ToolsetsResource } from "./toolsets.js";
|
|
5
|
+
export { McpResource } from "./mcp.js";
|
|
5
6
|
export { ApplicationsResource } from "./applications.js";
|
|
6
7
|
export type { ApplicationsListOptions } from "./applications.js";
|
package/dist/resources/index.js
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP servers resource — inspect and maintain account-wide MCP servers.
|
|
3
|
+
*
|
|
4
|
+
* An MCP server is the endpoint Engini *exposes* over the Model Context Protocol,
|
|
5
|
+
* carrying a chosen set of tools and workflows. It is not the `MCPClient`
|
|
6
|
+
* connection kind, which is Engini *consuming* someone else's MCP server.
|
|
7
|
+
*
|
|
8
|
+
* Authoring and deletion stay in the engini.io UI: this resource deliberately has
|
|
9
|
+
* no `create` and no `delete`.
|
|
10
|
+
*/
|
|
11
|
+
import { type McpServerPublicDto, type McpServerConnectionRequest, type McpServerWorkflowRequest, type McpAvailableToolDto } from "@engini/client";
|
|
12
|
+
import { type Transport } from "../http.js";
|
|
13
|
+
/** Minimal client surface this resource needs (satisfied by `Engini`). */
|
|
14
|
+
export interface McpClient {
|
|
15
|
+
_transport: Transport;
|
|
16
|
+
}
|
|
17
|
+
export declare class McpResource {
|
|
18
|
+
private readonly client;
|
|
19
|
+
constructor(client: McpClient);
|
|
20
|
+
/**
|
|
21
|
+
* Every MCP server on the account, paginated.
|
|
22
|
+
*
|
|
23
|
+
* Account-wide, not per-user: an Engini API key sees every MCP server in the
|
|
24
|
+
* account. Deactivated servers are included, with `isActive` reporting state.
|
|
25
|
+
*/
|
|
26
|
+
list(): Promise<McpServerPublicDto[]>;
|
|
27
|
+
get(mcpServerToken: string): Promise<McpServerPublicDto>;
|
|
28
|
+
/**
|
|
29
|
+
* Update an MCP server. `PATCH /v1/mcpservers/{mcpServerToken}` replaces, it does
|
|
30
|
+
* not merge: an omitted member (`undefined`) leaves it unchanged, while a supplied
|
|
31
|
+
* `connections`/`workflows` list replaces the whole set. To add one connection,
|
|
32
|
+
* read the current set, append, and send the result — sending a single-element
|
|
33
|
+
* list drops every other entry.
|
|
34
|
+
*
|
|
35
|
+
* `isAnonymousAllowed` is read-only on this API and is always preserved. Every
|
|
36
|
+
* connection entry must carry an explicit `connectionId`: MCP servers are
|
|
37
|
+
* account-wide, so there is no per-user default connection to fall back on.
|
|
38
|
+
*/
|
|
39
|
+
update(mcpServerToken: string, params: {
|
|
40
|
+
name?: string;
|
|
41
|
+
isActive?: boolean;
|
|
42
|
+
connections?: McpServerConnectionRequest[];
|
|
43
|
+
workflows?: McpServerWorkflowRequest[];
|
|
44
|
+
}): Promise<McpServerPublicDto>;
|
|
45
|
+
/** Turn an MCP server on. Sends only the scalar, so nothing else is touched. */
|
|
46
|
+
activate(mcpServerToken: string): Promise<McpServerPublicDto>;
|
|
47
|
+
/** Turn an MCP server off. Reversible — a deactivated server still lists and fetches. */
|
|
48
|
+
deactivate(mcpServerToken: string): Promise<McpServerPublicDto>;
|
|
49
|
+
/** The tools a connection offers, i.e. the candidates for its `toolSlugs`. */
|
|
50
|
+
availableTools(mcpServerToken: string, connectionId: number): Promise<McpAvailableToolDto[]>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP servers resource — inspect and maintain account-wide MCP servers.
|
|
3
|
+
*
|
|
4
|
+
* An MCP server is the endpoint Engini *exposes* over the Model Context Protocol,
|
|
5
|
+
* carrying a chosen set of tools and workflows. It is not the `MCPClient`
|
|
6
|
+
* connection kind, which is Engini *consuming* someone else's MCP server.
|
|
7
|
+
*
|
|
8
|
+
* Authoring and deletion stay in the engini.io UI: this resource deliberately has
|
|
9
|
+
* no `create` and no `delete`.
|
|
10
|
+
*/
|
|
11
|
+
import { mcpServersListMcpServers, mcpServersGetMcpServer, mcpServersUpdateMcpServer, mcpServersGetAvailableTools, } from "@engini/client";
|
|
12
|
+
import { call } from "../http.js";
|
|
13
|
+
import { paginate, collect } from "../pagination.js";
|
|
14
|
+
import { EnginiNotFoundError, EnginiMcpServerNotFoundError } from "../errors.js";
|
|
15
|
+
export class McpResource {
|
|
16
|
+
client;
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.client = client;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Every MCP server on the account, paginated.
|
|
22
|
+
*
|
|
23
|
+
* Account-wide, not per-user: an Engini API key sees every MCP server in the
|
|
24
|
+
* account. Deactivated servers are included, with `isActive` reporting state.
|
|
25
|
+
*/
|
|
26
|
+
async list() {
|
|
27
|
+
const transport = this.client._transport;
|
|
28
|
+
return collect(paginate((offset, top) => call(mcpServersListMcpServers, { client: transport, query: { offset, top } })));
|
|
29
|
+
}
|
|
30
|
+
async get(mcpServerToken) {
|
|
31
|
+
try {
|
|
32
|
+
return await call(mcpServersGetMcpServer, {
|
|
33
|
+
client: this.client._transport,
|
|
34
|
+
path: { mcpServerToken },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
if (err instanceof EnginiNotFoundError) {
|
|
39
|
+
// The token is secret-equivalent (it is the SSE URL component), so unlike
|
|
40
|
+
// the toolset equivalent this message does not echo it back.
|
|
41
|
+
throw new EnginiMcpServerNotFoundError("Unknown MCP server token.");
|
|
42
|
+
}
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update an MCP server. `PATCH /v1/mcpservers/{mcpServerToken}` replaces, it does
|
|
48
|
+
* not merge: an omitted member (`undefined`) leaves it unchanged, while a supplied
|
|
49
|
+
* `connections`/`workflows` list replaces the whole set. To add one connection,
|
|
50
|
+
* read the current set, append, and send the result — sending a single-element
|
|
51
|
+
* list drops every other entry.
|
|
52
|
+
*
|
|
53
|
+
* `isAnonymousAllowed` is read-only on this API and is always preserved. Every
|
|
54
|
+
* connection entry must carry an explicit `connectionId`: MCP servers are
|
|
55
|
+
* account-wide, so there is no per-user default connection to fall back on.
|
|
56
|
+
*/
|
|
57
|
+
async update(mcpServerToken, params) {
|
|
58
|
+
try {
|
|
59
|
+
return await call(mcpServersUpdateMcpServer, {
|
|
60
|
+
client: this.client._transport,
|
|
61
|
+
path: { mcpServerToken },
|
|
62
|
+
body: {
|
|
63
|
+
name: params.name,
|
|
64
|
+
isActive: params.isActive,
|
|
65
|
+
connections: params.connections,
|
|
66
|
+
workflows: params.workflows,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (err instanceof EnginiNotFoundError) {
|
|
72
|
+
throw new EnginiMcpServerNotFoundError("Unknown MCP server token.");
|
|
73
|
+
}
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Turn an MCP server on. Sends only the scalar, so nothing else is touched. */
|
|
78
|
+
async activate(mcpServerToken) {
|
|
79
|
+
return this.update(mcpServerToken, { isActive: true });
|
|
80
|
+
}
|
|
81
|
+
/** Turn an MCP server off. Reversible — a deactivated server still lists and fetches. */
|
|
82
|
+
async deactivate(mcpServerToken) {
|
|
83
|
+
return this.update(mcpServerToken, { isActive: false });
|
|
84
|
+
}
|
|
85
|
+
/** The tools a connection offers, i.e. the candidates for its `toolSlugs`. */
|
|
86
|
+
async availableTools(mcpServerToken, connectionId) {
|
|
87
|
+
try {
|
|
88
|
+
return await call(mcpServersGetAvailableTools, {
|
|
89
|
+
client: this.client._transport,
|
|
90
|
+
path: { mcpServerToken },
|
|
91
|
+
query: { connectionId },
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
if (err instanceof EnginiNotFoundError) {
|
|
96
|
+
throw new EnginiMcpServerNotFoundError(`Unknown MCP server token, or connection ${connectionId} is not on this account.`);
|
|
97
|
+
}
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@engini/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Engini SDK — agent-first ergonomic layer over the Engini Public API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@engini/client": "0.
|
|
30
|
+
"@engini/client": "0.7.0",
|
|
31
31
|
"undici": "^6.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|