@lenso/mcp 0.1.0 → 0.2.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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type OperationBinding } from "@lenso/engine/application";
1
2
  export interface StdioOptions {
2
3
  /** Trusted launch configuration, never supplied by an MCP tool. */
3
4
  root: string;
@@ -8,6 +9,7 @@ export interface StdioOptions {
8
9
  maxInputBytes?: number;
9
10
  maxOutputBytes?: number;
10
11
  maxFrameBytes?: number;
12
+ binding?: OperationBinding;
11
13
  }
12
14
  /**
13
15
  * Owns a dedicated stdio process. Tools translate only to CLI call; no app or
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/index.ts
3
3
  import { Console } from "console";
4
- import { resolve } from "path";
4
+ import { join, resolve } from "path";
5
5
  import { Writable } from "stream";
6
6
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -12,7 +12,13 @@ import {
12
12
  McpError,
13
13
  ToolSchema
14
14
  } from "@modelcontextprotocol/sdk/types.js";
15
- import { call, inspect, CliError, diagnostic } from "@lenso/cli";
15
+ import { invoke, CliError, diagnostic } from "@lenso/cli";
16
+ import { readApplication } from "@lenso/engine/application";
17
+ import {
18
+ describeOperation,
19
+ redactOperationDescription,
20
+ validateOperations
21
+ } from "@lenso/engine/operations";
16
22
  import { environmentSecrets, redact, stableJson } from "@lenso/engine/diagnostics";
17
23
  var serving = false;
18
24
  function failure(code, phase, message) {
@@ -135,7 +141,8 @@ async function serveStdio(options) {
135
141
  });
136
142
  };
137
143
  try {
138
- const inspection = await inspect(root);
144
+ const { app, configPath } = await readApplication(root, join(root, "lenso.config.ts"));
145
+ const selected = validateOperations(app.plugins, app.mcpOperations ?? app.operations ?? []);
139
146
  const tools = [];
140
147
  const bindings = new Map;
141
148
  const seen = new Set;
@@ -144,7 +151,8 @@ async function serveStdio(options) {
144
151
  if (seen.has(key))
145
152
  throw failure("duplicate-operation", "discovery", "Duplicate MCP allowlist entry.");
146
153
  seen.add(key);
147
- const operation = inspection.operations.find((item) => item.pluginId === allowed.pluginId && item.method === allowed.method);
154
+ const ref = selected.find((item) => item.plugin.id === allowed.pluginId && item.method === allowed.method);
155
+ const operation = ref ? redactOperationDescription(describeOperation(ref, configPath)) : undefined;
148
156
  if (!operation)
149
157
  throw failure("unknown-operation", "discovery", "MCP allowlist operation is not declared.");
150
158
  const schema = operation.inputSchema;
@@ -197,7 +205,10 @@ async function serveStdio(options) {
197
205
  const input = request.params.arguments ?? {};
198
206
  if (Buffer.byteLength(stableJson(input)) > maxInput)
199
207
  throw failure("input-too-large", "input", "Operation input exceeds the host limit.");
200
- const data = await call(root, binding.pluginId, binding.method, input);
208
+ const data = await invoke({ ...app, operations: selected, operationBinding: undefined }, binding.pluginId, binding.method, input, async (operation, validatedInput, running) => ({
209
+ ...options.binding ? await options.binding(operation, validatedInput, running) : {},
210
+ maxOutputBytes: maxOutput
211
+ }));
201
212
  if (extra.signal.aborted)
202
213
  throw failure("request-cancelled", "invoke", "Request cancelled; operation may have completed. Cleanup was awaited.");
203
214
  return result(data, maxOutput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenso/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,12 +24,12 @@
24
24
  "test": "bun test"
25
25
  },
26
26
  "dependencies": {
27
- "@lenso/cli": "^0.18.0",
28
- "@lenso/engine": "^0.1.0",
27
+ "@lenso/cli": "^0.19.0",
28
+ "@lenso/engine": "^0.2.0",
29
29
  "@modelcontextprotocol/sdk": "1.32.1",
30
30
  "zod": "4.6.5"
31
31
  },
32
32
  "devDependencies": {
33
- "@lenso/core": "^0.1.0"
33
+ "@lenso/core": "^0.2.0"
34
34
  }
35
35
  }