wiki-formant 0.20.0 → 0.22.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 +84 -7
- package/dist/block-views.d.ts +8 -11
- package/dist/block-views.js +10 -8
- package/dist/blocks.d.ts +31 -1
- package/dist/blocks.js +66 -7
- package/dist/conformance.d.ts +13 -1
- package/dist/conformance.js +23 -1
- package/dist/corpus.d.ts +65 -0
- package/dist/corpus.js +82 -0
- package/dist/crawlers.d.ts +8 -1
- package/dist/crawlers.js +14 -1
- package/dist/editor.d.ts +5 -0
- package/dist/editor.js +24 -0
- package/dist/freshness.d.ts +14 -0
- package/dist/freshness.js +13 -0
- package/dist/headings.d.ts +7 -0
- package/dist/headings.js +15 -7
- package/dist/http.d.ts +28 -1
- package/dist/http.js +29 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/license.d.ts +9 -0
- package/dist/license.js +8 -0
- package/dist/link-check.d.ts +25 -0
- package/dist/link-check.js +56 -1
- package/dist/maps.d.ts +25 -2
- package/dist/maps.js +91 -5
- package/dist/mcp.d.ts +37 -0
- package/dist/mcp.js +61 -0
- package/dist/metadata.d.ts +69 -0
- package/dist/metadata.js +45 -0
- package/dist/react-server.d.ts +21 -1
- package/dist/react-server.js +43 -13
- package/dist/react.d.ts +12 -2
- package/dist/react.js +31 -0
- package/dist/revisions.d.ts +7 -3
- package/dist/revisions.js +5 -3
- package/dist/sanitize.d.ts +44 -0
- package/dist/sanitize.js +191 -0
- package/dist/search.d.ts +20 -0
- package/dist/search.js +22 -0
- package/dist/text.d.ts +18 -1
- package/dist/text.js +30 -0
- package/dist/tiptap.d.ts +14 -1
- package/dist/tiptap.js +41 -1
- package/dist/validation.d.ts +19 -1
- package/dist/validation.js +82 -28
- package/dist/well-known.d.ts +47 -8
- package/dist/well-known.js +58 -2
- package/package.json +24 -2
package/dist/well-known.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { License } from './license.js';
|
|
1
2
|
export interface RegistryAuthRecord {
|
|
2
3
|
body: string;
|
|
3
4
|
contentType: string;
|
|
@@ -48,13 +49,6 @@ export interface SkillSource {
|
|
|
48
49
|
* capability the server does not have. `search_pages` becomes "Search Pages".
|
|
49
50
|
*/
|
|
50
51
|
export declare function skillsFromTools(tools: readonly SkillSource[]): AgentSkill[];
|
|
51
|
-
export interface AgentCardLicense {
|
|
52
|
-
name: string;
|
|
53
|
-
url: string;
|
|
54
|
-
spdx?: string;
|
|
55
|
-
/** What the licence covers, e.g. `'content'`. */
|
|
56
|
-
scope?: string;
|
|
57
|
-
}
|
|
58
52
|
export interface AgentCardConfig {
|
|
59
53
|
name: string;
|
|
60
54
|
description: string;
|
|
@@ -62,7 +56,10 @@ export interface AgentCardConfig {
|
|
|
62
56
|
url: string;
|
|
63
57
|
version: string;
|
|
64
58
|
skills: AgentSkill[];
|
|
65
|
-
|
|
59
|
+
/** The grant, as `ccBy40()` builds it. Projected once here, not per repo. */
|
|
60
|
+
license?: License;
|
|
61
|
+
/** What the grant covers, e.g. `'content'`, or which half of the site. */
|
|
62
|
+
licenseScope?: string;
|
|
66
63
|
/** Defaults to `name`. */
|
|
67
64
|
organization?: string;
|
|
68
65
|
/** Defaults to `${url}/llms.txt`. */
|
|
@@ -127,3 +124,45 @@ protocolVersions: readonly string[]): Record<string, unknown>;
|
|
|
127
124
|
* configured" instead of failing verification for a reason nobody sees.
|
|
128
125
|
*/
|
|
129
126
|
export declare function registryAuthHandler(publicKey?: string | undefined, keyType?: string | undefined): () => Response;
|
|
127
|
+
/** A tool as `/.well-known/mcp.json` lists it: what tools/list says, no handler. */
|
|
128
|
+
export interface ManifestTool {
|
|
129
|
+
name: string;
|
|
130
|
+
title?: string;
|
|
131
|
+
description: string;
|
|
132
|
+
inputSchema: unknown;
|
|
133
|
+
annotations?: unknown;
|
|
134
|
+
}
|
|
135
|
+
export interface McpManifestConfig {
|
|
136
|
+
/** The server's display name. */
|
|
137
|
+
name: string;
|
|
138
|
+
/** Its registry name, from server.json. */
|
|
139
|
+
registryName: string;
|
|
140
|
+
version: string;
|
|
141
|
+
description: string;
|
|
142
|
+
/** Origin, no trailing slash. */
|
|
143
|
+
url: string;
|
|
144
|
+
/** Who runs it. Defaults to `name`. */
|
|
145
|
+
provider?: string;
|
|
146
|
+
tools: readonly ManifestTool[];
|
|
147
|
+
/** Auth notes, per-tenant endpoints, payment terms — what this origin has that others do not. */
|
|
148
|
+
extra?: Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* `/.well-known/mcp.json`: the third path an arriving agent probes, after the
|
|
152
|
+
* agent card and the OpenAPI spec. All three origins wrote the same envelope,
|
|
153
|
+
* and one had already dropped the tool titles the other two listed. The
|
|
154
|
+
* protocol versions and the rate limit come from the transport that answers,
|
|
155
|
+
* so the manifest cannot advertise a version the server does not speak.
|
|
156
|
+
*/
|
|
157
|
+
export declare function mcpManifest(config: McpManifestConfig): Record<string, unknown>;
|
|
158
|
+
/**
|
|
159
|
+
* A GET handler serving a descriptor built from code: ETag, 304, freshness.
|
|
160
|
+
* The agent cards, the manifest and the server card were each a three-line
|
|
161
|
+
* route around `descriptorResponse`, written out nine times.
|
|
162
|
+
*/
|
|
163
|
+
export declare function descriptorHandler(body: unknown, opts?: {
|
|
164
|
+
maxAge?: number;
|
|
165
|
+
extra?: Record<string, string>;
|
|
166
|
+
}): (request: Request) => Response;
|
|
167
|
+
/** The whole `<mcp-url>/server-card` route, projected from server.json. */
|
|
168
|
+
export declare const serverCardHandler: (manifest: ServerManifest) => ((request: Request) => Response);
|
package/dist/well-known.js
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
// Nothing here touches a framework: these return plain values, and the caller
|
|
10
10
|
// wraps them in whatever its router wants. That keeps this package free of a
|
|
11
11
|
// Next dependency and keeps each app's route a two-liner.
|
|
12
|
+
import { MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSIONS } from './mcp.js';
|
|
13
|
+
import { MCP_RATE_LIMIT_TEXT } from './rate-limit.js';
|
|
14
|
+
import { descriptorResponse } from './http.js';
|
|
12
15
|
/**
|
|
13
16
|
* The `v=MCPv1` record the official MCP registry fetches from
|
|
14
17
|
* `/.well-known/mcp-registry-auth` to prove domain ownership. `mcp-publisher
|
|
@@ -70,7 +73,7 @@ const A2A_PROTOCOL_VERSION = '0.3.0';
|
|
|
70
73
|
* means half the callers conclude the origin has no agent at all.
|
|
71
74
|
*/
|
|
72
75
|
export function agentCard(config) {
|
|
73
|
-
const { name, description, url, version, skills, license, organization, documentationUrl, mcpEndpoint, extra } = config;
|
|
76
|
+
const { name, description, url, version, skills, license, licenseScope, organization, documentationUrl, mcpEndpoint, extra } = config;
|
|
74
77
|
const endpoint = mcpEndpoint === null ? url : (mcpEndpoint ?? `${url}/api/mcp`);
|
|
75
78
|
return {
|
|
76
79
|
protocolVersion: A2A_PROTOCOL_VERSION,
|
|
@@ -89,7 +92,14 @@ export function agentCard(config) {
|
|
|
89
92
|
provider: { organization: organization ?? name, url },
|
|
90
93
|
documentationUrl: documentationUrl ?? `${url}/llms.txt`,
|
|
91
94
|
...(mcpEndpoint === null ? {} : { mcpEndpoint: endpoint }),
|
|
92
|
-
|
|
95
|
+
// The same two discovery URLs on every card. The three cards here named the
|
|
96
|
+
// spec `apiSpecUrl`, `apiSpecUrl` and `openapiUrl`, and one omitted the
|
|
97
|
+
// server card, so a client reading one card could not read the next.
|
|
98
|
+
apiSpecUrl: `${url}/.well-known/openapi.json`,
|
|
99
|
+
...(mcpEndpoint === null ? {} : { mcpServerCard: `${endpoint}/server-card` }),
|
|
100
|
+
...(license
|
|
101
|
+
? { license: { name: license.name, spdx: license.spdx, url: license.url, ...(licenseScope ? { scope: licenseScope } : {}) } }
|
|
102
|
+
: {}),
|
|
93
103
|
...extra,
|
|
94
104
|
defaultInputModes: ['text/plain', 'application/json'],
|
|
95
105
|
defaultOutputModes: ['text/plain', 'application/json', 'text/markdown'],
|
|
@@ -155,3 +165,49 @@ export function registryAuthHandler(publicKey = process.env.MCP_REGISTRY_PUBLIC_
|
|
|
155
165
|
});
|
|
156
166
|
};
|
|
157
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* `/.well-known/mcp.json`: the third path an arriving agent probes, after the
|
|
170
|
+
* agent card and the OpenAPI spec. All three origins wrote the same envelope,
|
|
171
|
+
* and one had already dropped the tool titles the other two listed. The
|
|
172
|
+
* protocol versions and the rate limit come from the transport that answers,
|
|
173
|
+
* so the manifest cannot advertise a version the server does not speak.
|
|
174
|
+
*/
|
|
175
|
+
export function mcpManifest(config) {
|
|
176
|
+
const { name, registryName, version, description, url, provider, tools, extra } = config;
|
|
177
|
+
return {
|
|
178
|
+
schema_version: '1.0',
|
|
179
|
+
name,
|
|
180
|
+
registryName,
|
|
181
|
+
version,
|
|
182
|
+
description,
|
|
183
|
+
url,
|
|
184
|
+
provider: { name: provider ?? name, url },
|
|
185
|
+
api: { type: 'openapi', url: `${url}/.well-known/openapi.json` },
|
|
186
|
+
mcp: {
|
|
187
|
+
endpoint: `${url}/api/mcp`,
|
|
188
|
+
transport: 'streamable-http',
|
|
189
|
+
protocol: 'JSON-RPC 2.0',
|
|
190
|
+
protocolVersion: MCP_PROTOCOL_VERSION,
|
|
191
|
+
supportedProtocolVersions: MCP_PROTOCOL_VERSIONS,
|
|
192
|
+
rateLimit: MCP_RATE_LIMIT_TEXT,
|
|
193
|
+
},
|
|
194
|
+
...extra,
|
|
195
|
+
tools: tools.map(({ name, title, description, inputSchema, annotations }) => ({
|
|
196
|
+
name,
|
|
197
|
+
...(title ? { title } : {}),
|
|
198
|
+
description,
|
|
199
|
+
inputSchema,
|
|
200
|
+
...(annotations ? { annotations } : {}),
|
|
201
|
+
})),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A GET handler serving a descriptor built from code: ETag, 304, freshness.
|
|
206
|
+
* The agent cards, the manifest and the server card were each a three-line
|
|
207
|
+
* route around `descriptorResponse`, written out nine times.
|
|
208
|
+
*/
|
|
209
|
+
export function descriptorHandler(body, opts = {}) {
|
|
210
|
+
return request => descriptorResponse(request, body, opts);
|
|
211
|
+
}
|
|
212
|
+
/** The whole `<mcp-url>/server-card` route, projected from server.json. */
|
|
213
|
+
export const serverCardHandler = (manifest) => descriptorHandler(serverCard(manifest, MCP_PROTOCOL_VERSIONS));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-formant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "The portable half of a wiki: derived taxonomy and facet controls, a version-negotiating MCP transport, markdown twins, block rendering, a rich-text editor engine, and conditional-GET plumbing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -159,6 +159,18 @@
|
|
|
159
159
|
"./seeded": {
|
|
160
160
|
"types": "./dist/seeded.d.ts",
|
|
161
161
|
"import": "./dist/seeded.js"
|
|
162
|
+
},
|
|
163
|
+
"./sanitize": {
|
|
164
|
+
"types": "./dist/sanitize.d.ts",
|
|
165
|
+
"import": "./dist/sanitize.js"
|
|
166
|
+
},
|
|
167
|
+
"./corpus": {
|
|
168
|
+
"types": "./dist/corpus.d.ts",
|
|
169
|
+
"import": "./dist/corpus.js"
|
|
170
|
+
},
|
|
171
|
+
"./metadata": {
|
|
172
|
+
"types": "./dist/metadata.d.ts",
|
|
173
|
+
"import": "./dist/metadata.js"
|
|
162
174
|
}
|
|
163
175
|
},
|
|
164
176
|
"bin": {
|
|
@@ -192,9 +204,11 @@
|
|
|
192
204
|
"@tiptap/starter-kit": "^2.27.3",
|
|
193
205
|
"@types/node": "^22.0.0",
|
|
194
206
|
"@types/react": "^19.0.0",
|
|
207
|
+
"@types/sanitize-html": "^2.16.1",
|
|
195
208
|
"jose": "^6.2.10",
|
|
196
209
|
"jsdom": "^30.1.0",
|
|
197
210
|
"react": "^19.2.4",
|
|
211
|
+
"sanitize-html": "^2.17.7",
|
|
198
212
|
"typescript": "^5.9.0"
|
|
199
213
|
},
|
|
200
214
|
"peerDependencies": {
|
|
@@ -212,7 +226,9 @@
|
|
|
212
226
|
"@tiptap/react": ">=2.10",
|
|
213
227
|
"@tiptap/starter-kit": ">=2.10",
|
|
214
228
|
"jose": ">=5",
|
|
215
|
-
"react": ">=18"
|
|
229
|
+
"react": ">=18",
|
|
230
|
+
"sanitize-html": ">=2",
|
|
231
|
+
"@tiptap/pm": ">=2.10"
|
|
216
232
|
},
|
|
217
233
|
"peerDependenciesMeta": {
|
|
218
234
|
"react": {
|
|
@@ -259,6 +275,12 @@
|
|
|
259
275
|
},
|
|
260
276
|
"@tiptap/extension-placeholder": {
|
|
261
277
|
"optional": true
|
|
278
|
+
},
|
|
279
|
+
"sanitize-html": {
|
|
280
|
+
"optional": true
|
|
281
|
+
},
|
|
282
|
+
"@tiptap/pm": {
|
|
283
|
+
"optional": true
|
|
262
284
|
}
|
|
263
285
|
}
|
|
264
286
|
}
|