@contractspec/lib.contracts-runtime-server-mcp 3.4.3 → 3.5.2
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.js +8 -4
- package/dist/mcp/createMcpServer.js +8 -4
- package/dist/mcp/registerTools.js +6 -2
- package/dist/node/index.js +8 -4
- package/dist/node/mcp/createMcpServer.js +8 -4
- package/dist/node/mcp/registerTools.js +6 -2
- package/dist/node/provider-mcp.js +8 -4
- package/dist/provider-mcp.js +8 -4
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/mcp/registerTools.ts
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
defaultMcpTool,
|
|
5
|
+
sanitizeMcpName
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
4
7
|
function registerMcpTools(server, ops, ctx) {
|
|
5
8
|
for (const spec of ops.list()) {
|
|
6
9
|
if (spec.meta.kind !== "command")
|
|
7
10
|
continue;
|
|
8
|
-
const
|
|
11
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
12
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
9
13
|
server.registerTool(toolName, {
|
|
10
14
|
description: spec.meta.description,
|
|
11
15
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -110,7 +114,7 @@ import {
|
|
|
110
114
|
registerBasicValidation,
|
|
111
115
|
registerDefaultReactRenderer
|
|
112
116
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
113
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
117
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
114
118
|
function isEngineRenderOutput(x) {
|
|
115
119
|
if (!x || typeof x !== "object")
|
|
116
120
|
return false;
|
|
@@ -122,7 +126,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
122
126
|
}
|
|
123
127
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
124
128
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
125
|
-
const baseKey =
|
|
129
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
126
130
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
127
131
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
128
132
|
server.registerResource(baseKey, baseUri, {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/mcp/registerTools.ts
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
defaultMcpTool,
|
|
5
|
+
sanitizeMcpName
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
4
7
|
function registerMcpTools(server, ops, ctx) {
|
|
5
8
|
for (const spec of ops.list()) {
|
|
6
9
|
if (spec.meta.kind !== "command")
|
|
7
10
|
continue;
|
|
8
|
-
const
|
|
11
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
12
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
9
13
|
server.registerTool(toolName, {
|
|
10
14
|
description: spec.meta.description,
|
|
11
15
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -110,7 +114,7 @@ import {
|
|
|
110
114
|
registerBasicValidation,
|
|
111
115
|
registerDefaultReactRenderer
|
|
112
116
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
113
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
117
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
114
118
|
function isEngineRenderOutput(x) {
|
|
115
119
|
if (!x || typeof x !== "object")
|
|
116
120
|
return false;
|
|
@@ -122,7 +126,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
122
126
|
}
|
|
123
127
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
124
128
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
125
|
-
const baseKey =
|
|
129
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
126
130
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
127
131
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
128
132
|
server.registerResource(baseKey, baseUri, {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/mcp/registerTools.ts
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
defaultMcpTool,
|
|
5
|
+
sanitizeMcpName
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
4
7
|
function registerMcpTools(server, ops, ctx) {
|
|
5
8
|
for (const spec of ops.list()) {
|
|
6
9
|
if (spec.meta.kind !== "command")
|
|
7
10
|
continue;
|
|
8
|
-
const
|
|
11
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
12
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
9
13
|
server.registerTool(toolName, {
|
|
10
14
|
description: spec.meta.description,
|
|
11
15
|
inputSchema: spec.io.input?.getZod()
|
package/dist/node/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// src/mcp/registerTools.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
defaultMcpTool,
|
|
4
|
+
sanitizeMcpName
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
3
6
|
function registerMcpTools(server, ops, ctx) {
|
|
4
7
|
for (const spec of ops.list()) {
|
|
5
8
|
if (spec.meta.kind !== "command")
|
|
6
9
|
continue;
|
|
7
|
-
const
|
|
10
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
11
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
8
12
|
server.registerTool(toolName, {
|
|
9
13
|
description: spec.meta.description,
|
|
10
14
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -109,7 +113,7 @@ import {
|
|
|
109
113
|
registerBasicValidation,
|
|
110
114
|
registerDefaultReactRenderer
|
|
111
115
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
112
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
116
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
113
117
|
function isEngineRenderOutput(x) {
|
|
114
118
|
if (!x || typeof x !== "object")
|
|
115
119
|
return false;
|
|
@@ -121,7 +125,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
121
125
|
}
|
|
122
126
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
123
127
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
124
|
-
const baseKey =
|
|
128
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
125
129
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
126
130
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
127
131
|
server.registerResource(baseKey, baseUri, {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// src/mcp/registerTools.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
defaultMcpTool,
|
|
4
|
+
sanitizeMcpName
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
3
6
|
function registerMcpTools(server, ops, ctx) {
|
|
4
7
|
for (const spec of ops.list()) {
|
|
5
8
|
if (spec.meta.kind !== "command")
|
|
6
9
|
continue;
|
|
7
|
-
const
|
|
10
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
11
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
8
12
|
server.registerTool(toolName, {
|
|
9
13
|
description: spec.meta.description,
|
|
10
14
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -109,7 +113,7 @@ import {
|
|
|
109
113
|
registerBasicValidation,
|
|
110
114
|
registerDefaultReactRenderer
|
|
111
115
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
112
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
116
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
113
117
|
function isEngineRenderOutput(x) {
|
|
114
118
|
if (!x || typeof x !== "object")
|
|
115
119
|
return false;
|
|
@@ -121,7 +125,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
121
125
|
}
|
|
122
126
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
123
127
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
124
|
-
const baseKey =
|
|
128
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
125
129
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
126
130
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
127
131
|
server.registerResource(baseKey, baseUri, {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// src/mcp/registerTools.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
defaultMcpTool,
|
|
4
|
+
sanitizeMcpName
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
3
6
|
function registerMcpTools(server, ops, ctx) {
|
|
4
7
|
for (const spec of ops.list()) {
|
|
5
8
|
if (spec.meta.kind !== "command")
|
|
6
9
|
continue;
|
|
7
|
-
const
|
|
10
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
11
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
8
12
|
server.registerTool(toolName, {
|
|
9
13
|
description: spec.meta.description,
|
|
10
14
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// src/mcp/registerTools.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
defaultMcpTool,
|
|
4
|
+
sanitizeMcpName
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
3
6
|
function registerMcpTools(server, ops, ctx) {
|
|
4
7
|
for (const spec of ops.list()) {
|
|
5
8
|
if (spec.meta.kind !== "command")
|
|
6
9
|
continue;
|
|
7
|
-
const
|
|
10
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
11
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
8
12
|
server.registerTool(toolName, {
|
|
9
13
|
description: spec.meta.description,
|
|
10
14
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -109,7 +113,7 @@ import {
|
|
|
109
113
|
registerBasicValidation,
|
|
110
114
|
registerDefaultReactRenderer
|
|
111
115
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
112
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
116
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
113
117
|
function isEngineRenderOutput(x) {
|
|
114
118
|
if (!x || typeof x !== "object")
|
|
115
119
|
return false;
|
|
@@ -121,7 +125,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
121
125
|
}
|
|
122
126
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
123
127
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
124
|
-
const baseKey =
|
|
128
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
125
129
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
126
130
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
127
131
|
server.registerResource(baseKey, baseUri, {
|
package/dist/provider-mcp.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/mcp/registerTools.ts
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
defaultMcpTool,
|
|
5
|
+
sanitizeMcpName
|
|
6
|
+
} from "@contractspec/lib.contracts-spec/jsonschema";
|
|
4
7
|
function registerMcpTools(server, ops, ctx) {
|
|
5
8
|
for (const spec of ops.list()) {
|
|
6
9
|
if (spec.meta.kind !== "command")
|
|
7
10
|
continue;
|
|
8
|
-
const
|
|
11
|
+
const rawToolName = spec.transport?.mcp?.toolName;
|
|
12
|
+
const toolName = rawToolName ? sanitizeMcpName(rawToolName) : defaultMcpTool(spec.meta.key, spec.meta.version);
|
|
9
13
|
server.registerTool(toolName, {
|
|
10
14
|
description: spec.meta.description,
|
|
11
15
|
inputSchema: spec.io.input?.getZod()
|
|
@@ -110,7 +114,7 @@ import {
|
|
|
110
114
|
registerBasicValidation,
|
|
111
115
|
registerDefaultReactRenderer
|
|
112
116
|
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
113
|
-
import { sanitizeMcpName } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
117
|
+
import { sanitizeMcpName as sanitizeMcpName2 } from "@contractspec/lib.contracts-spec/jsonschema";
|
|
114
118
|
function isEngineRenderOutput(x) {
|
|
115
119
|
if (!x || typeof x !== "object")
|
|
116
120
|
return false;
|
|
@@ -122,7 +126,7 @@ function registerMcpPresentations(server, ctx) {
|
|
|
122
126
|
}
|
|
123
127
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
124
128
|
for (const presentationSpec of ctx.presentations.list()) {
|
|
125
|
-
const baseKey =
|
|
129
|
+
const baseKey = sanitizeMcpName2(`presentation_${presentationSpec.meta.key}_v${presentationSpec.meta.version}`);
|
|
126
130
|
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
127
131
|
ctx.logger.debug(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
128
132
|
server.registerResource(baseKey, baseUri, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.contracts-runtime-server-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "MCP server runtime adapters for ContractSpec contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"dev": "contractspec-bun-build dev"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@contractspec/lib.contracts-spec": "3.
|
|
23
|
-
"@contractspec/lib.logger": "3.
|
|
22
|
+
"@contractspec/lib.contracts-spec": "3.5.2",
|
|
23
|
+
"@contractspec/lib.logger": "3.5.2",
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
25
25
|
"zod": "^4.3.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@contractspec/tool.typescript": "3.
|
|
28
|
+
"@contractspec/tool.typescript": "3.5.2",
|
|
29
29
|
"typescript": "^5.9.3",
|
|
30
|
-
"@contractspec/tool.bun": "3.
|
|
30
|
+
"@contractspec/tool.bun": "3.5.2"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist",
|