@runa-cmd/mcp 0.2.0-beta.5 → 0.2.0-beta.7
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 +69 -0
- package/README.md +36 -3
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +38 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/operator.d.ts +9 -0
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +56 -3
- package/dist/operator.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -1
- package/dist/plugin.js.map +1 -1
- package/dist/schema.d.ts +12 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +49 -17
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @runa-cmd/mcp
|
|
2
2
|
|
|
3
|
+
## 0.2.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7fd5dd6: Error codes are now a list you can import. `ERROR_CODES` from `@runa-cmd/core` has every code core throws, and the README says when each one comes up. `isRunaError(error, code?)` tells if something is a `RunaError` with that code, and works even when two copies of `@runa-cmd/core` are installed, where `instanceof` fails. It takes your own codes too, as a `CommandError`'s:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
if (isRunaError(error, ERROR_CODES.INVALID_CONFIG)) {
|
|
11
|
+
/* the config file is wrong */
|
|
12
|
+
}
|
|
13
|
+
if (isRunaError(error, "DEPLOY_FAILED")) {
|
|
14
|
+
/* your own code */
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`@runa-cmd/mcp` exports `ERROR_CLASSES`, the `class` values of a failed call, and `MCP_ERROR_CODES`, its own startup codes. Its README lists each class with its `effect`.
|
|
19
|
+
|
|
20
|
+
**Breaking:** three codes are renamed, before they're fixed for 1.0.
|
|
21
|
+
|
|
22
|
+
| Before | Now |
|
|
23
|
+
| ----------------------------------------------------------------- | ----------------------------------- |
|
|
24
|
+
| `CONFIG_INVALID` (a `ConfigError`) | `INVALID_CONFIG` |
|
|
25
|
+
| `OPTION_NAME`, when two keys give the same flag | `OPTION_COLLISION`, as with globals |
|
|
26
|
+
| `OPTION_NAME`, when a boolean `noCache` clashes with `--no-cache` | `INVALID_OPTION_NAME` |
|
|
27
|
+
|
|
28
|
+
**Migration:** compare against the new names, or against `ERROR_CODES`. Messages and exit codes don't change.
|
|
29
|
+
|
|
30
|
+
- db60a2d: A tool call that's missing a value only the operator gives, as an option's env var, now fails with `class: "not_configured"`, not `invalid_input`. Its text starts with `The operator of this server has to set NOTES_FILE. It isn't a value you can send.`, so a model doesn't take it as its own mistake, nor ask the user for it. The server also says it at startup, on stderr, one line per tool, and keeps serving:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
mcpPlugin: tool 'add' can't run until the operator sets NOTES_FILE (--file).
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
An input error the model can fix names the key it sent, as `Invalid value for 'limit': must be greater than 0`, instead of `--limit`, a flag it never saw. The line about an operator's value still names the flag and the variable, for whoever runs the server.
|
|
37
|
+
|
|
38
|
+
**Breaking:** a plain `Error` thrown from `run()` is now `class: "crashed"`, with `The command did not finish.`, instead of `command_failed`. Only a `CommandError` is `command_failed`, with its message as you wrote it. A client can now tell a failure you foresaw from a bug, as the README always said.
|
|
39
|
+
|
|
40
|
+
**Migration:** to have the model read your message as is, throw a `CommandError`.
|
|
41
|
+
|
|
42
|
+
- ba4bdee: **Breaking:** a tool call that fails because a value the operator gave breaks its schema, in env or in the config file, now comes with `class: "not_configured"`, as a missing value does, instead of `invalid_input`. Its text says what the operator has to fix, never the value, so a model doesn't take it as its own mistake:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
The operator of this server has to fix 'deploy.replicas' in the config file. It isn't a value you can send.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The server also says it at startup, on stderr, with the reason, and keeps serving the other tools:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
mcpPlugin: tool 'deploy' can't run until the operator fixes DEPLOY_ENV (--env): expected one of: staging, production.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Values are checked with the rules the CLI uses, so `"5"` for a number in the config file is fine.
|
|
55
|
+
|
|
56
|
+
- 67e3865: **Breaking:** a tool call that sends an option the operator fixed now fails, and nothing runs:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
'replicas' is set by the operator of this server, so it can't be sent.
|
|
60
|
+
|
|
61
|
+
The command did not run.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It comes with `class: "invalid_input"` and `effect: "none"`, and never shows the operator's value. Before, the value was dropped and the call answered success with the operator's value: a model that sent `replicas: 5` got back a deploy with 2, and believed it had done what it was asked. An option that declares `env`, or has a value in the config file, is the operator's. To let the model choose it, list it in `expose`.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- 6592957: Each plugin requires the `@runa-cmd/core` it was released with. The peer of `help` was `^0.2.0-beta.1`, so npm could install it with an older `core` where `defaultDescription` and the `GLOBAL OPTIONS` section did nothing, without a warning. Until 1.0, the peer is always core's current version.
|
|
69
|
+
|
|
70
|
+
## 0.2.0-beta.6
|
|
71
|
+
|
|
3
72
|
## 0.2.0-beta.5
|
|
4
73
|
|
|
5
74
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ pnpm add @runa-cmd/mcp@beta
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
> Peer dependencies: `@runa-cmd/core` and `zod ^4.0.0`.
|
|
14
|
-
> Runtime dependency: `@modelcontextprotocol/sdk ^1.
|
|
14
|
+
> Runtime dependency: `@modelcontextprotocol/sdk ^1.32.2`.
|
|
15
|
+
>
|
|
16
|
+
> **New to it?** [Your CLI as an agent's tools](https://github.com/jrodrigopuca/runa-cmd/blob/main/guides/mcp.md) builds a CLI for agents step by step, and tests it as a client does.
|
|
15
17
|
|
|
16
18
|
## Quick Start
|
|
17
19
|
|
|
@@ -109,6 +111,35 @@ A failed call says what happened, not what to do next. `_meta['runa/error']` tel
|
|
|
109
111
|
|
|
110
112
|
A `CommandError` is the exception: the model reads your message as you wrote it, with `effect: "unknown"`, because only you know what the command did. To guide the model, say it there: `throw new CommandError('The proxy is off. Start it first.')`.
|
|
111
113
|
|
|
114
|
+
The `class` says what failed. Each one is part of the [contract](../../VERSIONING.md), and `ERROR_CLASSES` lists them:
|
|
115
|
+
|
|
116
|
+
| `class` | `effect` | When |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| `unknown_tool` | `none` | No tool has that name, or it's excluded |
|
|
119
|
+
| `invalid_input` | `none` | An argument or option the model sent is missing or breaks its schema |
|
|
120
|
+
| `not_configured` | `none` | A value only the operator gives is missing, as an option's env var, or breaks its schema, in env or in the config file. The model can't send it nor fix it, so the text says what the operator has to set or fix |
|
|
121
|
+
| `rejected` | `none` | The call failed before `run()`, as in a hook or a middleware |
|
|
122
|
+
| `not_run` | `none` | The call ended well without running the command, because a hook or a middleware skipped it |
|
|
123
|
+
| `command_failed` | `unknown` | `run()` threw a `CommandError`: the failure you wrote, with your message as is |
|
|
124
|
+
| `crashed` | `none` or `unknown` | `run()` threw any other error, as a plain `Error`: a bug, not a failure you foresaw. Also when the process ends without saying why |
|
|
125
|
+
| `invalid_output` | `completed` | `run()` returned a value its `output` schema rejects |
|
|
126
|
+
| `output_too_large` | `completed` | The result is over `maxOutput` |
|
|
127
|
+
| `after_run_failed` | `completed` | Something failed after `run()` returned, as an `afterRun` hook |
|
|
128
|
+
| `cancelled` | `unknown` | The client cancelled the call, or the server closed |
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { ERROR_CLASSES, type ErrorClass } from '@runa-cmd/mcp';
|
|
132
|
+
|
|
133
|
+
const retryable = (found: ErrorClass) => found === ERROR_CLASSES.CANCELLED;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
These stop the server at startup, with exit 1, and `MCP_ERROR_CODES` lists them. The rest of the codes are [core's](../core/README.md#error-codes):
|
|
137
|
+
|
|
138
|
+
| Code | When |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `MCP_INVALID_TOOLS` | The tool settings can't be met: `exclude` or `tools` names a tool or option that doesn't exist, an excluded tool has settings, a tool is read-only and destructive, an option is exposed and server-only, a `maxOutput` isn't a positive number, or a server-only option has no value |
|
|
141
|
+
| `MCP_SELF_CHECK_FAILED` | The CLI can't start itself as a subprocess, as a compiled binary without `selfCommand` |
|
|
142
|
+
|
|
112
143
|
**Retrying is up to you and whoever approves the calls.** Runa knows how far a command got, not whether repeating it is a good idea. If a command fails partway, a model only sees `unknown` and may run it again, so make that safe, or say so in your message.
|
|
113
144
|
|
|
114
145
|
### Cancellation
|
|
@@ -151,7 +182,9 @@ An unknown name in `exclude`, an excluded tool with settings, or a tool both rea
|
|
|
151
182
|
|
|
152
183
|
## What the Operator Decides
|
|
153
184
|
|
|
154
|
-
Whoever starts the server beats the model. An option that declares `env`, or has a value for that command in the config file, stays out of the tool's schema
|
|
185
|
+
Whoever starts the server beats the model. An option that declares `env`, or has a value for that command in the config file, stays out of the tool's schema. If a model sends it anyway, the call fails with `class: "invalid_input"` and nothing runs: `'replicas' is set by the operator of this server, so it can't be sent.` The text never shows the operator's value. To let the model choose, list the option in `expose`. This holds even if the env var isn't set: a missing required value fails the call with `class: "not_configured"`, and its text tells the model that the operator has to set it, so it doesn't take it as its own mistake. The server also says it at startup, on stderr, which clients show in their logs: `mcpPlugin: tool 'deploy' can't run until the operator sets DEPLOY_TOKEN (--token).` It keeps serving, because the other tools work.
|
|
186
|
+
|
|
187
|
+
A value the operator gave that breaks its schema works the same way, checked with the rules the CLI uses, so `"5"` for a number is fine. The call fails with `not_configured`, and the server says at startup what to fix, without the value: `mcpPlugin: tool 'deploy' can't run until the operator fixes DEPLOY_ENV (--env): expected one of: staging, production.`, or `fixes 'deploy.replicas' in the config file: expected number.`
|
|
155
188
|
|
|
156
189
|
```ts
|
|
157
190
|
mcpPlugin({
|
|
@@ -242,7 +275,7 @@ $ my-tool --mcp # Machine-readable MCP server
|
|
|
242
275
|
|
|
243
276
|
- **Transport**: stdio (stdin/stdout JSON-RPC)
|
|
244
277
|
- **Graceful shutdown**: Handles SIGINT and SIGTERM
|
|
245
|
-
- **SDK**: Uses `@modelcontextprotocol/sdk` v1.
|
|
278
|
+
- **SDK**: Uses `@modelcontextprotocol/sdk` v1.32+ with `McpServer` API
|
|
246
279
|
- **Zod v4 native**: Zod v4 implements [Standard Schema](https://github.com/standard-schema/standard-schema), so schemas pass directly to `registerTool()` — no conversion layer
|
|
247
280
|
|
|
248
281
|
### Testing with MCP Inspector
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a failed tool call reports in `_meta['runa/error']`, and the codes this
|
|
3
|
+
* plugin throws at startup. Both are contract; the README lists when each one
|
|
4
|
+
* comes up. Core's own codes are in `ERROR_CODES` from `@runa-cmd/core`.
|
|
5
|
+
*/
|
|
6
|
+
/** The `class` of a failed call: what failed. */
|
|
7
|
+
export declare const ERROR_CLASSES: {
|
|
8
|
+
/** No tool has that name, or it's excluded */
|
|
9
|
+
readonly UNKNOWN_TOOL: 'unknown_tool';
|
|
10
|
+
/** An argument or option the model sent is missing or breaks its schema */
|
|
11
|
+
readonly INVALID_INPUT: 'invalid_input';
|
|
12
|
+
/** A value only the operator gives is missing, as an option's env var */
|
|
13
|
+
readonly NOT_CONFIGURED: 'not_configured';
|
|
14
|
+
/** The call failed before run(), as in a hook or a middleware */
|
|
15
|
+
readonly REJECTED: 'rejected';
|
|
16
|
+
/** The call ended well without running the command */
|
|
17
|
+
readonly NOT_RUN: 'not_run';
|
|
18
|
+
/** run() threw a CommandError: the failure the author wrote */
|
|
19
|
+
readonly COMMAND_FAILED: 'command_failed';
|
|
20
|
+
/** run() threw any other error, or the process ended without saying why */
|
|
21
|
+
readonly CRASHED: 'crashed';
|
|
22
|
+
/** run() returned a value its output schema rejects */
|
|
23
|
+
readonly INVALID_OUTPUT: 'invalid_output';
|
|
24
|
+
/** The result is over maxOutput */
|
|
25
|
+
readonly OUTPUT_TOO_LARGE: 'output_too_large';
|
|
26
|
+
/** Something failed after run() returned */
|
|
27
|
+
readonly AFTER_RUN_FAILED: 'after_run_failed';
|
|
28
|
+
/** The client cancelled the call, or the server closed */
|
|
29
|
+
readonly CANCELLED: 'cancelled';
|
|
30
|
+
};
|
|
31
|
+
/** One of the classes of a failed call. */
|
|
32
|
+
export type ErrorClass = (typeof ERROR_CLASSES)[keyof typeof ERROR_CLASSES];
|
|
33
|
+
/** The codes mcpPlugin throws at startup, with exit 1. */
|
|
34
|
+
export declare const MCP_ERROR_CODES: {
|
|
35
|
+
/** The tool settings can't be met */
|
|
36
|
+
readonly MCP_INVALID_TOOLS: 'MCP_INVALID_TOOLS';
|
|
37
|
+
/** The CLI can't start itself as a subprocess */
|
|
38
|
+
readonly MCP_SELF_CHECK_FAILED: 'MCP_SELF_CHECK_FAILED';
|
|
39
|
+
};
|
|
40
|
+
/** One of mcpPlugin's error codes. */
|
|
41
|
+
export type McpErrorCode = (typeof MCP_ERROR_CODES)[keyof typeof MCP_ERROR_CODES];
|
|
42
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iDAAiD;AACjD,eAAO,MAAM,aAAa;IACzB,8CAA8C;aAC9C,YAAY,EAAE,cAAc;IAC5B,2EAA2E;aAC3E,aAAa,EAAE,eAAe;IAC9B,yEAAyE;aACzE,cAAc,EAAE,gBAAgB;IAChC,iEAAiE;aACjE,QAAQ,EAAE,UAAU;IACpB,sDAAsD;aACtD,OAAO,EAAE,SAAS;IAClB,+DAA+D;aAC/D,cAAc,EAAE,gBAAgB;IAChC,2EAA2E;aAC3E,OAAO,EAAE,SAAS;IAClB,uDAAuD;aACvD,cAAc,EAAE,gBAAgB;IAChC,mCAAmC;aACnC,gBAAgB,EAAE,kBAAkB;IACpC,4CAA4C;aAC5C,gBAAgB,EAAE,kBAAkB;IACpC,0DAA0D;aAC1D,SAAS,EAAE,WAAW;CACb,CAAC;AAEX,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE5E,0DAA0D;AAC1D,eAAO,MAAM,eAAe;IAC3B,qCAAqC;aACrC,iBAAiB,EAAE,mBAAmB;IACtC,iDAAiD;aACjD,qBAAqB,EAAE,uBAAuB;CACrC,CAAC;AAEX,sCAAsC;AACtC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a failed tool call reports in `_meta['runa/error']`, and the codes this
|
|
3
|
+
* plugin throws at startup. Both are contract; the README lists when each one
|
|
4
|
+
* comes up. Core's own codes are in `ERROR_CODES` from `@runa-cmd/core`.
|
|
5
|
+
*/
|
|
6
|
+
/** The `class` of a failed call: what failed. */
|
|
7
|
+
export const ERROR_CLASSES = {
|
|
8
|
+
/** No tool has that name, or it's excluded */
|
|
9
|
+
UNKNOWN_TOOL: 'unknown_tool',
|
|
10
|
+
/** An argument or option the model sent is missing or breaks its schema */
|
|
11
|
+
INVALID_INPUT: 'invalid_input',
|
|
12
|
+
/** A value only the operator gives is missing, as an option's env var */
|
|
13
|
+
NOT_CONFIGURED: 'not_configured',
|
|
14
|
+
/** The call failed before run(), as in a hook or a middleware */
|
|
15
|
+
REJECTED: 'rejected',
|
|
16
|
+
/** The call ended well without running the command */
|
|
17
|
+
NOT_RUN: 'not_run',
|
|
18
|
+
/** run() threw a CommandError: the failure the author wrote */
|
|
19
|
+
COMMAND_FAILED: 'command_failed',
|
|
20
|
+
/** run() threw any other error, or the process ended without saying why */
|
|
21
|
+
CRASHED: 'crashed',
|
|
22
|
+
/** run() returned a value its output schema rejects */
|
|
23
|
+
INVALID_OUTPUT: 'invalid_output',
|
|
24
|
+
/** The result is over maxOutput */
|
|
25
|
+
OUTPUT_TOO_LARGE: 'output_too_large',
|
|
26
|
+
/** Something failed after run() returned */
|
|
27
|
+
AFTER_RUN_FAILED: 'after_run_failed',
|
|
28
|
+
/** The client cancelled the call, or the server closed */
|
|
29
|
+
CANCELLED: 'cancelled',
|
|
30
|
+
};
|
|
31
|
+
/** The codes mcpPlugin throws at startup, with exit 1. */
|
|
32
|
+
export const MCP_ERROR_CODES = {
|
|
33
|
+
/** The tool settings can't be met */
|
|
34
|
+
MCP_INVALID_TOOLS: 'MCP_INVALID_TOOLS',
|
|
35
|
+
/** The CLI can't start itself as a subprocess */
|
|
36
|
+
MCP_SELF_CHECK_FAILED: 'MCP_SELF_CHECK_FAILED',
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,8CAA8C;IAC9C,YAAY,EAAE,cAAc;IAC5B,2EAA2E;IAC3E,aAAa,EAAE,eAAe;IAC9B,yEAAyE;IACzE,cAAc,EAAE,gBAAgB;IAChC,iEAAiE;IACjE,QAAQ,EAAE,UAAU;IACpB,sDAAsD;IACtD,OAAO,EAAE,SAAS;IAClB,+DAA+D;IAC/D,cAAc,EAAE,gBAAgB;IAChC,2EAA2E;IAC3E,OAAO,EAAE,SAAS;IAClB,uDAAuD;IACvD,cAAc,EAAE,gBAAgB;IAChC,mCAAmC;IACnC,gBAAgB,EAAE,kBAAkB;IACpC,4CAA4C;IAC5C,gBAAgB,EAAE,kBAAkB;IACpC,0DAA0D;IAC1D,SAAS,EAAE,WAAW;CACb,CAAC;AAKX,0DAA0D;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,qCAAqC;IACrC,iBAAiB,EAAE,mBAAmB;IACtC,iDAAiD;IACjD,qBAAqB,EAAE,uBAAuB;CACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Barrel re-exports for the MCP plugin package.
|
|
5
5
|
*/
|
|
6
|
+
export { ERROR_CLASSES, type ErrorClass, MCP_ERROR_CODES, type McpErrorCode } from './errors.js';
|
|
6
7
|
export { mcpPlugin } from './plugin.js';
|
|
7
8
|
export type { McpPluginOptions, ToolOptions } from './types.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAmB,eAAe,EAAqB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/operator.d.ts
CHANGED
|
@@ -10,6 +10,15 @@ export interface OperatorValues {
|
|
|
10
10
|
type ExposureOptions = Pick<McpPluginOptions, 'exclude' | 'tools' | 'maxOutput'>;
|
|
11
11
|
/** The tools as the model will see them. Fails at startup on an invalid setup. */
|
|
12
12
|
export declare function applyOperatorValues(registrations: ToolRegistration[], options: ExposureOptions, values: OperatorValues): ToolRegistration[];
|
|
13
|
+
export declare function missingValues(reg: ToolRegistration, withFlags?: boolean): string;
|
|
14
|
+
/** What the model reads first: what the operator has to set, and what to fix. */
|
|
15
|
+
export declare function operatorNote(reg: ToolRegistration): string;
|
|
16
|
+
/**
|
|
17
|
+
* What the operator has to set or fix before each tool can run. Said at
|
|
18
|
+
* startup, so it doesn't wait for a model to call the tool, and the server
|
|
19
|
+
* keeps serving: the other tools work.
|
|
20
|
+
*/
|
|
21
|
+
export declare function unconfiguredWarnings(registrations: ToolRegistration[]): string[];
|
|
13
22
|
/** Hide fixed values from text a command wrote without meaning to expose them. */
|
|
14
23
|
export declare function redact(text: string, values: string[]): string;
|
|
15
24
|
export {};
|
package/dist/operator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAOhE,MAAM,WAAW,cAAc;IAC9B,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IACnE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,KAAK,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC,CAAC;AAqIjF,kFAAkF;AAClF,wBAAgB,mBAAmB,CAClC,aAAa,EAAE,gBAAgB,EAAE,EACjC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,cAAc,GACpB,gBAAgB,EAAE,CAapB;AAMD,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,EAAE,SAAS,UAAQ,GAAG,MAAM,CAI9E;AAWD,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAK1D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAUhF;AAED,kFAAkF;AAClF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAE7D"}
|
package/dist/operator.js
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* turn into a parameter the model can ask a person for.
|
|
9
9
|
*/
|
|
10
10
|
import { RunaError } from '@runa-cmd/core';
|
|
11
|
-
import { longFlag } from '@runa-cmd/core/internal';
|
|
11
|
+
import { longFlag, operatorValueProblem } from '@runa-cmd/core/internal';
|
|
12
|
+
import { MCP_ERROR_CODES } from './errors.js';
|
|
12
13
|
const REDACTION = '[redacted]';
|
|
13
14
|
/** Shorter values could be any word, and replacing them would mangle the text. */
|
|
14
15
|
const MIN_REDACTED_LENGTH = 8;
|
|
15
16
|
function invalidTools(message) {
|
|
16
|
-
return new RunaError(`mcpPlugin: ${message}`, { code:
|
|
17
|
+
return new RunaError(`mcpPlugin: ${message}`, { code: MCP_ERROR_CODES.MCP_INVALID_TOOLS });
|
|
17
18
|
}
|
|
18
19
|
function assertValidLimit(limit, owner) {
|
|
19
20
|
if (limit === undefined || (Number.isInteger(limit) && limit > 0))
|
|
@@ -66,6 +67,8 @@ function applyToTool(reg, options, maxOutput, values) {
|
|
|
66
67
|
const inputShape = { ...reg.inputShape };
|
|
67
68
|
const fixed = new Set();
|
|
68
69
|
const fixedValues = [];
|
|
70
|
+
const unconfigured = [];
|
|
71
|
+
const misconfigured = [];
|
|
69
72
|
for (const key of reg.optionKeys) {
|
|
70
73
|
if (options.expose?.includes(key))
|
|
71
74
|
continue;
|
|
@@ -75,9 +78,26 @@ function applyToTool(reg, options, maxOutput, values) {
|
|
|
75
78
|
throw invalidTools(`option ${longFlag(key)} of tool '${reg.name}' is server-only and has no value. ` +
|
|
76
79
|
'Set it through its env var or the config file.');
|
|
77
80
|
}
|
|
78
|
-
const
|
|
81
|
+
const envName = envNameOf(key, reg);
|
|
82
|
+
const belongsToOperator = value !== undefined || envName !== undefined;
|
|
79
83
|
if (!belongsToOperator)
|
|
80
84
|
continue;
|
|
85
|
+
// A model can't send it, so without a value no call can run (T-236)
|
|
86
|
+
const schema = inputShape[key];
|
|
87
|
+
const required = schema?.safeParse(undefined).success === false;
|
|
88
|
+
if (value === undefined && envName !== undefined && required) {
|
|
89
|
+
unconfigured.push({ key, env: envName });
|
|
90
|
+
}
|
|
91
|
+
// Nor with a value that breaks its schema: checked as the CLI checks it (T-255)
|
|
92
|
+
if (value !== undefined && schema) {
|
|
93
|
+
const fromEnv = envName !== undefined && values.env[envName] !== undefined;
|
|
94
|
+
const reason = operatorValueProblem(schema, value, fromEnv ? 'env' : 'config');
|
|
95
|
+
if (reason !== undefined) {
|
|
96
|
+
misconfigured.push(fromEnv
|
|
97
|
+
? { key, env: envName, reason }
|
|
98
|
+
: { key, configKey: [...reg.path, key].join('.'), reason });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
81
101
|
delete inputShape[key];
|
|
82
102
|
fixed.add(key);
|
|
83
103
|
if (value !== undefined)
|
|
@@ -89,6 +109,8 @@ function applyToTool(reg, options, maxOutput, values) {
|
|
|
89
109
|
annotations: options.annotations,
|
|
90
110
|
inputShape,
|
|
91
111
|
fixed,
|
|
112
|
+
unconfigured,
|
|
113
|
+
misconfigured,
|
|
92
114
|
redactions: redactable([...fixedValues, ...Object.values(values.globals)]),
|
|
93
115
|
maxOutput: options.maxOutput ?? maxOutput ?? reg.maxOutput,
|
|
94
116
|
};
|
|
@@ -105,6 +127,37 @@ export function applyOperatorValues(registrations, options, values) {
|
|
|
105
127
|
.filter((reg) => !exclude.includes(reg.name))
|
|
106
128
|
.map((reg) => applyToTool(reg, tools[reg.name] ?? {}, maxOutput, values));
|
|
107
129
|
}
|
|
130
|
+
/** The variables, as `NOTES_FILE` or `A (--a) and B (--b)` with their flags. */
|
|
131
|
+
const listOf = (names) => names.length > 1 ? `${names.slice(0, -1).join(', ')} and ${names.at(-1)}` : `${names[0]}`;
|
|
132
|
+
export function missingValues(reg, withFlags = false) {
|
|
133
|
+
return listOf(reg.unconfigured.map(({ key, env }) => (withFlags ? `${env} (${longFlag(key)})` : env)));
|
|
134
|
+
}
|
|
135
|
+
/** Where a wrong value is: its variable, or its key in the config file. Never the value. */
|
|
136
|
+
function wrongValueAt({ key, env, configKey }, withFlags) {
|
|
137
|
+
if (env !== undefined)
|
|
138
|
+
return withFlags ? `${env} (${longFlag(key)})` : env;
|
|
139
|
+
return `'${configKey}' in the config file`;
|
|
140
|
+
}
|
|
141
|
+
/** What the model reads first: what the operator has to set, and what to fix. */
|
|
142
|
+
export function operatorNote(reg) {
|
|
143
|
+
const set = reg.unconfigured.length > 0 ? [`set ${missingValues(reg)}`] : [];
|
|
144
|
+
const wrong = reg.misconfigured.map((item) => wrongValueAt(item, false));
|
|
145
|
+
const fix = wrong.length > 0 ? [`fix ${listOf(wrong)}`] : [];
|
|
146
|
+
return `The operator of this server has to ${[...set, ...fix].join(' and ')}. It isn't a value you can send.`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* What the operator has to set or fix before each tool can run. Said at
|
|
150
|
+
* startup, so it doesn't wait for a model to call the tool, and the server
|
|
151
|
+
* keeps serving: the other tools work.
|
|
152
|
+
*/
|
|
153
|
+
export function unconfiguredWarnings(registrations) {
|
|
154
|
+
return registrations.flatMap((reg) => {
|
|
155
|
+
const prefix = `mcpPlugin: tool '${reg.name}' can't run until the operator`;
|
|
156
|
+
const missing = reg.unconfigured.length > 0 ? [`${prefix} sets ${missingValues(reg, true)}.`] : [];
|
|
157
|
+
const wrong = reg.misconfigured.map((item) => `${prefix} fixes ${wrongValueAt(item, true)}: ${item.reason}.`);
|
|
158
|
+
return [...missing, ...wrong];
|
|
159
|
+
});
|
|
160
|
+
}
|
|
108
161
|
/** Hide fixed values from text a command wrote without meaning to expose them. */
|
|
109
162
|
export function redact(text, values) {
|
|
110
163
|
return values.reduce((result, value) => result.replaceAll(value, REDACTION), text);
|
package/dist/operator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.js","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAmB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"operator.js","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,CAAC,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,MAAgB;IACpD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;AACpF,CAAC"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAOnD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,gBAAqB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAOnD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,gBAAqB,GAAG,YAAY,CAkDnE"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { definePlugin } from '@runa-cmd/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { applyOperatorValues } from './operator.js';
|
|
3
|
+
import { applyOperatorValues, unconfiguredWarnings } from './operator.js';
|
|
4
4
|
import { defaultSelfCommand } from './runner.js';
|
|
5
5
|
import { buildToolRegistrations } from './schema.js';
|
|
6
6
|
/** What a child repeats from the server's own start: everything but `--mcp`. */
|
|
@@ -36,6 +36,9 @@ export function mcpPlugin(opts = {}) {
|
|
|
36
36
|
env: process.env,
|
|
37
37
|
globals: ctx.globalOptions,
|
|
38
38
|
});
|
|
39
|
+
// stderr reaches the client's logs, and stdout is the protocol
|
|
40
|
+
for (const warning of unconfiguredWarnings(registrations))
|
|
41
|
+
console.error(warning);
|
|
39
42
|
// Loaded here so a plain CLI run doesn't pay for the MCP SDK
|
|
40
43
|
const { serve } = await import('./server.js');
|
|
41
44
|
await serve(registrations, {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGrD,gFAAgF;AAChF,SAAS,WAAW;IACnB,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAClG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAI,GAAqB,EAAE;IACpD,OAAO,YAAY,CAAC;QACnB,IAAI,EAAE;YACL,IAAI,EAAE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MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;gBAE9C,MAAM,KAAK,CAAC,aAAa,EAAE;oBAC1B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI;oBACnC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO;oBACvD,YAAY,EAAE,IAAI,CAAC,YAAY;oBAC/B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB,EAAE;oBACrD,IAAI,EAAE,WAAW,EAAE;iBACnB,CAAC,CAAC;gBAEH,gDAAgD;gBAChD,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -29,6 +29,18 @@ export interface ToolRegistration {
|
|
|
29
29
|
optionKeys: Set<string>;
|
|
30
30
|
/** Options the operator fixed: out of the schema, and dropped from any call */
|
|
31
31
|
fixed: Set<string>;
|
|
32
|
+
/** Required options only the operator can give, still without a value: the tool can't run */
|
|
33
|
+
unconfigured: Array<{
|
|
34
|
+
key: string;
|
|
35
|
+
env: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** Values the operator gave that break their schema: the tool can't run either (T-255) */
|
|
38
|
+
misconfigured: Array<{
|
|
39
|
+
key: string;
|
|
40
|
+
env?: string;
|
|
41
|
+
configKey?: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
}>;
|
|
32
44
|
/** Text to hide from what the command writes */
|
|
33
45
|
redactions: string[];
|
|
34
46
|
/** Most bytes of output this tool can answer with */
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,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b,yDAAyD;IACzD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,kCAAkC;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,+EAA+E;IAC/E,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,6FAA6F;IAC7F,YAAY,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,0FAA0F;IAC1F,aAAa,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxF,gDAAgD;IAChD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,eAAe,CAAC;CAC9B;AA+FD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,SAAS,GACf,gBAAgB,EAAE,CAEpB"}
|
package/dist/schema.js
CHANGED
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|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a,EAAE,EAAE;gBACjB,UAAU,EAAE,EAAE;gBACd,SAAS,EAAE,kBAAkB;aAC7B,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACP,2BAA2B;YAC3B,aAAa,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,+DAA+D;AAE/D;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACrC,QAAqB,EACrB,MAAiB;IAEjB,OAAO,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,IAAI,EACT,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,IAAI,EACT,MAAM,oCAAoC,CAAC;AAM5C,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgBpD,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAS1D;AAmHD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,GAAG,cAAc,CAiBzF;AAID,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD,wBAAgB,eAAe,CAAC,aAAa,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,MAAM,CAsChG;AAED;;;GAGG;AACH,wBAAsB,KAAK,CAC1B,aAAa,EAAE,gBAAgB,EAAE,EACjC,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
package/dist/server.js
CHANGED
|
@@ -11,6 +11,8 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
11
11
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
12
12
|
import { RunaError } from '@runa-cmd/core';
|
|
13
13
|
import { z } from 'zod';
|
|
14
|
+
import { ERROR_CLASSES, MCP_ERROR_CODES } from './errors.js';
|
|
15
|
+
import { operatorNote } from './operator.js';
|
|
14
16
|
import { childrenFinished, runChild } from './runner.js';
|
|
15
17
|
const SELF_CHECK_TIMEOUT_MS = 10_000;
|
|
16
18
|
// ─── Tool definitions ───────────────────────────────────────
|
|
@@ -44,29 +46,37 @@ const EFFECT_TEXT = {
|
|
|
44
46
|
* The reports say how far the command got. Without one, a command may have done
|
|
45
47
|
* anything: the safe reading of the unknown is never that nothing happened.
|
|
46
48
|
*/
|
|
47
|
-
function findFailure({ reports, status, cancelled }) {
|
|
49
|
+
function findFailure({ reports, status, cancelled }, reg) {
|
|
48
50
|
const reached = (kind) => reports.some((report) => report.kind === kind);
|
|
49
51
|
const failed = reports.find((report) => report.kind === 'failed');
|
|
52
|
+
const { AFTER_RUN_FAILED, CANCELLED, COMMAND_FAILED, CRASHED, INVALID_INPUT } = ERROR_CLASSES;
|
|
53
|
+
const { INVALID_OUTPUT, NOT_CONFIGURED, NOT_RUN, OUTPUT_TOO_LARGE, REJECTED } = ERROR_CLASSES;
|
|
50
54
|
if (cancelled)
|
|
51
|
-
return { class:
|
|
55
|
+
return { class: CANCELLED, effect: 'unknown' };
|
|
52
56
|
if (reached('oversized'))
|
|
53
|
-
return { class:
|
|
57
|
+
return { class: OUTPUT_TOO_LARGE, effect: 'completed' };
|
|
54
58
|
if (reached('result')) {
|
|
55
59
|
if (!failed && status === 0)
|
|
56
60
|
return undefined;
|
|
57
|
-
return { class:
|
|
61
|
+
return { class: AFTER_RUN_FAILED, effect: 'completed' };
|
|
58
62
|
}
|
|
59
63
|
if (reached('ran')) {
|
|
60
64
|
const invalid = failed?.reason === 'output';
|
|
61
|
-
return { class: invalid ?
|
|
65
|
+
return { class: invalid ? INVALID_OUTPUT : AFTER_RUN_FAILED, effect: 'completed' };
|
|
62
66
|
}
|
|
63
67
|
if (reached('running')) {
|
|
64
|
-
|
|
68
|
+
// Only a CommandError is a failure the author wrote: anything else is a bug
|
|
69
|
+
return { class: failed?.reason === 'command' ? COMMAND_FAILED : CRASHED, effect: 'unknown' };
|
|
65
70
|
}
|
|
66
|
-
if (failed) {
|
|
67
|
-
|
|
71
|
+
if (failed?.reason === 'input') {
|
|
72
|
+
// What the operator didn't set is what's missing first, whatever the model sent
|
|
73
|
+
// Missing or wrong, a value of the operator is the operator's to fix (T-255)
|
|
74
|
+
const configured = reg.unconfigured.length === 0 && reg.misconfigured.length === 0;
|
|
75
|
+
return { class: configured ? INVALID_INPUT : NOT_CONFIGURED, effect: 'none' };
|
|
68
76
|
}
|
|
69
|
-
|
|
77
|
+
if (failed)
|
|
78
|
+
return { class: REJECTED, effect: 'none' };
|
|
79
|
+
return { class: status === 0 ? NOT_RUN : CRASHED, effect: 'none' };
|
|
70
80
|
}
|
|
71
81
|
/** Anything the model has to read goes in the text: `_meta` is for the client. */
|
|
72
82
|
const failure = (reason, found) => ({
|
|
@@ -75,11 +85,21 @@ const failure = (reason, found) => ({
|
|
|
75
85
|
content: [
|
|
76
86
|
{
|
|
77
87
|
type: 'text',
|
|
78
|
-
text: found.class ===
|
|
88
|
+
text: found.class === ERROR_CLASSES.COMMAND_FAILED
|
|
89
|
+
? reason
|
|
90
|
+
: `${reason}\n\n${EFFECT_TEXT[found.effect]}`,
|
|
79
91
|
},
|
|
80
92
|
],
|
|
81
93
|
_meta: { 'runa/error': found },
|
|
82
94
|
});
|
|
95
|
+
/** A call that sends options the operator fixed. It names them, never their values. */
|
|
96
|
+
function operatorSets(keys) {
|
|
97
|
+
const names = keys.map((key) => `'${key}'`);
|
|
98
|
+
const list = names.length > 1 ? `${names.slice(0, -1).join(', ')} and ${names.at(-1)}` : names[0];
|
|
99
|
+
const verb = names.length > 1 ? 'are' : 'is';
|
|
100
|
+
const pronoun = names.length > 1 ? 'they' : 'it';
|
|
101
|
+
return failure(`${list} ${verb} set by the operator of this server, so ${pronoun} can't be sent.`, { class: ERROR_CLASSES.INVALID_INPUT, effect: 'none' });
|
|
102
|
+
}
|
|
83
103
|
function failedChild(reg, outcome, found) {
|
|
84
104
|
const oversized = outcome.reports.find((report) => report.kind === 'oversized');
|
|
85
105
|
if (oversized) {
|
|
@@ -87,10 +107,15 @@ function failedChild(reg, outcome, found) {
|
|
|
87
107
|
}
|
|
88
108
|
const written = outcome.stderr.trim();
|
|
89
109
|
const printed = outcome.stdout.trim();
|
|
90
|
-
|
|
110
|
+
const reason = written || printed || silentFailure(reg, outcome, found);
|
|
111
|
+
if (found.class !== ERROR_CLASSES.NOT_CONFIGURED)
|
|
112
|
+
return failure(reason, found);
|
|
113
|
+
// The model reads this: it can't send the value, nor ask the user for it
|
|
114
|
+
const note = operatorNote(reg);
|
|
115
|
+
return failure(`${note}\n\n${reason}`, found);
|
|
91
116
|
}
|
|
92
117
|
function silentFailure(reg, outcome, found) {
|
|
93
|
-
if (found.class ===
|
|
118
|
+
if (found.class === ERROR_CLASSES.CANCELLED)
|
|
94
119
|
return `Command '${reg.name}' was cancelled.`;
|
|
95
120
|
if (outcome.status !== 0)
|
|
96
121
|
return `Command '${reg.name}' exited with code ${outcome.status}.`;
|
|
@@ -101,7 +126,7 @@ function silentFailure(reg, outcome, found) {
|
|
|
101
126
|
* can exit on its own. Only the reports say how far it got.
|
|
102
127
|
*/
|
|
103
128
|
export function toToolResult(reg, outcome) {
|
|
104
|
-
const found = findFailure(outcome);
|
|
129
|
+
const found = findFailure(outcome, reg);
|
|
105
130
|
if (found)
|
|
106
131
|
return failedChild(reg, outcome, found);
|
|
107
132
|
const finished = outcome.reports.find((report) => report.kind === 'result');
|
|
@@ -122,7 +147,7 @@ async function assertCanRunItself(options) {
|
|
|
122
147
|
if (reports.some((report) => report.kind === 'pong'))
|
|
123
148
|
return;
|
|
124
149
|
throw new RunaError(`Cannot run this CLI as a subprocess with: ${options.selfCommand.join(' ')}. ` +
|
|
125
|
-
'If it is a compiled binary, set mcpPlugin({ selfCommand }).', { code:
|
|
150
|
+
'If it is a compiled binary, set mcpPlugin({ selfCommand }).', { code: MCP_ERROR_CODES.MCP_SELF_CHECK_FAILED });
|
|
126
151
|
}
|
|
127
152
|
export function createMcpServer(registrations, options) {
|
|
128
153
|
const server = new Server({ name: options.name, version: options.version }, { capabilities: { tools: {} }, instructions: options.instructions });
|
|
@@ -132,10 +157,17 @@ export function createMcpServer(registrations, options) {
|
|
|
132
157
|
server.setRequestHandler(CallToolRequestSchema, async ({ params }, extra) => {
|
|
133
158
|
const reg = registrations.find((candidate) => candidate.name === params.name);
|
|
134
159
|
if (!reg) {
|
|
135
|
-
return failure(`Unknown tool: ${params.name}`, {
|
|
160
|
+
return failure(`Unknown tool: ${params.name}`, {
|
|
161
|
+
class: ERROR_CLASSES.UNKNOWN_TOOL,
|
|
162
|
+
effect: 'none',
|
|
163
|
+
});
|
|
136
164
|
}
|
|
137
|
-
//
|
|
138
|
-
|
|
165
|
+
// The operator's value wins, and the model has to know its own isn't used:
|
|
166
|
+
// running with another value and answering success told it otherwise (ADR-0049)
|
|
167
|
+
const input = params.arguments ?? {};
|
|
168
|
+
const fixed = Object.keys(input).filter((key) => reg.fixed.has(key));
|
|
169
|
+
if (fixed.length > 0)
|
|
170
|
+
return operatorSets(fixed);
|
|
139
171
|
const outcome = await runChild({ kind: 'call', path: reg.path, input, maxResultBytes: reg.maxOutput }, {
|
|
140
172
|
...options,
|
|
141
173
|
signal: options.signal ? AbortSignal.any([extra.signal, options.signal]) : extra.signal,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACN,qBAAqB,EAErB,sBAAsB,GAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACN,qBAAqB,EAErB,sBAAsB,GAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,aAAa,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,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C9B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,wDAAwD;IAE9F,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjD,MAAM,MAAM,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runa-cmd/mcp",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.7",
|
|
4
4
|
"description": "MCP (Model Context Protocol) server mode for Runa CLIs. Turn commands into AI-callable tools.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.32.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@runa-cmd/core": "^0.2.0-beta.
|
|
28
|
+
"@runa-cmd/core": "^0.2.0-beta.7",
|
|
29
29
|
"zod": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"@types/node": "^24.19.2",
|
|
53
53
|
"typescript": "^7.0.2",
|
|
54
54
|
"zod": "^4.6.7",
|
|
55
|
-
"@runa-cmd/core": "0.2.0-beta.
|
|
55
|
+
"@runa-cmd/core": "0.2.0-beta.7"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc",
|
|
59
59
|
"dev": "tsc --watch --preserveWatchOutput",
|
|
60
|
-
"typecheck": "tsc --noEmit",
|
|
60
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
61
61
|
"test": "vitest run",
|
|
62
62
|
"test:watch": "vitest",
|
|
63
63
|
"lint": "biome check .",
|