sourcey 3.3.10 → 3.4.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 +19 -3
- package/dist/client/scroll-tracker.js +8 -1
- package/dist/components/layout/Head.d.ts.map +1 -1
- package/dist/components/layout/Head.js +1 -1
- package/dist/components/layout/Page.d.ts.map +1 -1
- package/dist/components/layout/Page.js +2 -1
- package/dist/components/layout/Sidebar.d.ts.map +1 -1
- package/dist/components/layout/Sidebar.js +6 -1
- package/dist/components/layout/TableOfContents.js +1 -1
- package/dist/components/mcp/AnnotationBadges.d.ts +15 -0
- package/dist/components/mcp/AnnotationBadges.d.ts.map +1 -0
- package/dist/components/mcp/AnnotationBadges.js +10 -0
- package/dist/components/mcp/McpConnection.d.ts +10 -0
- package/dist/components/mcp/McpConnection.d.ts.map +1 -0
- package/dist/components/mcp/McpConnection.js +32 -0
- package/dist/components/mcp/McpEndpointBar.d.ts +8 -0
- package/dist/components/mcp/McpEndpointBar.d.ts.map +1 -0
- package/dist/components/mcp/McpEndpointBar.js +16 -0
- package/dist/components/mcp/McpReturns.d.ts +18 -0
- package/dist/components/mcp/McpReturns.d.ts.map +1 -0
- package/dist/components/mcp/McpReturns.js +33 -0
- package/dist/components/openapi/Operation.d.ts.map +1 -1
- package/dist/components/openapi/Operation.js +5 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -3
- package/dist/core/mcp-normalizer.d.ts +11 -0
- package/dist/core/mcp-normalizer.d.ts.map +1 -0
- package/dist/core/mcp-normalizer.js +382 -0
- package/dist/core/types.d.ts +26 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +46 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -9
- package/dist/renderer/html-builder.d.ts.map +1 -1
- package/dist/renderer/html-builder.js +9 -0
- package/dist/themes/default/sourcey.css +36 -8
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +50 -1
- package/package.json +6 -2
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert an McpSpec (from mcp-parser) into a NormalizedSpec for rendering.
|
|
3
|
+
*
|
|
4
|
+
* This is the bridge between the MCP snapshot format and sourcey's
|
|
5
|
+
* format-agnostic rendering pipeline. Everything downstream (components,
|
|
6
|
+
* search, navigation, themes) works unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { generateExample } from "../utils/example-generator.js";
|
|
9
|
+
// ── Public API ────────────────────────────────────────────────────────
|
|
10
|
+
export function normalizeMcpSpec(spec) {
|
|
11
|
+
const connectionInfo = {
|
|
12
|
+
transport: spec.transport ? {
|
|
13
|
+
type: spec.transport.type,
|
|
14
|
+
command: spec.transport.command,
|
|
15
|
+
args: spec.transport.args,
|
|
16
|
+
url: spec.transport.url,
|
|
17
|
+
} : undefined,
|
|
18
|
+
serverName: spec.server.name,
|
|
19
|
+
mcpVersion: spec.mcpVersion,
|
|
20
|
+
capabilities: spec.capabilities,
|
|
21
|
+
};
|
|
22
|
+
const toolOps = (spec.tools ?? []).map((t) => toolToOperation(t, connectionInfo));
|
|
23
|
+
const resourceOps = (spec.resources ?? []).map((r) => resourceToOperation(r, connectionInfo));
|
|
24
|
+
const templateOps = (spec.resourceTemplates ?? []).map((t) => resourceTemplateToOperation(t, connectionInfo));
|
|
25
|
+
const promptOps = (spec.prompts ?? []).map((p) => promptToOperation(p, connectionInfo));
|
|
26
|
+
const allOps = [...toolOps, ...resourceOps, ...templateOps, ...promptOps];
|
|
27
|
+
// Build tags — only for non-empty groups
|
|
28
|
+
const tags = [];
|
|
29
|
+
if (toolOps.length)
|
|
30
|
+
tags.push({ name: "Tools", operations: toolOps });
|
|
31
|
+
if (resourceOps.length || templateOps.length)
|
|
32
|
+
tags.push({ name: "Resources", operations: [...resourceOps, ...templateOps] });
|
|
33
|
+
if (promptOps.length)
|
|
34
|
+
tags.push({ name: "Prompts", operations: promptOps });
|
|
35
|
+
// Shared schema definitions from $defs
|
|
36
|
+
const schemas = {};
|
|
37
|
+
if (spec.$defs) {
|
|
38
|
+
for (const [name, schema] of Object.entries(spec.$defs)) {
|
|
39
|
+
schemas[name] = convertSchema(schema, name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
info: {
|
|
44
|
+
title: spec.server.name,
|
|
45
|
+
version: spec.server.version,
|
|
46
|
+
description: spec.description,
|
|
47
|
+
},
|
|
48
|
+
servers: spec.transport?.url ? [{ url: spec.transport.url }] : [],
|
|
49
|
+
tags,
|
|
50
|
+
operations: allOps,
|
|
51
|
+
schemas,
|
|
52
|
+
securitySchemes: {},
|
|
53
|
+
webhooks: [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// ── Tool → Operation ──────────────────────────────────────────────────
|
|
57
|
+
function toolToOperation(tool, connection) {
|
|
58
|
+
const group = tool["x-sourcey-group"];
|
|
59
|
+
const inputSchema = convertSchema(tool.inputSchema);
|
|
60
|
+
const outputSchema = tool.outputSchema ? convertSchema(tool.outputSchema) : undefined;
|
|
61
|
+
// Flat parameters from top-level inputSchema properties
|
|
62
|
+
const parameters = flattenInputSchema(tool.inputSchema);
|
|
63
|
+
// Only include requestBody for nested/complex schemas
|
|
64
|
+
const requestBody = hasNestedProperties(tool.inputSchema) ? {
|
|
65
|
+
required: true,
|
|
66
|
+
content: { "application/json": { schema: inputSchema } },
|
|
67
|
+
} : undefined;
|
|
68
|
+
return {
|
|
69
|
+
operationId: tool.name,
|
|
70
|
+
summary: tool.title ?? tool.name,
|
|
71
|
+
description: tool.description,
|
|
72
|
+
method: "tool",
|
|
73
|
+
path: tool.name,
|
|
74
|
+
tags: [group ?? "Tools"],
|
|
75
|
+
parameters,
|
|
76
|
+
requestBody,
|
|
77
|
+
responses: [],
|
|
78
|
+
security: [],
|
|
79
|
+
deprecated: false,
|
|
80
|
+
codeSamples: generateToolSamples(tool, inputSchema),
|
|
81
|
+
mcpExtras: {
|
|
82
|
+
type: "tool",
|
|
83
|
+
annotations: tool.annotations ? {
|
|
84
|
+
readOnlyHint: tool.annotations.readOnlyHint,
|
|
85
|
+
destructiveHint: tool.annotations.destructiveHint,
|
|
86
|
+
idempotentHint: tool.annotations.idempotentHint,
|
|
87
|
+
openWorldHint: tool.annotations.openWorldHint,
|
|
88
|
+
} : undefined,
|
|
89
|
+
outputSchema,
|
|
90
|
+
connection,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// ── Resource → Operation ──────────────────────────────────────────────
|
|
95
|
+
function resourceToOperation(resource, connection) {
|
|
96
|
+
const group = resource["x-sourcey-group"];
|
|
97
|
+
return {
|
|
98
|
+
operationId: slugify(resource.name),
|
|
99
|
+
summary: resource.name,
|
|
100
|
+
description: resource.description,
|
|
101
|
+
method: "resource",
|
|
102
|
+
path: resource.uri,
|
|
103
|
+
tags: [group ?? "Resources"],
|
|
104
|
+
parameters: [],
|
|
105
|
+
responses: [],
|
|
106
|
+
security: [],
|
|
107
|
+
deprecated: false,
|
|
108
|
+
codeSamples: generateResourceSamples(resource),
|
|
109
|
+
mcpExtras: {
|
|
110
|
+
type: "resource",
|
|
111
|
+
connection,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// ── Resource Template → Operation ─────────────────────────────────────
|
|
116
|
+
function resourceTemplateToOperation(template, connection) {
|
|
117
|
+
const group = template["x-sourcey-group"];
|
|
118
|
+
return {
|
|
119
|
+
operationId: slugify(template.name),
|
|
120
|
+
summary: template.name,
|
|
121
|
+
description: template.description,
|
|
122
|
+
method: "resource",
|
|
123
|
+
path: template.uriTemplate,
|
|
124
|
+
tags: [group ?? "Resources"],
|
|
125
|
+
parameters: extractUriTemplateParams(template.uriTemplate),
|
|
126
|
+
responses: [],
|
|
127
|
+
security: [],
|
|
128
|
+
deprecated: false,
|
|
129
|
+
codeSamples: generateResourceSamples({ uri: template.uriTemplate, name: template.name }),
|
|
130
|
+
mcpExtras: {
|
|
131
|
+
type: "resource",
|
|
132
|
+
connection,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// ── Prompt → Operation ────────────────────────────────────────────────
|
|
137
|
+
function promptToOperation(prompt, connection) {
|
|
138
|
+
const group = prompt["x-sourcey-group"];
|
|
139
|
+
const parameters = (prompt.arguments ?? []).map(arg => ({
|
|
140
|
+
name: arg.name,
|
|
141
|
+
in: "argument",
|
|
142
|
+
description: arg.description,
|
|
143
|
+
required: arg.required ?? false,
|
|
144
|
+
deprecated: false,
|
|
145
|
+
schema: { type: "string" },
|
|
146
|
+
}));
|
|
147
|
+
return {
|
|
148
|
+
operationId: prompt.name,
|
|
149
|
+
summary: prompt.name,
|
|
150
|
+
description: prompt.description,
|
|
151
|
+
method: "prompt",
|
|
152
|
+
path: prompt.name,
|
|
153
|
+
tags: [group ?? "Prompts"],
|
|
154
|
+
parameters,
|
|
155
|
+
responses: [],
|
|
156
|
+
security: [],
|
|
157
|
+
deprecated: false,
|
|
158
|
+
codeSamples: generatePromptSamples(prompt),
|
|
159
|
+
mcpExtras: {
|
|
160
|
+
type: "prompt",
|
|
161
|
+
connection,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// ── Schema conversion ─────────────────────────────────────────────────
|
|
166
|
+
function convertSchema(schema, name) {
|
|
167
|
+
const result = {};
|
|
168
|
+
if (name)
|
|
169
|
+
result.name = name;
|
|
170
|
+
if (schema.type)
|
|
171
|
+
result.type = schema.type;
|
|
172
|
+
if (schema.format)
|
|
173
|
+
result.format = schema.format;
|
|
174
|
+
if (schema.title)
|
|
175
|
+
result.title = schema.title;
|
|
176
|
+
if (schema.description)
|
|
177
|
+
result.description = schema.description;
|
|
178
|
+
if (schema.default !== undefined)
|
|
179
|
+
result.default = schema.default;
|
|
180
|
+
if (schema.enum)
|
|
181
|
+
result.enum = schema.enum;
|
|
182
|
+
if (schema.const !== undefined)
|
|
183
|
+
result.const = schema.const;
|
|
184
|
+
// Object
|
|
185
|
+
if (schema.properties) {
|
|
186
|
+
result.properties = {};
|
|
187
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
188
|
+
result.properties[key] = convertSchema(prop, key);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (schema.additionalProperties !== undefined) {
|
|
192
|
+
result.additionalProperties = typeof schema.additionalProperties === "boolean"
|
|
193
|
+
? schema.additionalProperties
|
|
194
|
+
: convertSchema(schema.additionalProperties);
|
|
195
|
+
}
|
|
196
|
+
if (schema.required)
|
|
197
|
+
result.required = schema.required;
|
|
198
|
+
// Array — handle JsonSchema.items being JsonSchema | JsonSchema[]
|
|
199
|
+
if (schema.items) {
|
|
200
|
+
if (Array.isArray(schema.items)) {
|
|
201
|
+
result.items = schema.items.length === 1
|
|
202
|
+
? convertSchema(schema.items[0])
|
|
203
|
+
: { oneOf: schema.items.map(s => convertSchema(s)) };
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
result.items = convertSchema(schema.items);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (schema.minItems !== undefined)
|
|
210
|
+
result.minItems = schema.minItems;
|
|
211
|
+
if (schema.maxItems !== undefined)
|
|
212
|
+
result.maxItems = schema.maxItems;
|
|
213
|
+
if (schema.uniqueItems !== undefined)
|
|
214
|
+
result.uniqueItems = schema.uniqueItems;
|
|
215
|
+
// Numeric
|
|
216
|
+
if (schema.minimum !== undefined)
|
|
217
|
+
result.minimum = schema.minimum;
|
|
218
|
+
if (schema.maximum !== undefined)
|
|
219
|
+
result.maximum = schema.maximum;
|
|
220
|
+
if (schema.exclusiveMinimum !== undefined)
|
|
221
|
+
result.exclusiveMinimum = schema.exclusiveMinimum;
|
|
222
|
+
if (schema.exclusiveMaximum !== undefined)
|
|
223
|
+
result.exclusiveMaximum = schema.exclusiveMaximum;
|
|
224
|
+
if (schema.multipleOf !== undefined)
|
|
225
|
+
result.multipleOf = schema.multipleOf;
|
|
226
|
+
// String
|
|
227
|
+
if (schema.minLength !== undefined)
|
|
228
|
+
result.minLength = schema.minLength;
|
|
229
|
+
if (schema.maxLength !== undefined)
|
|
230
|
+
result.maxLength = schema.maxLength;
|
|
231
|
+
if (schema.pattern)
|
|
232
|
+
result.pattern = schema.pattern;
|
|
233
|
+
// Composition
|
|
234
|
+
if (schema.allOf)
|
|
235
|
+
result.allOf = schema.allOf.map((s) => convertSchema(s));
|
|
236
|
+
if (schema.anyOf)
|
|
237
|
+
result.anyOf = schema.anyOf.map((s) => convertSchema(s));
|
|
238
|
+
if (schema.oneOf)
|
|
239
|
+
result.oneOf = schema.oneOf.map((s) => convertSchema(s));
|
|
240
|
+
if (schema.not)
|
|
241
|
+
result.not = convertSchema(schema.not);
|
|
242
|
+
// Examples
|
|
243
|
+
if (schema.examples)
|
|
244
|
+
result.examples = schema.examples;
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
// ── Helpers ───────────────────────────────────────────────────────────
|
|
248
|
+
function flattenInputSchema(schema) {
|
|
249
|
+
if (!schema.properties)
|
|
250
|
+
return [];
|
|
251
|
+
const required = new Set(schema.required ?? []);
|
|
252
|
+
return Object.entries(schema.properties).map(([name, prop]) => ({
|
|
253
|
+
name,
|
|
254
|
+
in: "argument",
|
|
255
|
+
description: prop.description,
|
|
256
|
+
required: required.has(name),
|
|
257
|
+
deprecated: false,
|
|
258
|
+
schema: convertSchema(prop),
|
|
259
|
+
example: prop.default,
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
function hasNestedProperties(schema) {
|
|
263
|
+
if (!schema.properties)
|
|
264
|
+
return false;
|
|
265
|
+
return Object.values(schema.properties).some((prop) => {
|
|
266
|
+
if (prop.type === "object" && prop.properties)
|
|
267
|
+
return true;
|
|
268
|
+
if (prop.type === "array" && prop.items && !Array.isArray(prop.items) && prop.items.type === "object")
|
|
269
|
+
return true;
|
|
270
|
+
if (prop.allOf || prop.anyOf || prop.oneOf)
|
|
271
|
+
return true;
|
|
272
|
+
return false;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function extractUriTemplateParams(uriTemplate) {
|
|
276
|
+
const matches = uriTemplate.match(/\{([^}]+)\}/g);
|
|
277
|
+
if (!matches)
|
|
278
|
+
return [];
|
|
279
|
+
return matches.map(m => ({
|
|
280
|
+
name: m.slice(1, -1),
|
|
281
|
+
in: "path",
|
|
282
|
+
required: true,
|
|
283
|
+
deprecated: false,
|
|
284
|
+
schema: { type: "string" },
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
function slugify(name) {
|
|
288
|
+
return name.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
|
|
289
|
+
}
|
|
290
|
+
// ── Code sample generation ────────────────────────────────────────────
|
|
291
|
+
function generateToolSamples(tool, inputSchema) {
|
|
292
|
+
const example = inputSchema.properties
|
|
293
|
+
? generateExample(inputSchema)
|
|
294
|
+
: {};
|
|
295
|
+
const exampleJson = JSON.stringify(example, null, 2);
|
|
296
|
+
const indented = exampleJson.split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n");
|
|
297
|
+
return [
|
|
298
|
+
{
|
|
299
|
+
lang: "json",
|
|
300
|
+
label: "JSON-RPC",
|
|
301
|
+
source: `{
|
|
302
|
+
"jsonrpc": "2.0",
|
|
303
|
+
"method": "tools/call",
|
|
304
|
+
"params": {
|
|
305
|
+
"name": "${tool.name}",
|
|
306
|
+
"arguments": ${indented}
|
|
307
|
+
}
|
|
308
|
+
}`,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
lang: "typescript",
|
|
312
|
+
label: "TypeScript",
|
|
313
|
+
source: `const result = await client.callTool("${tool.name}", ${exampleJson});`,
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
lang: "python",
|
|
317
|
+
label: "Python",
|
|
318
|
+
source: `result = await session.call_tool("${tool.name}", arguments=${exampleJson})`,
|
|
319
|
+
},
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
function generateResourceSamples(resource) {
|
|
323
|
+
return [
|
|
324
|
+
{
|
|
325
|
+
lang: "json",
|
|
326
|
+
label: "JSON-RPC",
|
|
327
|
+
source: `{
|
|
328
|
+
"jsonrpc": "2.0",
|
|
329
|
+
"method": "resources/read",
|
|
330
|
+
"params": {
|
|
331
|
+
"uri": "${resource.uri}"
|
|
332
|
+
}
|
|
333
|
+
}`,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
lang: "typescript",
|
|
337
|
+
label: "TypeScript",
|
|
338
|
+
source: `const result = await client.readResource("${resource.uri}");`,
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
lang: "python",
|
|
342
|
+
label: "Python",
|
|
343
|
+
source: `result = await session.read_resource("${resource.uri}")`,
|
|
344
|
+
},
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
function generatePromptSamples(prompt) {
|
|
348
|
+
const args = (prompt.arguments ?? []);
|
|
349
|
+
const exampleArgs = Object.fromEntries(args.map((a) => [a.name, `<${a.name}>`]));
|
|
350
|
+
const argsJson = JSON.stringify(exampleArgs, null, 2);
|
|
351
|
+
const indented = argsJson.split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n");
|
|
352
|
+
const tsArgs = args.map((a) => ` ${a.name}: "<${a.name}>",`).join("\n");
|
|
353
|
+
const pyArgs = args.map((a) => ` "${a.name}": "<${a.name}>",`).join("\n");
|
|
354
|
+
return [
|
|
355
|
+
{
|
|
356
|
+
lang: "json",
|
|
357
|
+
label: "JSON-RPC",
|
|
358
|
+
source: `{
|
|
359
|
+
"jsonrpc": "2.0",
|
|
360
|
+
"method": "prompts/get",
|
|
361
|
+
"params": {
|
|
362
|
+
"name": "${prompt.name}",
|
|
363
|
+
"arguments": ${indented}
|
|
364
|
+
}
|
|
365
|
+
}`,
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
lang: "typescript",
|
|
369
|
+
label: "TypeScript",
|
|
370
|
+
source: args.length
|
|
371
|
+
? `const result = await client.getPrompt("${prompt.name}", {\n${tsArgs}\n});`
|
|
372
|
+
: `const result = await client.getPrompt("${prompt.name}");`,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
lang: "python",
|
|
376
|
+
label: "Python",
|
|
377
|
+
source: args.length
|
|
378
|
+
? `result = await session.get_prompt("${prompt.name}", arguments={\n${pyArgs}\n})`
|
|
379
|
+
: `result = await session.get_prompt("${prompt.name}")`,
|
|
380
|
+
},
|
|
381
|
+
];
|
|
382
|
+
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface NormalizedTag {
|
|
|
51
51
|
/** Vendor extension: hide this tag from navigation */
|
|
52
52
|
hidden?: boolean;
|
|
53
53
|
}
|
|
54
|
-
export type HttpMethod = "get" | "post" | "put" | "delete" | "patch" | "options" | "head" | "trace";
|
|
54
|
+
export type HttpMethod = "get" | "post" | "put" | "delete" | "patch" | "options" | "head" | "trace" | "tool" | "resource" | "prompt";
|
|
55
55
|
export interface NormalizedOperation {
|
|
56
56
|
operationId?: string;
|
|
57
57
|
summary?: string;
|
|
@@ -71,10 +71,34 @@ export interface NormalizedOperation {
|
|
|
71
71
|
hidden?: boolean;
|
|
72
72
|
/** Vendor extension: custom code samples */
|
|
73
73
|
codeSamples?: CodeSample[];
|
|
74
|
+
/** MCP-specific rendering data (undefined for OpenAPI operations) */
|
|
75
|
+
mcpExtras?: McpOperationExtras;
|
|
76
|
+
}
|
|
77
|
+
export interface McpOperationExtras {
|
|
78
|
+
type: "tool" | "resource" | "prompt";
|
|
79
|
+
annotations?: {
|
|
80
|
+
readOnlyHint?: boolean;
|
|
81
|
+
destructiveHint?: boolean;
|
|
82
|
+
idempotentHint?: boolean;
|
|
83
|
+
openWorldHint?: boolean;
|
|
84
|
+
};
|
|
85
|
+
outputSchema?: NormalizedSchema;
|
|
86
|
+
connection?: McpConnectionInfo;
|
|
87
|
+
}
|
|
88
|
+
export interface McpConnectionInfo {
|
|
89
|
+
transport?: {
|
|
90
|
+
type: string;
|
|
91
|
+
command?: string;
|
|
92
|
+
args?: string[];
|
|
93
|
+
url?: string;
|
|
94
|
+
};
|
|
95
|
+
serverName: string;
|
|
96
|
+
mcpVersion?: string;
|
|
97
|
+
capabilities?: Record<string, unknown>;
|
|
74
98
|
}
|
|
75
99
|
export interface NormalizedParameter {
|
|
76
100
|
name: string;
|
|
77
|
-
in: "query" | "header" | "path" | "cookie";
|
|
101
|
+
in: "query" | "header" | "path" | "cookie" | "argument";
|
|
78
102
|
description?: string;
|
|
79
103
|
required: boolean;
|
|
80
104
|
deprecated: boolean;
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAChD,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAID,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IA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":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAsCA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkY7E"}
|
package/dist/dev-server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { loadSpec } from "./core/loader.js";
|
|
|
7
7
|
import { convertToOpenApi3 } from "./core/converter.js";
|
|
8
8
|
import { parseSpec } from "./core/parser.js";
|
|
9
9
|
import { normalizeSpec } from "./core/normalizer.js";
|
|
10
|
+
import { normalizeMcpSpec } from "./core/mcp-normalizer.js";
|
|
10
11
|
import { buildNavFromSpec, buildNavFromPages, buildSiteNavigation, withActivePage } from "./core/navigation.js";
|
|
11
12
|
import { loadMarkdownPage, slugFromPath } from "./core/markdown-loader.js";
|
|
12
13
|
import { loadDoxygenTab } from "./core/doxygen-loader.js";
|
|
@@ -40,6 +41,8 @@ export async function startDevServer(options) {
|
|
|
40
41
|
for (const tab of config.tabs) {
|
|
41
42
|
if (tab.openapi)
|
|
42
43
|
watchPaths.push(tab.openapi);
|
|
44
|
+
if (tab.mcp)
|
|
45
|
+
watchPaths.push(tab.mcp);
|
|
43
46
|
if (tab.doxygen)
|
|
44
47
|
watchPaths.push(tab.doxygen.xml);
|
|
45
48
|
if (tab.groups) {
|
|
@@ -57,6 +60,9 @@ export async function startDevServer(options) {
|
|
|
57
60
|
if (tab.openapi) {
|
|
58
61
|
map.set(resolve(tab.openapi), { kind: "openapi", tabSlug: tab.slug, specPath: tab.openapi });
|
|
59
62
|
}
|
|
63
|
+
if (tab.mcp) {
|
|
64
|
+
map.set(resolve(tab.mcp), { kind: "mcp", tabSlug: tab.slug, specPath: tab.mcp });
|
|
65
|
+
}
|
|
60
66
|
if (tab.doxygen) {
|
|
61
67
|
map.set(resolve(tab.doxygen.xml), { kind: "doxygen", tabSlug: tab.slug, xmlDir: tab.doxygen.xml });
|
|
62
68
|
}
|
|
@@ -183,6 +189,29 @@ export async function startDevServer(options) {
|
|
|
183
189
|
data.siteTabs[idx] = navTab;
|
|
184
190
|
}
|
|
185
191
|
}
|
|
192
|
+
else if (content.kind === "mcp") {
|
|
193
|
+
log(`reparsing mcp spec ${shortPath(content.specPath)}`);
|
|
194
|
+
const { parse } = await import("mcp-parser");
|
|
195
|
+
const mcpSpec = await parse(content.specPath);
|
|
196
|
+
const spec = normalizeMcpSpec(mcpSpec);
|
|
197
|
+
if (cache !== snapshot)
|
|
198
|
+
return;
|
|
199
|
+
data.specsBySlug.set(content.tabSlug, spec);
|
|
200
|
+
const pageKey = tabPath(content.tabSlug, "index.html");
|
|
201
|
+
const existing = data.pageMap.get(pageKey);
|
|
202
|
+
if (existing) {
|
|
203
|
+
existing.currentPage = { kind: "spec", spec };
|
|
204
|
+
existing.spec = spec;
|
|
205
|
+
}
|
|
206
|
+
const tab = config.tabs.find((t) => t.slug === content.tabSlug);
|
|
207
|
+
if (tab) {
|
|
208
|
+
const navTab = buildNavFromSpec(spec, tab.slug);
|
|
209
|
+
navTab.label = tab.label;
|
|
210
|
+
const idx = data.siteTabs.findIndex((t) => t.slug === content.tabSlug);
|
|
211
|
+
if (idx !== -1)
|
|
212
|
+
data.siteTabs[idx] = navTab;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
186
215
|
const ms = Math.round(performance.now() - start);
|
|
187
216
|
log(`updated \x1b[2m(${ms}ms)\x1b[0m`);
|
|
188
217
|
}
|
|
@@ -265,6 +294,9 @@ export async function startDevServer(options) {
|
|
|
265
294
|
port,
|
|
266
295
|
strictPort: true,
|
|
267
296
|
hmr: true,
|
|
297
|
+
fs: {
|
|
298
|
+
allow: [process.cwd(), projectRoot],
|
|
299
|
+
},
|
|
268
300
|
},
|
|
269
301
|
plugins: [
|
|
270
302
|
preact(),
|
|
@@ -330,20 +362,26 @@ async function loadSiteData(tabs) {
|
|
|
330
362
|
const siteTabs = [];
|
|
331
363
|
const pageMap = new Map();
|
|
332
364
|
for (const tab of tabs) {
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
365
|
+
if (tab.openapi) {
|
|
366
|
+
const loaded = await loadSpec(tab.openapi);
|
|
367
|
+
const parsed = await parseSpec(loaded);
|
|
368
|
+
const openapi3 = await convertToOpenApi3(parsed);
|
|
369
|
+
const spec = normalizeSpec(openapi3);
|
|
370
|
+
specsBySlug.set(tab.slug, spec);
|
|
371
|
+
}
|
|
372
|
+
else if (tab.mcp) {
|
|
373
|
+
const { parse } = await import("mcp-parser");
|
|
374
|
+
const mcpSpec = await parse(tab.mcp);
|
|
375
|
+
const spec = normalizeMcpSpec(mcpSpec);
|
|
376
|
+
specsBySlug.set(tab.slug, spec);
|
|
377
|
+
}
|
|
340
378
|
}
|
|
341
379
|
const primarySpec = specsBySlug.values().next().value ?? {
|
|
342
380
|
info: { title: "", version: "", description: "" },
|
|
343
381
|
servers: [], tags: [], operations: [], schemas: {}, securitySchemes: {}, webhooks: [],
|
|
344
382
|
};
|
|
345
383
|
for (const tab of tabs) {
|
|
346
|
-
if (tab.openapi) {
|
|
384
|
+
if (tab.openapi || tab.mcp) {
|
|
347
385
|
const spec = specsBySlug.get(tab.slug);
|
|
348
386
|
const navTab = buildNavFromSpec(spec, tab.slug);
|
|
349
387
|
navTab.label = tab.label;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,aAAa,CAAC;AAc/D,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAY3E;AAMD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACtC;AAED,wBAAsB,aAAa,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgH5F;AAgKD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { loadSpec } from "./core/loader.js";
|
|
|
4
4
|
import { convertToOpenApi3 } from "./core/converter.js";
|
|
5
5
|
import { parseSpec } from "./core/parser.js";
|
|
6
6
|
import { normalizeSpec } from "./core/normalizer.js";
|
|
7
|
+
import { normalizeMcpSpec } from "./core/mcp-normalizer.js";
|
|
7
8
|
import { buildSite as buildSiteHtml } from "./renderer/html-builder.js";
|
|
8
9
|
import { tabPath } from "./config.js";
|
|
9
10
|
import { loadConfig, configFromSpec } from "./config.js";
|
|
@@ -33,15 +34,21 @@ export async function buildSiteDocs(options = {}) {
|
|
|
33
34
|
const sitePages = [];
|
|
34
35
|
const siteTabs = [];
|
|
35
36
|
const specsBySlug = new Map();
|
|
36
|
-
// Load all specs
|
|
37
|
+
// Load all specs (OpenAPI and MCP)
|
|
37
38
|
for (const tab of tabs) {
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
if (tab.openapi) {
|
|
40
|
+
const loaded = await loadSpec(tab.openapi);
|
|
41
|
+
const parsed = await parseSpec(loaded);
|
|
42
|
+
const openapi3 = await convertToOpenApi3(parsed);
|
|
43
|
+
const spec = normalizeSpec(openapi3);
|
|
44
|
+
specsBySlug.set(tab.slug, spec);
|
|
45
|
+
}
|
|
46
|
+
else if (tab.mcp) {
|
|
47
|
+
const { parse } = await import("mcp-parser");
|
|
48
|
+
const mcpSpec = await parse(tab.mcp);
|
|
49
|
+
const spec = normalizeMcpSpec(mcpSpec);
|
|
50
|
+
specsBySlug.set(tab.slug, spec);
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
// Primary spec for SpecContext on markdown pages
|
|
47
54
|
const primarySpec = specsBySlug.values().next().value ?? createMinimalSpec();
|
|
@@ -49,7 +56,7 @@ export async function buildSiteDocs(options = {}) {
|
|
|
49
56
|
const site = await buildSiteConfig(config);
|
|
50
57
|
// Process all tabs
|
|
51
58
|
for (const tab of tabs) {
|
|
52
|
-
if (tab.openapi) {
|
|
59
|
+
if (tab.openapi || tab.mcp) {
|
|
53
60
|
const spec = specsBySlug.get(tab.slug);
|
|
54
61
|
const navTab = buildNavFromSpec(spec, tab.slug);
|
|
55
62
|
navTab.label = tab.label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-builder.d.ts","sourceRoot":"","sources":["../../src/renderer/html-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAiB,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA0B5D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"html-builder.d.ts","sourceRoot":"","sources":["../../src/renderer/html-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAiB,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA0B5D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD,OAAO,CAAC,WAAW,CAAC,CA8CtB"}
|
|
@@ -60,6 +60,15 @@ export async function buildSite(pages, navigation, outputDir, site, options) {
|
|
|
60
60
|
if (options?.searchIndex) {
|
|
61
61
|
await writeFile(resolve(resolvedDir, "search-index.json"), options.searchIndex, "utf-8");
|
|
62
62
|
}
|
|
63
|
+
const urls = pages.map(p => ` <url><loc>${p.outputPath}</loc></url>`);
|
|
64
|
+
const sitemap = [
|
|
65
|
+
`<?xml version="1.0" encoding="UTF-8"?>`,
|
|
66
|
+
`<!-- Generated by Sourcey https://sourcey.com -->`,
|
|
67
|
+
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`,
|
|
68
|
+
...urls,
|
|
69
|
+
`</urlset>`,
|
|
70
|
+
].join("\n");
|
|
71
|
+
await writeFile(resolve(resolvedDir, "sitemap.xml"), sitemap, "utf-8");
|
|
63
72
|
return { htmlPath: resolve(resolvedDir, "index.html"), outputDir: resolvedDir };
|
|
64
73
|
}
|
|
65
74
|
/**
|