@corsair-dev/mcp 0.1.24 → 0.1.25

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.
@@ -12,5 +12,8 @@ export type BaseMcpOptions = {
12
12
  corsair: {
13
13
  [key: string]: unknown;
14
14
  };
15
+ runOptions?: {
16
+ readonly: boolean;
17
+ };
15
18
  };
16
19
  //# sourceMappingURL=adapters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,UAAU,CAAC,EAAE;QACZ,QAAQ,EAAE,OAAO,CAAC;KAClB,CAAC;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACpE,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,cAAc,GACrB,cAAc,EAAE,CAmGlB"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACpE,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,cAAc,GACrB,cAAc,EAAE,CAuGlB"}
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ function shapeToJsonSchema(shape) {
12
12
  }
13
13
 
14
14
  // src/core/tools.ts
15
- import { listOperations } from "corsair";
15
+ import { listOperations, runReadonly } from "corsair";
16
16
  import { z as z2 } from "zod";
17
17
 
18
18
  // src/core/schema-format.ts
@@ -23,7 +23,7 @@ function formatGetSchemaResponse(corsair, path) {
23
23
 
24
24
  // src/core/tools.ts
25
25
  function buildCorsairToolDefs(options) {
26
- const { corsair } = options;
26
+ const { corsair, runOptions } = options;
27
27
  const defs = [
28
28
  {
29
29
  name: "list_operations",
@@ -69,14 +69,14 @@ function buildCorsairToolDefs(options) {
69
69
  )
70
70
  },
71
71
  handler: async ({ code }) => {
72
+ const readonly = runOptions?.readonly || false;
72
73
  try {
73
74
  const fn = new Function(
74
75
  "corsair",
75
76
  `return (async () => { ${code} })()`
76
77
  );
77
- const result = await fn(
78
- corsair
79
- );
78
+ const invoke = () => fn(corsair);
79
+ const result = readonly ? await runReadonly(invoke) : await invoke();
80
80
  return {
81
81
  content: [
82
82
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/mcp",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "MCP server and SDK adapters for Corsair — list operations, inspect schemas, run API calls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "@modelcontextprotocol/sdk": "^1.27.1",
22
22
  "express": "^4.21.0",
23
23
  "zod": "^4.1.13",
24
- "corsair": "0.1.103"
24
+ "corsair": "0.1.107"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@anthropic-ai/claude-agent-sdk": ">=0.2.0",