@rsconcept/rstool-mcp 0.4.0 → 0.5.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 +1 -0
- package/dist/bin/server.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{server-CM8yRC3G.js → server-BuxSpa2B.js} +25 -5
- package/dist/server-BuxSpa2B.js.map +1 -0
- package/package.json +10 -9
- package/src/server.test.ts +1 -0
- package/src/tools.ts +27 -4
- package/dist/server-CM8yRC3G.js.map +0 -1
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ Edit `claude_desktop_config.json` (`~/Library/Application Support/Claude/` on ma
|
|
|
92
92
|
| `get_model_state` | `getModelState` | Values + statuses. |
|
|
93
93
|
| `evaluate` | `evaluate` | Scratch or stored constituent. |
|
|
94
94
|
| `recalculate_model` | `recalculateModel` | Full recompute. |
|
|
95
|
+
| `restore_order` | `restoreOrder` | Restore declaration order (topo + semantic). |
|
|
95
96
|
|
|
96
97
|
Session tools accept optional `sessionId` (flat params, no `input` wrapper). Prefer `apply_schema_patch` for schema edits.
|
|
97
98
|
|
package/dist/bin/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as buildRSToolMcpServer } from "../server-
|
|
2
|
+
import { t as buildRSToolMcpServer } from "../server-BuxSpa2B.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
//#region src/bin/server.ts
|
|
5
5
|
async function main() {
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TOOL_DEFINITIONS, t as buildRSToolMcpServer } from "./server-
|
|
1
|
+
import { n as TOOL_DEFINITIONS, t as buildRSToolMcpServer } from "./server-BuxSpa2B.js";
|
|
2
2
|
export { TOOL_DEFINITIONS, buildRSToolMcpServer };
|
|
@@ -171,18 +171,29 @@ const TOOL_DEFINITIONS = [
|
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
name: "list_diagnostics",
|
|
174
|
-
description: "List active diagnostics for the session (
|
|
174
|
+
description: "List active diagnostics for the session: expression (formula), schema (homonyms, duplicates, metadata), model (interpretation status).",
|
|
175
175
|
inputSchema: {
|
|
176
176
|
type: "object",
|
|
177
177
|
properties: {
|
|
178
178
|
sessionId,
|
|
179
|
-
constituentId: { type: "number" }
|
|
179
|
+
constituentId: { type: "number" },
|
|
180
|
+
kind: {
|
|
181
|
+
type: "string",
|
|
182
|
+
enum: [
|
|
183
|
+
"expression",
|
|
184
|
+
"schema",
|
|
185
|
+
"model"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
180
188
|
}
|
|
181
189
|
},
|
|
182
190
|
invoke: (tool, args) => {
|
|
183
191
|
const constituentId = args.constituentId;
|
|
184
|
-
const
|
|
185
|
-
|
|
192
|
+
const kind = args.kind;
|
|
193
|
+
const filters = {};
|
|
194
|
+
if (typeof constituentId === "number") filters.constituentId = constituentId;
|
|
195
|
+
if (kind === "expression" || kind === "schema" || kind === "model") filters.kind = kind;
|
|
196
|
+
return tool.listDiagnostics(Object.keys(filters).length > 0 ? filters : void 0, optionalSessionId(args));
|
|
186
197
|
}
|
|
187
198
|
},
|
|
188
199
|
{
|
|
@@ -305,6 +316,15 @@ const TOOL_DEFINITIONS = [
|
|
|
305
316
|
properties: { sessionId }
|
|
306
317
|
},
|
|
307
318
|
invoke: (tool, args) => tool.recalculateModel(optionalSessionId(args))
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "restore_order",
|
|
322
|
+
description: "Restore constituent declaration order: formal topology, semantic clusters when ready, otherwise stable type/kernel ranks.",
|
|
323
|
+
inputSchema: {
|
|
324
|
+
type: "object",
|
|
325
|
+
properties: { sessionId }
|
|
326
|
+
},
|
|
327
|
+
invoke: (tool, args) => tool.restoreOrder(optionalSessionId(args))
|
|
308
328
|
}
|
|
309
329
|
];
|
|
310
330
|
//#endregion
|
|
@@ -369,4 +389,4 @@ function buildRSToolMcpServer(options = {}) {
|
|
|
369
389
|
//#endregion
|
|
370
390
|
export { TOOL_DEFINITIONS as n, buildRSToolMcpServer as t };
|
|
371
391
|
|
|
372
|
-
//# sourceMappingURL=server-
|
|
392
|
+
//# sourceMappingURL=server-BuxSpa2B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-BuxSpa2B.js","names":[],"sources":["../src/tools.ts","../src/server.ts"],"sourcesContent":["/**\n * MCP tool definitions for the @rsconcept/rstool contract.\n */\n\nimport { type RSToolAgent } from \"@rsconcept/rstool\";\n\nexport interface ToolDefinition {\n name: string;\n description: string;\n inputSchema: {\n type: \"object\";\n properties: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n };\n invoke: (\n tool: RSToolAgent,\n args: Record<string, unknown>,\n ) => unknown | Promise<unknown>;\n}\n\nconst sessionId = {\n type: \"string\",\n description: \"Session id. Omit to use the current active session.\",\n};\n\nconst agentPatchSchema = {\n type: \"object\",\n description:\n \"Agent-friendly constituent patch. id and cstType are optional; cstType is inferred from alias prefixes X/C/S/D/A/F/P.\",\n properties: {\n id: { type: \"number\" },\n alias: { type: \"string\" },\n cstType: { type: \"string\" },\n definitionFormal: { type: \"string\" },\n term: { type: \"string\" },\n definitionText: { type: \"string\" },\n convention: { type: \"string\" },\n },\n required: [\"alias\"],\n};\n\nfunction optionalSessionId(args: Record<string, unknown>): string | undefined {\n const value = args.sessionId;\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\nfunction omitSessionId(args: Record<string, unknown>): Record<string, unknown> {\n const { sessionId: _sessionId, ...rest } = args;\n return rest;\n}\n\nexport const TOOL_DEFINITIONS: ToolDefinition[] = [\n {\n name: \"ping\",\n description:\n \"Liveness check; returns {pong: true} and the active rstool contract version.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: (tool) => ({ pong: true, contractVersion: tool.contractVersion }),\n },\n {\n name: \"list_methods\",\n description: \"List all rstool methods exposed as MCP tools.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: () => TOOL_DEFINITIONS.map((definition) => definition.name),\n },\n {\n name: \"ensure_session\",\n description:\n \"Return the current active session, or create one if none exists. Optional initial seed is used only when creating.\",\n inputSchema: {\n type: \"object\",\n properties: {\n initial: {\n type: \"object\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: true,\n },\n },\n additionalProperties: false,\n },\n invoke: (tool, args) => tool.ensureSession(args.initial as never),\n },\n {\n name: \"create_session\",\n description:\n \"Create a fresh in-memory rstool session and set it as the current active session.\",\n inputSchema: {\n type: \"object\",\n properties: {\n initial: {\n type: \"object\",\n description:\n \"Optional partial SessionState seed (alias, title, comment).\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n invoke: (tool, args) => tool.createSession(args.initial as never),\n },\n {\n name: \"set_current_session\",\n description: \"Set the active session by id.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n required: [\"sessionId\"],\n },\n invoke: (tool, args) => tool.setCurrentSession(String(args.sessionId)),\n },\n {\n name: \"get_current_session\",\n description: \"Return the current active session, or null if none exists.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: (tool) => tool.getCurrentSession(),\n },\n {\n name: \"apply_schema_patch\",\n description:\n \"Preferred schema edit path. Batch patch with inferred ids and cstType, dependency ordering, and compact summary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n initial: {\n type: \"object\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: true,\n },\n items: { type: \"array\", items: agentPatchSchema },\n mode: { type: \"string\", enum: [\"atomic\", \"best_effort\"] },\n commitMessage: { type: \"string\" },\n },\n required: [\"items\"],\n },\n invoke: (tool, args) =>\n tool.applySchemaPatch(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"get_session_state\",\n description:\n \"Return session state. detail=summary (default): compact metadata, aliases, diagnostics. detail=full: complete SessionState clone.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n detail: { type: \"string\", enum: [\"summary\", \"full\"] },\n },\n },\n invoke: (tool, args) =>\n tool.getSessionState(\n (args.detail as \"summary\" | \"full\" | undefined) ?? \"summary\",\n optionalSessionId(args),\n ),\n },\n {\n name: \"analyze_expression\",\n description:\n \"Parse and type-check a scratch expression without saving it. Does not record diagnostics unless recordDiagnostics=true.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n expression: { type: \"string\" },\n cstType: { type: \"string\" },\n recordDiagnostics: { type: \"boolean\" },\n },\n required: [\"expression\", \"cstType\"],\n },\n invoke: (tool, args) =>\n tool.analyzeExpression(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"list_diagnostics\",\n description:\n \"List active diagnostics for the session: expression (formula), schema (homonyms, duplicates, metadata), model (interpretation status).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n constituentId: { type: \"number\" },\n kind: { type: \"string\", enum: [\"expression\", \"schema\", \"model\"] },\n },\n },\n invoke: (tool, args) => {\n const constituentId = args.constituentId;\n const kind = args.kind;\n const filters: {\n constituentId?: number;\n kind?: \"expression\" | \"schema\" | \"model\";\n } = {};\n if (typeof constituentId === \"number\") {\n filters.constituentId = constituentId;\n }\n if (kind === \"expression\" || kind === \"schema\" || kind === \"model\") {\n filters.kind = kind;\n }\n return tool.listDiagnostics(\n Object.keys(filters).length > 0 ? filters : undefined,\n optionalSessionId(args),\n );\n },\n },\n {\n name: \"commit_step\",\n description:\n \"Record a session revision with an optional human-readable message.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n message: { type: \"string\" },\n },\n },\n invoke: (tool, args) =>\n tool.commitStep(\n args.message as string | undefined,\n optionalSessionId(args),\n ),\n },\n {\n name: \"export_session\",\n description:\n \"Serialize the session to a JSON string suitable for import_data with kind=session.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.exportSession(optionalSessionId(args)),\n },\n {\n name: \"export_portal\",\n description:\n \"Export Portal Load-from-JSON payload. kind=schema|model; format=json (default string) or object.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n kind: { type: \"string\", enum: [\"schema\", \"model\"] },\n format: { type: \"string\", enum: [\"json\", \"object\"] },\n },\n required: [\"kind\"],\n },\n invoke: (tool, args) =>\n tool.exportPortal(omitSessionId(args) as never, optionalSessionId(args)),\n },\n {\n name: \"import_data\",\n description:\n \"Import a session from export_session JSON, Portal schema JSON, or GET /api/rsforms/:id/details. kind=auto (default) detects the shape.\",\n inputSchema: {\n type: \"object\",\n properties: {\n payload: {\n description:\n \"JSON string or parsed object (session export, Portal schema, or rsform details).\",\n },\n kind: {\n type: \"string\",\n enum: [\"auto\", \"session\", \"portal-schema\", \"portal-details\"],\n },\n },\n required: [\"payload\"],\n },\n invoke: (tool, args) =>\n tool.importData(args.payload as string | object, args.kind as never),\n },\n {\n name: \"set_model_values\",\n description:\n \"Set and/or clear interpretable model bindings. Pass set[] for bindings and clear[] for constituent ids to reset.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n set: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n target: { type: \"number\" },\n type: { type: \"string\" },\n value: {},\n },\n required: [\"target\", \"value\"],\n },\n },\n clear: { type: \"array\", items: { type: \"number\" } },\n },\n },\n invoke: (tool, args) =>\n tool.setModelValues(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"get_model_state\",\n description: \"Return the SessionModelState.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.getModelState(optionalSessionId(args)),\n },\n {\n name: \"evaluate\",\n description:\n \"Evaluate a scratch expression (expression + cstType) or a stored constituent (constituentId).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n expression: { type: \"string\" },\n cstType: { type: \"string\" },\n constituentId: { type: \"number\" },\n },\n },\n invoke: (tool, args) =>\n tool.evaluate(omitSessionId(args) as never, optionalSessionId(args)),\n },\n {\n name: \"recalculate_model\",\n description: \"Recompute every inferrable constituent.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.recalculateModel(optionalSessionId(args)),\n },\n {\n name: \"restore_order\",\n description:\n \"Restore constituent declaration order: formal topology, semantic clusters when ready, otherwise stable type/kernel ranks.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.restoreOrder(optionalSessionId(args)),\n },\n];\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\nimport { RSToolAgent } from \"@rsconcept/rstool\";\n\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"./tools\";\n\nexport interface BuildRSToolMcpServerOptions {\n /** Pre-built RSToolAgent. Defaults to a fresh in-memory instance. */\n tool?: RSToolAgent;\n /** Persist sessions to this directory (also reads RSTOOL_PERSISTENCE_DIR when set). */\n persistenceDir?: string;\n /** Server name advertised to MCP clients. */\n name?: string;\n /** Server version advertised to MCP clients. */\n version?: string;\n}\n\n/**\n * Build an MCP `McpServer` instance that exposes the `@rsconcept/rstool` contract.\n *\n * The returned server is not yet connected to a transport. Wrap it with a\n * `StdioServerTransport` (for local subprocess hosts like Cursor and Claude Desktop) or\n * an HTTP transport, then call `server.connect(transport)`.\n *\n * @example\n * ```ts\n * import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n * import { buildRSToolMcpServer } from '@rsconcept/rstool-mcp';\n *\n * const server = buildRSToolMcpServer();\n * await server.connect(new StdioServerTransport());\n * ```\n */\nexport function buildRSToolMcpServer(\n options: BuildRSToolMcpServerOptions = {},\n): McpServer {\n const persistenceDir =\n options.persistenceDir ?? process.env.RSTOOL_PERSISTENCE_DIR;\n const tool =\n options.tool ??\n new RSToolAgent(persistenceDir ? { persistenceDir } : undefined);\n const server = new McpServer(\n {\n name: options.name ?? \"rstool-mcp\",\n version: options.version ?? \"0.1.0\",\n },\n {\n capabilities: {\n tools: {},\n },\n },\n );\n\n const definitionByName = new Map<string, ToolDefinition>(\n TOOL_DEFINITIONS.map((definition) => [definition.name, definition]),\n );\n\n server.server.setRequestHandler(ListToolsRequestSchema, () =>\n Promise.resolve({\n tools: TOOL_DEFINITIONS.map((definition) => ({\n name: definition.name,\n description: definition.description,\n inputSchema: definition.inputSchema,\n })),\n }),\n );\n\n server.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const definition = definitionByName.get(request.params.name);\n if (!definition) {\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: `Unknown rstool tool: ${request.params.name}`,\n },\n ],\n };\n }\n\n try {\n const result = await definition.invoke(\n tool,\n request.params.arguments ?? {},\n );\n const text =\n typeof result === \"string\" ? result : JSON.stringify(result, null, 2);\n return {\n content: [\n {\n type: \"text\" as const,\n text,\n },\n ],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: `rstool error in ${definition.name}: ${message}`,\n },\n ],\n };\n }\n });\n\n return server;\n}\n"],"mappings":";;;;AAqBA,MAAM,YAAY;CAChB,MAAM;CACN,aAAa;AACf;AAEA,MAAM,mBAAmB;CACvB,MAAM;CACN,aACE;CACF,YAAY;EACV,IAAI,EAAE,MAAM,SAAS;EACrB,OAAO,EAAE,MAAM,SAAS;EACxB,SAAS,EAAE,MAAM,SAAS;EAC1B,kBAAkB,EAAE,MAAM,SAAS;EACnC,MAAM,EAAE,MAAM,SAAS;EACvB,gBAAgB,EAAE,MAAM,SAAS;EACjC,YAAY,EAAE,MAAM,SAAS;CAC/B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AAiB,EAAE,eAAe,IAAI,KAAA,CAAS;CACjE,MAAM,SAAS,IAAI,UACjB;EACE,MAAM,QAAQ,QAAQ;EACtB,SAAS,QAAQ,WAAW;CAC9B,GACA,EACE,cAAc,EACZ,OAAO,CAAC,EACV,EACF,CACF;CAEA,MAAM,mBAAmB,IAAI,IAC3B,iBAAiB,KAAK,eAAe,CAAC,WAAW,MAAM,UAAU,CAAC,CACpE;CAEA,OAAO,OAAO,kBAAkB,8BAC9B,QAAQ,QAAQ,EACd,OAAO,iBAAiB,KAAK,gBAAgB;EAC3C,MAAM,WAAW;EACjB,aAAa,WAAW;EACxB,aAAa,WAAW;CAC1B,EAAE,EACJ,CAAC,CACH;CAEA,OAAO,OAAO,kBAAkB,uBAAuB,OAAO,YAAY;EACxE,MAAM,aAAa,iBAAiB,IAAI,QAAQ,OAAO,IAAI;EAC3D,IAAI,CAAC,YACH,OAAO;GACL,SAAS;GACT,SAAS,CACP;IACE,MAAM;IACN,MAAM,wBAAwB,QAAQ,OAAO;GAC/C,CACF;EACF;EAGF,IAAI;GACF,MAAM,SAAS,MAAM,WAAW,OAC9B,MACA,QAAQ,OAAO,aAAa,CAAC,CAC/B;GAGA,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MALJ,OAAO,WAAW,WAAW,SAAS,KAAK,UAAU,QAAQ,MAAM,CAAC;GAMlE,CACF,EACF;EACF,SAAS,OAAO;GACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrE,OAAO;IACL,SAAS;IACT,SAAS,CACP;KACE,MAAM;KACN,MAAM,mBAAmB,WAAW,KAAK,IAAI;IAC/C,CACF;GACF;EACF;CACF,CAAC;CAED,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsconcept/rstool-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) adapter that exposes the @rsconcept/rstool RSToolAgent contract over MCP stdio. Works with Cursor, Claude Desktop, and any MCP-capable host.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "IRBorisov",
|
|
@@ -40,9 +40,16 @@
|
|
|
40
40
|
"README.md",
|
|
41
41
|
"LICENSE"
|
|
42
42
|
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"start": "tsx src/bin/server.ts",
|
|
48
|
+
"prepublishOnly": "pnpm run build"
|
|
49
|
+
},
|
|
43
50
|
"dependencies": {
|
|
44
51
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
45
|
-
"@rsconcept/rstool": "
|
|
52
|
+
"@rsconcept/rstool": "workspace:*"
|
|
46
53
|
},
|
|
47
54
|
"devDependencies": {
|
|
48
55
|
"@types/node": "^25.9.4",
|
|
@@ -54,11 +61,5 @@
|
|
|
54
61
|
},
|
|
55
62
|
"publishConfig": {
|
|
56
63
|
"access": "public"
|
|
57
|
-
},
|
|
58
|
-
"scripts": {
|
|
59
|
-
"build": "tsdown",
|
|
60
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
61
|
-
"test": "vitest run",
|
|
62
|
-
"start": "tsx src/bin/server.ts"
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
}
|
package/src/server.test.ts
CHANGED
package/src/tools.ts
CHANGED
|
@@ -205,19 +205,32 @@ export const TOOL_DEFINITIONS: ToolDefinition[] = [
|
|
|
205
205
|
{
|
|
206
206
|
name: "list_diagnostics",
|
|
207
207
|
description:
|
|
208
|
-
"List active diagnostics for the session (
|
|
208
|
+
"List active diagnostics for the session: expression (formula), schema (homonyms, duplicates, metadata), model (interpretation status).",
|
|
209
209
|
inputSchema: {
|
|
210
210
|
type: "object",
|
|
211
211
|
properties: {
|
|
212
212
|
sessionId,
|
|
213
213
|
constituentId: { type: "number" },
|
|
214
|
+
kind: { type: "string", enum: ["expression", "schema", "model"] },
|
|
214
215
|
},
|
|
215
216
|
},
|
|
216
217
|
invoke: (tool, args) => {
|
|
217
218
|
const constituentId = args.constituentId;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
const kind = args.kind;
|
|
220
|
+
const filters: {
|
|
221
|
+
constituentId?: number;
|
|
222
|
+
kind?: "expression" | "schema" | "model";
|
|
223
|
+
} = {};
|
|
224
|
+
if (typeof constituentId === "number") {
|
|
225
|
+
filters.constituentId = constituentId;
|
|
226
|
+
}
|
|
227
|
+
if (kind === "expression" || kind === "schema" || kind === "model") {
|
|
228
|
+
filters.kind = kind;
|
|
229
|
+
}
|
|
230
|
+
return tool.listDiagnostics(
|
|
231
|
+
Object.keys(filters).length > 0 ? filters : undefined,
|
|
232
|
+
optionalSessionId(args),
|
|
233
|
+
);
|
|
221
234
|
},
|
|
222
235
|
},
|
|
223
236
|
{
|
|
@@ -347,4 +360,14 @@ export const TOOL_DEFINITIONS: ToolDefinition[] = [
|
|
|
347
360
|
},
|
|
348
361
|
invoke: (tool, args) => tool.recalculateModel(optionalSessionId(args)),
|
|
349
362
|
},
|
|
363
|
+
{
|
|
364
|
+
name: "restore_order",
|
|
365
|
+
description:
|
|
366
|
+
"Restore constituent declaration order: formal topology, semantic clusters when ready, otherwise stable type/kernel ranks.",
|
|
367
|
+
inputSchema: {
|
|
368
|
+
type: "object",
|
|
369
|
+
properties: { sessionId },
|
|
370
|
+
},
|
|
371
|
+
invoke: (tool, args) => tool.restoreOrder(optionalSessionId(args)),
|
|
372
|
+
},
|
|
350
373
|
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-CM8yRC3G.js","names":[],"sources":["../src/tools.ts","../src/server.ts"],"sourcesContent":["/**\n * MCP tool definitions for the @rsconcept/rstool contract.\n */\n\nimport { type RSToolAgent } from \"@rsconcept/rstool\";\n\nexport interface ToolDefinition {\n name: string;\n description: string;\n inputSchema: {\n type: \"object\";\n properties: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n };\n invoke: (\n tool: RSToolAgent,\n args: Record<string, unknown>,\n ) => unknown | Promise<unknown>;\n}\n\nconst sessionId = {\n type: \"string\",\n description: \"Session id. Omit to use the current active session.\",\n};\n\nconst agentPatchSchema = {\n type: \"object\",\n description:\n \"Agent-friendly constituent patch. id and cstType are optional; cstType is inferred from alias prefixes X/C/S/D/A/F/P.\",\n properties: {\n id: { type: \"number\" },\n alias: { type: \"string\" },\n cstType: { type: \"string\" },\n definitionFormal: { type: \"string\" },\n term: { type: \"string\" },\n definitionText: { type: \"string\" },\n convention: { type: \"string\" },\n },\n required: [\"alias\"],\n};\n\nfunction optionalSessionId(args: Record<string, unknown>): string | undefined {\n const value = args.sessionId;\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\nfunction omitSessionId(args: Record<string, unknown>): Record<string, unknown> {\n const { sessionId: _sessionId, ...rest } = args;\n return rest;\n}\n\nexport const TOOL_DEFINITIONS: ToolDefinition[] = [\n {\n name: \"ping\",\n description:\n \"Liveness check; returns {pong: true} and the active rstool contract version.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: (tool) => ({ pong: true, contractVersion: tool.contractVersion }),\n },\n {\n name: \"list_methods\",\n description: \"List all rstool methods exposed as MCP tools.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: () => TOOL_DEFINITIONS.map((definition) => definition.name),\n },\n {\n name: \"ensure_session\",\n description:\n \"Return the current active session, or create one if none exists. Optional initial seed is used only when creating.\",\n inputSchema: {\n type: \"object\",\n properties: {\n initial: {\n type: \"object\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: true,\n },\n },\n additionalProperties: false,\n },\n invoke: (tool, args) => tool.ensureSession(args.initial as never),\n },\n {\n name: \"create_session\",\n description:\n \"Create a fresh in-memory rstool session and set it as the current active session.\",\n inputSchema: {\n type: \"object\",\n properties: {\n initial: {\n type: \"object\",\n description:\n \"Optional partial SessionState seed (alias, title, comment).\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n invoke: (tool, args) => tool.createSession(args.initial as never),\n },\n {\n name: \"set_current_session\",\n description: \"Set the active session by id.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n required: [\"sessionId\"],\n },\n invoke: (tool, args) => tool.setCurrentSession(String(args.sessionId)),\n },\n {\n name: \"get_current_session\",\n description: \"Return the current active session, or null if none exists.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n invoke: (tool) => tool.getCurrentSession(),\n },\n {\n name: \"apply_schema_patch\",\n description:\n \"Preferred schema edit path. Batch patch with inferred ids and cstType, dependency ordering, and compact summary.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n initial: {\n type: \"object\",\n properties: {\n alias: { type: \"string\" },\n title: { type: \"string\" },\n comment: { type: \"string\" },\n },\n additionalProperties: true,\n },\n items: { type: \"array\", items: agentPatchSchema },\n mode: { type: \"string\", enum: [\"atomic\", \"best_effort\"] },\n commitMessage: { type: \"string\" },\n },\n required: [\"items\"],\n },\n invoke: (tool, args) =>\n tool.applySchemaPatch(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"get_session_state\",\n description:\n \"Return session state. detail=summary (default): compact metadata, aliases, diagnostics. detail=full: complete SessionState clone.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n detail: { type: \"string\", enum: [\"summary\", \"full\"] },\n },\n },\n invoke: (tool, args) =>\n tool.getSessionState(\n (args.detail as \"summary\" | \"full\" | undefined) ?? \"summary\",\n optionalSessionId(args),\n ),\n },\n {\n name: \"analyze_expression\",\n description:\n \"Parse and type-check a scratch expression without saving it. Does not record diagnostics unless recordDiagnostics=true.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n expression: { type: \"string\" },\n cstType: { type: \"string\" },\n recordDiagnostics: { type: \"boolean\" },\n },\n required: [\"expression\", \"cstType\"],\n },\n invoke: (tool, args) =>\n tool.analyzeExpression(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"list_diagnostics\",\n description:\n \"List active diagnostics for the session (one record set per constituent, not a historical log).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n constituentId: { type: \"number\" },\n },\n },\n invoke: (tool, args) => {\n const constituentId = args.constituentId;\n const filters =\n typeof constituentId === \"number\" ? { constituentId } : undefined;\n return tool.listDiagnostics(filters, optionalSessionId(args));\n },\n },\n {\n name: \"commit_step\",\n description:\n \"Record a session revision with an optional human-readable message.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n message: { type: \"string\" },\n },\n },\n invoke: (tool, args) =>\n tool.commitStep(\n args.message as string | undefined,\n optionalSessionId(args),\n ),\n },\n {\n name: \"export_session\",\n description:\n \"Serialize the session to a JSON string suitable for import_data with kind=session.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.exportSession(optionalSessionId(args)),\n },\n {\n name: \"export_portal\",\n description:\n \"Export Portal Load-from-JSON payload. kind=schema|model; format=json (default string) or object.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n kind: { type: \"string\", enum: [\"schema\", \"model\"] },\n format: { type: \"string\", enum: [\"json\", \"object\"] },\n },\n required: [\"kind\"],\n },\n invoke: (tool, args) =>\n tool.exportPortal(omitSessionId(args) as never, optionalSessionId(args)),\n },\n {\n name: \"import_data\",\n description:\n \"Import a session from export_session JSON, Portal schema JSON, or GET /api/rsforms/:id/details. kind=auto (default) detects the shape.\",\n inputSchema: {\n type: \"object\",\n properties: {\n payload: {\n description:\n \"JSON string or parsed object (session export, Portal schema, or rsform details).\",\n },\n kind: {\n type: \"string\",\n enum: [\"auto\", \"session\", \"portal-schema\", \"portal-details\"],\n },\n },\n required: [\"payload\"],\n },\n invoke: (tool, args) =>\n tool.importData(args.payload as string | object, args.kind as never),\n },\n {\n name: \"set_model_values\",\n description:\n \"Set and/or clear interpretable model bindings. Pass set[] for bindings and clear[] for constituent ids to reset.\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n set: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n target: { type: \"number\" },\n type: { type: \"string\" },\n value: {},\n },\n required: [\"target\", \"value\"],\n },\n },\n clear: { type: \"array\", items: { type: \"number\" } },\n },\n },\n invoke: (tool, args) =>\n tool.setModelValues(\n omitSessionId(args) as never,\n optionalSessionId(args),\n ),\n },\n {\n name: \"get_model_state\",\n description: \"Return the SessionModelState.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.getModelState(optionalSessionId(args)),\n },\n {\n name: \"evaluate\",\n description:\n \"Evaluate a scratch expression (expression + cstType) or a stored constituent (constituentId).\",\n inputSchema: {\n type: \"object\",\n properties: {\n sessionId,\n expression: { type: \"string\" },\n cstType: { type: \"string\" },\n constituentId: { type: \"number\" },\n },\n },\n invoke: (tool, args) =>\n tool.evaluate(omitSessionId(args) as never, optionalSessionId(args)),\n },\n {\n name: \"recalculate_model\",\n description: \"Recompute every inferrable constituent.\",\n inputSchema: {\n type: \"object\",\n properties: { sessionId },\n },\n invoke: (tool, args) => tool.recalculateModel(optionalSessionId(args)),\n },\n];\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\nimport { RSToolAgent } from \"@rsconcept/rstool\";\n\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"./tools\";\n\nexport interface BuildRSToolMcpServerOptions {\n /** Pre-built RSToolAgent. Defaults to a fresh in-memory instance. */\n tool?: RSToolAgent;\n /** Persist sessions to this directory (also reads RSTOOL_PERSISTENCE_DIR when set). */\n persistenceDir?: string;\n /** Server name advertised to MCP clients. */\n name?: string;\n /** Server version advertised to MCP clients. */\n version?: string;\n}\n\n/**\n * Build an MCP `McpServer` instance that exposes the `@rsconcept/rstool` contract.\n *\n * The returned server is not yet connected to a transport. Wrap it with a\n * `StdioServerTransport` (for local subprocess hosts like Cursor and Claude Desktop) or\n * an HTTP transport, then call `server.connect(transport)`.\n *\n * @example\n * ```ts\n * import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n * import { buildRSToolMcpServer } from '@rsconcept/rstool-mcp';\n *\n * const server = buildRSToolMcpServer();\n * await server.connect(new StdioServerTransport());\n * ```\n */\nexport function buildRSToolMcpServer(\n options: BuildRSToolMcpServerOptions = {},\n): McpServer {\n const persistenceDir =\n options.persistenceDir ?? process.env.RSTOOL_PERSISTENCE_DIR;\n const tool =\n options.tool ??\n new RSToolAgent(persistenceDir ? { persistenceDir } : undefined);\n const server = new McpServer(\n {\n name: options.name ?? \"rstool-mcp\",\n version: options.version ?? \"0.1.0\",\n },\n {\n capabilities: {\n tools: {},\n },\n },\n );\n\n const definitionByName = new Map<string, ToolDefinition>(\n TOOL_DEFINITIONS.map((definition) => [definition.name, definition]),\n );\n\n server.server.setRequestHandler(ListToolsRequestSchema, () =>\n Promise.resolve({\n tools: TOOL_DEFINITIONS.map((definition) => ({\n name: definition.name,\n description: definition.description,\n inputSchema: definition.inputSchema,\n })),\n }),\n );\n\n server.server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const definition = definitionByName.get(request.params.name);\n if (!definition) {\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: `Unknown rstool tool: ${request.params.name}`,\n },\n ],\n };\n }\n\n try {\n const result = await definition.invoke(\n tool,\n request.params.arguments ?? {},\n );\n const text =\n typeof result === \"string\" ? result : JSON.stringify(result, null, 2);\n return {\n content: [\n {\n type: \"text\" as const,\n text,\n },\n ],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: `rstool error in ${definition.name}: ${message}`,\n },\n ],\n };\n }\n });\n\n return server;\n}\n"],"mappings":";;;;AAqBA,MAAM,YAAY;CAChB,MAAM;CACN,aAAa;AACf;AAEA,MAAM,mBAAmB;CACvB,MAAM;CACN,aACE;CACF,YAAY;EACV,IAAI,EAAE,MAAM,SAAS;EACrB,OAAO,EAAE,MAAM,SAAS;EACxB,SAAS,EAAE,MAAM,SAAS;EAC1B,kBAAkB,EAAE,MAAM,SAAS;EACnC,MAAM,EAAE,MAAM,SAAS;EACvB,gBAAgB,EAAE,MAAM,SAAS;EACjC,YAAY,EAAE,MAAM,SAAS;CAC/B;CACA,UAAU,CAAC,OAAO;AACpB;AAEA,SAAS,kBAAkB,MAAmD;CAC5E,MAAM,QAAQ,KAAK;CACnB,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ,KAAA;AACjE;AAEA,SAAS,cAAc,MAAwD;CAC7E,MAAM,EAAE,WAAW,YAAY,GAAG,SAAS;CAC3C,OAAO;AACT;AAEA,MAAa,mBAAqC;CAChD;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,CAAC;GACb,sBAAsB;EACxB;EACA,SAAS,UAAU;GAAE,MAAM;GAAM,iBAAiB,KAAK;EAAgB;CACzE;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;GACX,MAAM;GACN,YAAY,CAAC;GACb,sBAAsB;EACxB;EACA,cAAc,iBAAiB,KAAK,eAAe,WAAW,IAAI;CACpE;CACA;EACE,MAAM;EACN,aACE;EACF,aAAa;GACX,MAAM;GACN,YAAY,EACV,SAAS;IACP,MAAM;IACN,YAAY;KACV,OAAO,EAAE,MAAM,SAAS;KACxB,OAAO,EAAE,MAAM,SAAS;KACxB,SAAS,EAAE,MAAM,SAAS;IAC5B;IACA,sBAAsB;GACxB,EACF;GACA,sBAAsB;EACxB;EACA,SAAS,MAAM,SAAS,KAAK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