@convertcom/mcp-server 0.0.1-beta.15 → 0.0.1-beta.17

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.
Files changed (44) hide show
  1. package/build/api-config.js +21 -3
  2. package/build/api-config.js.map +1 -1
  3. package/build/auth-context.d.ts +3 -0
  4. package/build/auth-context.js.map +1 -1
  5. package/build/catalog-change.d.ts +6 -2
  6. package/build/catalog-change.js +5 -1
  7. package/build/catalog-change.js.map +1 -1
  8. package/build/executor.d.ts +6 -0
  9. package/build/executor.js +73 -22
  10. package/build/executor.js.map +1 -1
  11. package/build/generated-tool-validators.js +141 -158
  12. package/build/generated-tool-validators.js.map +1 -1
  13. package/build/index.js +19 -12
  14. package/build/index.js.map +1 -1
  15. package/build/kb-hybrid.d.ts +13 -5
  16. package/build/kb-hybrid.js +16 -10
  17. package/build/kb-hybrid.js.map +1 -1
  18. package/build/kb-search.d.ts +9 -3
  19. package/build/kb-search.js +95 -4
  20. package/build/kb-search.js.map +1 -1
  21. package/build/kb-semantic.d.ts +2 -2
  22. package/build/kb-semantic.js +11 -2
  23. package/build/kb-semantic.js.map +1 -1
  24. package/build/local-docs.d.ts +12 -0
  25. package/build/local-docs.js +9 -0
  26. package/build/local-docs.js.map +1 -0
  27. package/build/local-execution-context.d.ts +7 -0
  28. package/build/local-execution-context.js +18 -0
  29. package/build/local-execution-context.js.map +1 -0
  30. package/build/mcp-server-compat.d.ts +8 -0
  31. package/build/mcp-server-compat.js +28 -0
  32. package/build/mcp-server-compat.js.map +1 -0
  33. package/build/modern-runtime.d.ts +13 -0
  34. package/build/modern-runtime.js +148 -0
  35. package/build/modern-runtime.js.map +1 -0
  36. package/build/namespaced.js +31 -4
  37. package/build/namespaced.js.map +1 -1
  38. package/build/operator.js +60 -4
  39. package/build/operator.js.map +1 -1
  40. package/build/runtime.d.ts +226 -5
  41. package/build/runtime.js +185 -73
  42. package/build/runtime.js.map +1 -1
  43. package/package.json +6 -6
  44. package/server.json +2 -2
@@ -1,16 +1,18 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
- import { type CallToolRequest, type CallToolResult, type Implementation, type ReadResourceResult, type Resource, type Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
+ import { type CallToolRequest, type CallToolResult, type GetPromptRequest, type ReadResourceRequest, type ClientRequest, type Implementation, type ListResourcesResult, type ReadResourceResult, type Resource, type ServerNotification, type Tool } from '@modelcontextprotocol/sdk/types.js';
3
4
  import type { ToolExecutionContext } from './auth-context.js';
4
5
  import { type CatalogChangeRequest } from './catalog-change.js';
5
6
  import { type KbChunk, type KbDocument, type SearchResult } from './kb-search.js';
6
7
  export declare const SERVER_NAME = "convert-api";
7
- export declare const SERVER_VERSION_FALLBACK = "0.0.1-beta.15";
8
+ export declare const SERVER_VERSION_FALLBACK = "0.0.1-beta.17";
9
+ export declare const MAX_SEARCH_QUERY_CHARACTERS = 500;
8
10
  export type ExecutionContextResolver = (extra: any, request: CallToolRequest) => ToolExecutionContext | undefined | Promise<ToolExecutionContext | undefined>;
9
11
  export type ToolCatalogContextResolver = (extra: any) => ToolExecutionContext | undefined | Promise<ToolExecutionContext | undefined>;
10
12
  export type DocsSearchProvider = {
11
- search(query: string, limit?: number): SearchResult[] | Promise<SearchResult[]>;
12
- getById(id: string): KbChunk | null | Promise<KbChunk | null>;
13
- getDocumentById?(id: string): KbDocument | null | Promise<KbDocument | null>;
13
+ search(query: string, limit?: number, signal?: AbortSignal): SearchResult[] | Promise<SearchResult[]>;
14
+ getById(id: string, signal?: AbortSignal): KbChunk | null | Promise<KbChunk | null>;
15
+ getDocumentById?(id: string, signal?: AbortSignal): KbDocument | null | Promise<KbDocument | null>;
14
16
  };
15
17
  export type RuntimeLogger = {
16
18
  log(event: string, payload?: unknown): void;
@@ -34,6 +36,8 @@ export type RuntimeResourceProvider = {
34
36
  };
35
37
  export type ConvertMcpRuntimeOptions = {
36
38
  docs: DocsSearchProvider;
39
+ /** Disable only where the serving transport cannot scope list-change delivery safely. */
40
+ advertiseListChanged?: boolean;
37
41
  executionContextResolver?: ExecutionContextResolver;
38
42
  toolCatalogContextResolver?: ToolCatalogContextResolver;
39
43
  logger?: RuntimeLogger;
@@ -47,12 +51,229 @@ export type ConvertMcpRuntimeOptions = {
47
51
  toolExtensions?: RuntimeToolExtension[];
48
52
  resourceProvider?: RuntimeResourceProvider;
49
53
  toolDecorator?: (tool: Tool) => Tool;
54
+ /** Bounded authorization-shape cache supplied only by transports with stable configuration. */
55
+ toolCatalogCache?: Map<string, RuntimeToolCatalogSnapshot>;
56
+ /** Shares deterministic tool-catalog digests across stateless modern requests. */
57
+ toolCatalogRevisionCache?: Map<string, Promise<string>>;
58
+ /** Must cover every dynamic input used by toolDecorator; never include bearer or principal data. */
59
+ toolCatalogDecoratorCacheKey?: () => string;
50
60
  serverInstructions?: string | ((toolSet: string) => string);
51
61
  catalogChangeNotifier?: (request: CatalogChangeRequest) => Promise<void>;
52
62
  };
63
+ export type RuntimeToolCatalogSnapshot = {
64
+ tools: Tool[];
65
+ toolsByName: ReadonlyMap<string, Tool>;
66
+ };
67
+ export type RuntimeRequestExtra = Pick<RequestHandlerExtra<ClientRequest, ServerNotification>, 'sendNotification' | 'signal' | 'requestId'> & {
68
+ clientInfo?: Implementation;
69
+ };
70
+ export type RuntimeToolResolutionObserver = (tool: Tool | undefined) => void;
53
71
  export declare const SERVER_INSTRUCTIONS: string;
54
72
  export declare function serverInstructionsForToolSet(toolSet: string, renderToolNames?: readonly string[]): string;
55
73
  export declare const canonicalSearchTool: Tool;
56
74
  export declare const canonicalFetchTool: Tool;
57
75
  export declare function getToolsForClient(toolSet?: string, feedbackEnabled?: boolean, executionContext?: ToolExecutionContext): Tool[];
76
+ export type ConvertMcpServerIdentityOptions = Pick<ConvertMcpRuntimeOptions, 'serverVersion' | 'serverTitle' | 'iconBaseUrl' | 'websiteUrl' | 'toolsForClient' | 'serverInstructions'>;
77
+ export declare function convertMcpServerDefinition(options: ConvertMcpServerIdentityOptions): {
78
+ implementation: {
79
+ name: string;
80
+ version: string;
81
+ title: string;
82
+ description: string;
83
+ websiteUrl: string;
84
+ icons: {
85
+ src: string;
86
+ mimeType?: string | undefined;
87
+ sizes?: string[] | undefined;
88
+ theme?: "light" | "dark" | undefined;
89
+ }[];
90
+ };
91
+ options: {
92
+ capabilities: {
93
+ tools: {
94
+ listChanged: boolean;
95
+ };
96
+ prompts: {
97
+ listChanged: boolean;
98
+ };
99
+ resources: {
100
+ listChanged: boolean;
101
+ };
102
+ };
103
+ instructions: string;
104
+ };
105
+ };
58
106
  export declare function createConvertMcpServer(options: ConvertMcpRuntimeOptions): Server;
107
+ export declare function createConvertMcpHandlers(options: ConvertMcpRuntimeOptions, clientInfoFor: (extra: RuntimeRequestExtra) => Implementation | undefined): {
108
+ listTools: (extra: RuntimeRequestExtra) => Promise<{
109
+ tools: {
110
+ inputSchema: {
111
+ [x: string]: unknown;
112
+ type: "object";
113
+ properties?: {
114
+ [x: string]: object;
115
+ } | undefined;
116
+ required?: string[] | undefined;
117
+ };
118
+ name: string;
119
+ description?: string | undefined;
120
+ outputSchema?: {
121
+ [x: string]: unknown;
122
+ type: "object";
123
+ properties?: {
124
+ [x: string]: object;
125
+ } | undefined;
126
+ required?: string[] | undefined;
127
+ } | undefined;
128
+ annotations?: {
129
+ title?: string | undefined;
130
+ readOnlyHint?: boolean | undefined;
131
+ destructiveHint?: boolean | undefined;
132
+ idempotentHint?: boolean | undefined;
133
+ openWorldHint?: boolean | undefined;
134
+ } | undefined;
135
+ execution?: {
136
+ taskSupport?: "required" | "optional" | "forbidden" | undefined;
137
+ } | undefined;
138
+ _meta?: {
139
+ [x: string]: unknown;
140
+ } | undefined;
141
+ icons?: {
142
+ src: string;
143
+ mimeType?: string | undefined;
144
+ sizes?: string[] | undefined;
145
+ theme?: "light" | "dark" | undefined;
146
+ }[] | undefined;
147
+ title?: string | undefined;
148
+ }[];
149
+ }>;
150
+ listResources: (extra: RuntimeRequestExtra) => Promise<ListResourcesResult>;
151
+ listResourceTemplates: (extra: RuntimeRequestExtra) => Promise<{
152
+ resourceTemplates: never[];
153
+ }>;
154
+ readResource: (request: ReadResourceRequest, extra: RuntimeRequestExtra) => Promise<ReadResourceResult>;
155
+ listPrompts: (extra: RuntimeRequestExtra) => Promise<{
156
+ prompts: {
157
+ name: string;
158
+ description?: string | undefined;
159
+ arguments?: {
160
+ name: string;
161
+ description?: string | undefined;
162
+ required?: boolean | undefined;
163
+ }[] | undefined;
164
+ _meta?: {
165
+ [x: string]: unknown;
166
+ } | undefined;
167
+ icons?: {
168
+ src: string;
169
+ mimeType?: string | undefined;
170
+ sizes?: string[] | undefined;
171
+ theme?: "light" | "dark" | undefined;
172
+ }[] | undefined;
173
+ title?: string | undefined;
174
+ }[];
175
+ }>;
176
+ getPrompt: (request: GetPromptRequest, extra: RuntimeRequestExtra) => Promise<{
177
+ [x: string]: unknown;
178
+ messages: {
179
+ role: "user" | "assistant";
180
+ content: {
181
+ type: "text";
182
+ text: string;
183
+ annotations?: {
184
+ audience?: ("user" | "assistant")[] | undefined;
185
+ priority?: number | undefined;
186
+ lastModified?: string | undefined;
187
+ } | undefined;
188
+ _meta?: {
189
+ [x: string]: unknown;
190
+ } | undefined;
191
+ } | {
192
+ type: "image";
193
+ data: string;
194
+ mimeType: string;
195
+ annotations?: {
196
+ audience?: ("user" | "assistant")[] | undefined;
197
+ priority?: number | undefined;
198
+ lastModified?: string | undefined;
199
+ } | undefined;
200
+ _meta?: {
201
+ [x: string]: unknown;
202
+ } | undefined;
203
+ } | {
204
+ type: "audio";
205
+ data: string;
206
+ mimeType: string;
207
+ annotations?: {
208
+ audience?: ("user" | "assistant")[] | undefined;
209
+ priority?: number | undefined;
210
+ lastModified?: string | undefined;
211
+ } | undefined;
212
+ _meta?: {
213
+ [x: string]: unknown;
214
+ } | undefined;
215
+ } | {
216
+ uri: string;
217
+ name: string;
218
+ type: "resource_link";
219
+ description?: string | undefined;
220
+ mimeType?: string | undefined;
221
+ size?: number | undefined;
222
+ annotations?: {
223
+ audience?: ("user" | "assistant")[] | undefined;
224
+ priority?: number | undefined;
225
+ lastModified?: string | undefined;
226
+ } | undefined;
227
+ _meta?: {
228
+ [x: string]: unknown;
229
+ } | undefined;
230
+ icons?: {
231
+ src: string;
232
+ mimeType?: string | undefined;
233
+ sizes?: string[] | undefined;
234
+ theme?: "light" | "dark" | undefined;
235
+ }[] | undefined;
236
+ title?: string | undefined;
237
+ } | {
238
+ type: "resource";
239
+ resource: {
240
+ uri: string;
241
+ text: string;
242
+ mimeType?: string | undefined;
243
+ _meta?: {
244
+ [x: string]: unknown;
245
+ } | undefined;
246
+ } | {
247
+ uri: string;
248
+ blob: string;
249
+ mimeType?: string | undefined;
250
+ _meta?: {
251
+ [x: string]: unknown;
252
+ } | undefined;
253
+ };
254
+ annotations?: {
255
+ audience?: ("user" | "assistant")[] | undefined;
256
+ priority?: number | undefined;
257
+ lastModified?: string | undefined;
258
+ } | undefined;
259
+ _meta?: {
260
+ [x: string]: unknown;
261
+ } | undefined;
262
+ };
263
+ }[];
264
+ _meta?: {
265
+ [x: string]: unknown;
266
+ progressToken?: string | number | undefined;
267
+ "io.modelcontextprotocol/related-task"?: {
268
+ taskId: string;
269
+ } | undefined;
270
+ } | undefined;
271
+ description?: string | undefined;
272
+ }>;
273
+ callTool: (request: CallToolRequest, extra: RuntimeRequestExtra, onToolResolved?: RuntimeToolResolutionObserver) => Promise<CallToolResult>;
274
+ };
275
+ export declare function namespaceCompletionTelemetry(response: CallToolResult): {
276
+ delegate?: string;
277
+ status?: number;
278
+ errorType?: string;
279
+ };