@convertcom/mcp-server 0.0.1-beta.15 → 0.0.1-beta.16
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/build/api-config.js +21 -3
- package/build/api-config.js.map +1 -1
- package/build/auth-context.d.ts +3 -0
- package/build/auth-context.js.map +1 -1
- package/build/catalog-change.d.ts +6 -2
- package/build/catalog-change.js +5 -1
- package/build/catalog-change.js.map +1 -1
- package/build/executor.d.ts +6 -0
- package/build/executor.js +73 -22
- package/build/executor.js.map +1 -1
- package/build/generated-tool-validators.js +141 -158
- package/build/generated-tool-validators.js.map +1 -1
- package/build/index.js +19 -12
- package/build/index.js.map +1 -1
- package/build/kb-hybrid.d.ts +13 -5
- package/build/kb-hybrid.js +16 -10
- package/build/kb-hybrid.js.map +1 -1
- package/build/kb-search.d.ts +9 -3
- package/build/kb-search.js +95 -4
- package/build/kb-search.js.map +1 -1
- package/build/kb-semantic.d.ts +2 -2
- package/build/kb-semantic.js +11 -2
- package/build/kb-semantic.js.map +1 -1
- package/build/local-docs.d.ts +12 -0
- package/build/local-docs.js +9 -0
- package/build/local-docs.js.map +1 -0
- package/build/local-execution-context.d.ts +7 -0
- package/build/local-execution-context.js +18 -0
- package/build/local-execution-context.js.map +1 -0
- package/build/mcp-server-compat.d.ts +8 -0
- package/build/mcp-server-compat.js +28 -0
- package/build/mcp-server-compat.js.map +1 -0
- package/build/modern-runtime.d.ts +13 -0
- package/build/modern-runtime.js +148 -0
- package/build/modern-runtime.js.map +1 -0
- package/build/namespaced.js +2 -2
- package/build/namespaced.js.map +1 -1
- package/build/runtime.d.ts +221 -5
- package/build/runtime.js +169 -67
- package/build/runtime.js.map +1 -1
- package/package.json +6 -6
- package/server.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const FALSY_REQUEST_ID_COMPAT = Symbol('convert.falsy-request-id-cancellation');
|
|
2
|
+
/**
|
|
3
|
+
* @modelcontextprotocol/server 2.0.0 ignores cancellation for the valid
|
|
4
|
+
* falsy JSON-RPC IDs 0 and "".
|
|
5
|
+
* Keep the workaround on each Convert-owned server instance so the published
|
|
6
|
+
* npm package and Worker bundle have identical behavior without package-manager
|
|
7
|
+
* patch protocols. Remove this shim once the pinned SDK contains the fix.
|
|
8
|
+
*/
|
|
9
|
+
export function applyFalsyRequestIdCancellationCompat(server) {
|
|
10
|
+
const protocol = server;
|
|
11
|
+
if (protocol[FALSY_REQUEST_ID_COMPAT])
|
|
12
|
+
return;
|
|
13
|
+
if (typeof protocol._oncancel !== 'function'
|
|
14
|
+
|| !(protocol._requestHandlerAbortControllers instanceof Map)) {
|
|
15
|
+
throw new Error('MCP server cancellation compatibility seam is unavailable.');
|
|
16
|
+
}
|
|
17
|
+
const original = protocol._oncancel.bind(protocol);
|
|
18
|
+
protocol._oncancel = async (notification) => {
|
|
19
|
+
const requestId = notification.params.requestId;
|
|
20
|
+
if (requestId !== 0 && requestId !== '') {
|
|
21
|
+
await original(notification);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
protocol._requestHandlerAbortControllers.get(requestId)?.abort(notification.params.reason);
|
|
25
|
+
};
|
|
26
|
+
protocol[FALSY_REQUEST_ID_COMPAT] = true;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mcp-server-compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server-compat.js","sourceRoot":"","sources":["../src/mcp-server-compat.ts"],"names":[],"mappings":"AAaA,MAAM,uBAAuB,GAAG,MAAM,CAAC,uCAAuC,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CAAC,MAAc;IAClE,MAAM,QAAQ,GAAG,MAAiD,CAAC;IACnE,IAAI,QAAQ,CAAC,uBAAuB,CAAC;QAAE,OAAO;IAC9C,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,UAAU;WACvC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,YAAY,GAAG,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,GAAG,KAAK,EAAE,YAAY,EAAE,EAAE;QAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC;QAChD,IAAI,SAAS,KAAK,CAAC,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;YACxC,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC7B,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,+BAA+B,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7F,CAAC,CAAC;IACF,QAAQ,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/server';
|
|
2
|
+
import { type ConvertMcpServerIdentityOptions, type ConvertMcpRuntimeOptions } from './runtime.js';
|
|
3
|
+
/**
|
|
4
|
+
* Builds the v2 protocol server while keeping catalog and dispatch behavior in
|
|
5
|
+
* the shared runtime. The HTTP entry must create one of these per request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createModernConvertMcpServer(options: ConvertMcpRuntimeOptions): Server;
|
|
8
|
+
/**
|
|
9
|
+
* A listen request needs only identity and capabilities. Keeping this factory
|
|
10
|
+
* separate prevents a long-lived SSE handler from retaining Convert OAuth
|
|
11
|
+
* props, catalogs, docs providers, validators, or execution closures.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createModernConvertMcpListenServer(options: ConvertMcpServerIdentityOptions, advertiseListChanged: boolean): Server;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { CLIENT_INFO_META_KEY, ProtocolError, Server, } from '@modelcontextprotocol/server';
|
|
2
|
+
import { McpError as LegacyMcpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { convertMcpServerDefinition, createConvertMcpHandlers, } from './runtime.js';
|
|
4
|
+
import { applyFalsyRequestIdCancellationCompat } from './mcp-server-compat.js';
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
function sharedClientInfoFrom(value) {
|
|
9
|
+
if (!isRecord(value) || typeof value.name !== 'string' || typeof value.version !== 'string')
|
|
10
|
+
return undefined;
|
|
11
|
+
const clientInfo = { name: value.name, version: value.version };
|
|
12
|
+
for (const key of ['title', 'description', 'websiteUrl']) {
|
|
13
|
+
if (typeof value[key] === 'string')
|
|
14
|
+
clientInfo[key] = value[key];
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value.icons)) {
|
|
17
|
+
const icons = value.icons
|
|
18
|
+
.filter(isRecord)
|
|
19
|
+
.map((icon) => {
|
|
20
|
+
if (typeof icon.src !== 'string')
|
|
21
|
+
return undefined;
|
|
22
|
+
const sanitized = { src: icon.src };
|
|
23
|
+
if (typeof icon.mimeType === 'string')
|
|
24
|
+
sanitized.mimeType = icon.mimeType;
|
|
25
|
+
if (Array.isArray(icon.sizes) && icon.sizes.every((size) => typeof size === 'string')) {
|
|
26
|
+
sanitized.sizes = icon.sizes;
|
|
27
|
+
}
|
|
28
|
+
if (icon.theme === 'light' || icon.theme === 'dark')
|
|
29
|
+
sanitized.theme = icon.theme;
|
|
30
|
+
return sanitized;
|
|
31
|
+
})
|
|
32
|
+
.filter((icon) => icon !== undefined);
|
|
33
|
+
if (icons.length > 0)
|
|
34
|
+
clientInfo.icons = icons;
|
|
35
|
+
}
|
|
36
|
+
return clientInfo;
|
|
37
|
+
}
|
|
38
|
+
function clientInfoFromEnvelope(envelope) {
|
|
39
|
+
if (!envelope)
|
|
40
|
+
return undefined;
|
|
41
|
+
const value = envelope[CLIENT_INFO_META_KEY];
|
|
42
|
+
return sharedClientInfoFrom(value);
|
|
43
|
+
}
|
|
44
|
+
function translateLegacyProtocolError(error) {
|
|
45
|
+
if (error instanceof LegacyMcpError) {
|
|
46
|
+
throw new ProtocolError(error.code, error.message, error.data);
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
async function withModernProtocolErrors(operation) {
|
|
51
|
+
try {
|
|
52
|
+
return await operation();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return translateLegacyProtocolError(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Builds the v2 protocol server while keeping catalog and dispatch behavior in
|
|
60
|
+
* the shared runtime. The HTTP entry must create one of these per request.
|
|
61
|
+
*/
|
|
62
|
+
export function createModernConvertMcpServer(options) {
|
|
63
|
+
const definition = convertMcpServerDefinition(options);
|
|
64
|
+
const capabilities = options.advertiseListChanged === false
|
|
65
|
+
? {
|
|
66
|
+
tools: { listChanged: false },
|
|
67
|
+
prompts: { listChanged: false },
|
|
68
|
+
resources: { listChanged: false },
|
|
69
|
+
}
|
|
70
|
+
: definition.options.capabilities;
|
|
71
|
+
const server = new Server(definition.implementation, {
|
|
72
|
+
...definition.options,
|
|
73
|
+
capabilities,
|
|
74
|
+
});
|
|
75
|
+
applyFalsyRequestIdCancellationCompat(server);
|
|
76
|
+
const handlers = createConvertMcpHandlers(options, (extra) => extra.clientInfo ?? sharedClientInfoFrom(server.getClientVersion()));
|
|
77
|
+
const runtimeExtra = (ctx) => {
|
|
78
|
+
const extra = {
|
|
79
|
+
signal: ctx.mcpReq.signal,
|
|
80
|
+
requestId: ctx.mcpReq.id,
|
|
81
|
+
sendNotification: (notification) => ctx.mcpReq.notify(notification),
|
|
82
|
+
clientInfo: clientInfoFromEnvelope(ctx.mcpReq.envelope),
|
|
83
|
+
};
|
|
84
|
+
return extra;
|
|
85
|
+
};
|
|
86
|
+
server.setRequestHandler('tools/list', async (_request, ctx) => {
|
|
87
|
+
return await withModernProtocolErrors(async () => {
|
|
88
|
+
return await handlers.listTools(runtimeExtra(ctx));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
server.setRequestHandler('resources/list', async (_request, ctx) => {
|
|
92
|
+
return await withModernProtocolErrors(async () => {
|
|
93
|
+
return await handlers.listResources(runtimeExtra(ctx));
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
server.setRequestHandler('resources/templates/list', async (_request, ctx) => {
|
|
97
|
+
return await withModernProtocolErrors(async () => {
|
|
98
|
+
return await handlers.listResourceTemplates(runtimeExtra(ctx));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
server.setRequestHandler('resources/read', async (request, ctx) => {
|
|
102
|
+
return await withModernProtocolErrors(async () => {
|
|
103
|
+
return await handlers.readResource(request, runtimeExtra(ctx));
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
server.setRequestHandler('prompts/list', async (_request, ctx) => {
|
|
107
|
+
return await withModernProtocolErrors(async () => {
|
|
108
|
+
return await handlers.listPrompts(runtimeExtra(ctx));
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
server.setRequestHandler('prompts/get', async (request, ctx) => {
|
|
112
|
+
return await withModernProtocolErrors(async () => {
|
|
113
|
+
return await handlers.getPrompt(request, runtimeExtra(ctx));
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
server.setRequestHandler('tools/call', async (request, ctx) => {
|
|
117
|
+
return await withModernProtocolErrors(async () => {
|
|
118
|
+
let outputSchema;
|
|
119
|
+
const result = await handlers.callTool(request, runtimeExtra(ctx), (tool) => {
|
|
120
|
+
outputSchema = tool?.outputSchema;
|
|
121
|
+
});
|
|
122
|
+
// Low-level v2 handlers use this public codec seam. Convert's schemas
|
|
123
|
+
// and structured results are object-rooted, so projection is identity
|
|
124
|
+
// today while retaining the SDK's required text fallback behavior.
|
|
125
|
+
return server.projectCallToolResult(result, outputSchema);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
return server;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A listen request needs only identity and capabilities. Keeping this factory
|
|
132
|
+
* separate prevents a long-lived SSE handler from retaining Convert OAuth
|
|
133
|
+
* props, catalogs, docs providers, validators, or execution closures.
|
|
134
|
+
*/
|
|
135
|
+
export function createModernConvertMcpListenServer(options, advertiseListChanged) {
|
|
136
|
+
const definition = convertMcpServerDefinition(options);
|
|
137
|
+
return new Server(definition.implementation, {
|
|
138
|
+
...definition.options,
|
|
139
|
+
capabilities: advertiseListChanged
|
|
140
|
+
? definition.options.capabilities
|
|
141
|
+
: {
|
|
142
|
+
tools: { listChanged: false },
|
|
143
|
+
prompts: { listChanged: false },
|
|
144
|
+
resources: { listChanged: false },
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=modern-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modern-runtime.js","sourceRoot":"","sources":["../src/modern-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,MAAM,GAcP,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,QAAQ,IAAI,cAAc,GAE3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qCAAqC,EAAE,MAAM,wBAAwB,CAAC;AAE/E,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IAC1C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAA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E,GAAG,EAA2B,EAAE;QACtG,OAAO,MAAM,wBAAwB,CAAC,KAAK,IAAI,EAAE;YAC/C,IAAI,YAA2D,CAAC;YAChE,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC1E,YAAY,GAAG,IAAI,EAAE,YAAY,CAAC;YACpC,CAAC,CAAC,CAAC;YACH,sEAAsE;YACtE,sEAAsE;YACtE,mEAAmE;YACnE,OAAO,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,OAAwC,EACxC,oBAA6B;IAE7B,MAAM,UAAU,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IACvD,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE;QAC3C,GAAG,UAAU,CAAC,OAAO;QACrB,YAAY,EAAE,oBAAoB;YAChC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY;YACjC,CAAC,CAAC;gBACE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;gBAC7B,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;gBAC/B,SAAS,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;aAClC;KACN,CAAC,CAAC;AACL,CAAC"}
|
package/build/namespaced.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toolDefinitionMap } from './tools.js';
|
|
2
|
-
import { executeToolByName, truncateSchemaText, validateToolArgs } from './executor.js';
|
|
2
|
+
import { executeToolByName, executeValidatedToolByName, truncateSchemaText, validateToolArgs } from './executor.js';
|
|
3
3
|
import { JSON_SCHEMA_DRAFT_2020_12, pathParamsFromTemplate, tryParseJsonLike } from './shared.js';
|
|
4
4
|
import { toolSafetyKindForDelegate } from './tool-safety.js';
|
|
5
5
|
import { MDE_FRACTION_BOUNDARY_VERSION, experienceStatsVersion, usesLegacyFixedMdeScale, } from './stats-engine-version.js';
|
|
@@ -2237,7 +2237,7 @@ export async function executeNamespacedTool(toolName, args, executionContext, to
|
|
|
2237
2237
|
isError: true,
|
|
2238
2238
|
}, namespace, action, delegate);
|
|
2239
2239
|
}
|
|
2240
|
-
const executedResult = await
|
|
2240
|
+
const executedResult = await executeValidatedToolByName(delegate, flattenedArgs, executionContext);
|
|
2241
2241
|
const approvalAwareResult = normalizeApprovalRequiredError(namespace, action, path, executedResult);
|
|
2242
2242
|
const result = normalizeProjectCreatePermissionError(namespace, action, approvalAwareResult);
|
|
2243
2243
|
// Append action-specific guidance to error messages so agents can self-correct
|