@vercel/geistdocs 2.4.2 → 2.6.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/dist/cli/index.js +1 -1
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -0
- package/dist/internal/chat/context.d.ts +1 -0
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +1 -0
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +32 -10
- package/dist/internal/eve-agent-session.d.ts +12 -0
- package/dist/internal/eve-agent-session.d.ts.map +1 -0
- package/dist/internal/eve-agent-session.js +26 -0
- package/dist/internal/eve-agent.d.ts +9 -5
- package/dist/internal/eve-agent.d.ts.map +1 -1
- package/dist/internal/eve-agent.js +63 -15
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +68 -1
- package/dist/internal/provider-client.d.ts +13 -1
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +1 -1
- package/dist/internal/search.d.ts +23 -1
- package/dist/internal/search.d.ts.map +1 -1
- package/dist/internal/search.js +19 -4
- package/dist/internal/webmcp-client.d.ts +3 -4
- package/dist/internal/webmcp-client.d.ts.map +1 -1
- package/dist/internal/webmcp-client.js +9 -12
- package/dist/internal/webmcp.d.ts +2 -6
- package/dist/internal/webmcp.d.ts.map +1 -1
- package/dist/internal/webmcp.js +28 -79
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +10 -2
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +2 -0
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +51 -13
- package/dist/routes/discovery.d.ts +3 -2
- package/dist/routes/discovery.d.ts.map +1 -1
- package/dist/routes/discovery.js +49 -1
- package/dist/routes/mcp.d.ts +7 -2
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +101 -1
- package/dist/routes/openapi.d.ts +64 -0
- package/dist/routes/openapi.d.ts.map +1 -0
- package/dist/routes/openapi.js +481 -0
- package/docs/agents.md +1 -1
- package/docs/llms.txt +95 -29
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +30 -0
- package/docs/pages/ask-ai.md +6 -1
- package/docs/pages/configuration.md +7 -1
- package/docs/pages/migration.md +1 -0
- package/docs/pages/provider.md +23 -0
- package/docs/pages/webmcp.md +27 -26
- package/package.json +9 -3
- package/template/AGENTS.md +2 -2
- package/template/app/[lang]/openapi.json/route.ts +6 -0
- package/template/app/api/mcp/route.ts +7 -0
- package/template/content/docs/agent-readiness.mdx +30 -0
- package/template/content/docs/ask-ai.mdx +6 -1
- package/template/content/docs/configuration.mdx +7 -1
- package/template/content/docs/migration.mdx +1 -0
- package/template/content/docs/provider.mdx +23 -0
- package/template/content/docs/webmcp.mdx +27 -26
- package/template/geistdocs.tsx +3 -0
- package/template/lib/geistdocs/config.tsx +1 -0
- package/template/package.json +1 -1
|
@@ -61,6 +61,29 @@ Pass the scope here rather than reading a header or a cookie in the route. The s
|
|
|
61
61
|
`createSearchRoute` indexes pages without a `tag` field, and tagged queries match with `containsAll`, so a tag passed to the built-in route matches nothing.
|
|
62
62
|
</Callout>
|
|
63
63
|
|
|
64
|
+
### Let readers change the scope
|
|
65
|
+
|
|
66
|
+
`tag` alone fixes the scope: it follows the page and a reader cannot override it. Pass `tags` as well to render the alternatives as pills under the results:
|
|
67
|
+
|
|
68
|
+
```tsx title="app/layout.tsx"
|
|
69
|
+
<GeistdocsProvider
|
|
70
|
+
config={config}
|
|
71
|
+
search={{
|
|
72
|
+
options: {
|
|
73
|
+
tag: "v5",
|
|
74
|
+
tags: [
|
|
75
|
+
{ name: "v4", value: "v4" },
|
|
76
|
+
{ name: "v5", value: "v5" },
|
|
77
|
+
],
|
|
78
|
+
allowClear: true,
|
|
79
|
+
onTagChange: (value) => persist(value),
|
|
80
|
+
},
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The selection starts at `tag` and follows it when the page changes, so navigating still re-scopes the dialog. `allowClear` adds a pill that searches everything, and `onTagChange` reports each pick for sites that remember it across sessions.
|
|
86
|
+
|
|
64
87
|
## AI Sidebar
|
|
65
88
|
|
|
66
89
|
When users open the AI chat on desktop, the provider automatically adds padding to prevent content from being hidden behind the sidebar. On mobile, the chat opens as a drawer instead, so no padding is needed.
|
|
@@ -3,52 +3,53 @@ title: WebMCP
|
|
|
3
3
|
description: Expose documentation search and page reading to browser agents.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Geistdocs
|
|
6
|
+
Geistdocs uses [mcp-handler's WebMCP bridge](https://github.com/vercel/mcp-handler/blob/main/docs/WEBMCP.md) for search and a browser-local tool for reading the current page. Enable `webmcp: { enabled: true }` in `lib/geistdocs/config.tsx` and add `app/api/mcp/route.ts`:
|
|
7
7
|
|
|
8
8
|
```ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { createMcpRoute } from "@vercel/geistdocs/routes/mcp";
|
|
10
|
+
import { config } from "@/lib/geistdocs/config";
|
|
11
|
+
import { GET as search } from "../search/route";
|
|
12
|
+
|
|
13
|
+
const handler = createMcpRoute({ config, search });
|
|
14
|
+
|
|
15
|
+
export { handler as GET, handler as POST };
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
The
|
|
18
|
+
The canonical template includes this setup. Existing consumers must add the route themselves: `geistdocs update` does not overwrite local adapters. There is no fallback to the old browser search transport.
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
16
21
|
|
|
17
22
|
| Tool | Input | Result |
|
|
18
23
|
| --- | --- | --- |
|
|
19
|
-
| `search_docs` | `query
|
|
20
|
-
| `read_current_page` | None |
|
|
24
|
+
| `search_docs` | Nonblank `query` up to 500 characters; optional configured `locale` | MCP result containing search results as JSON text |
|
|
25
|
+
| `read_current_page` | None | Current page as Markdown |
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
The provider loads `/api/mcp?webmcp-script` once through `next/script`. The script discovers the MCP server's tools and registers only `search_docs`. Do not add another copy of the script or register search yourself. Remote MCP clients connect to `/api/mcp` directly. Geistdocs prefixes public paths with `basePath`.
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
Search calls the supplied search handler directly, retaining its visibility filters and request headers/cookies without another network hop. Pass `locale` explicitly for translated results; omitting it selects `defaultLanguage`, even after navigating to another language. Neither tool modifies documentation or sends it to an external model.
|
|
25
30
|
|
|
26
|
-
##
|
|
31
|
+
## Lifecycle and safety
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
Search follows the upstream bridge contract: MCP result envelopes are returned unchanged, including `isError`; browser-provided cancellation reaches fetch, but there is no additional request deadline. The bridge preserves `readOnlyHint` but does not emit WebMCP's explicit `untrustedContentHint`. Search results are still untrusted documentation, not agent instructions.
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
const tools = await document.modelContext.getTools();
|
|
32
|
-
const search = tools.find((tool) => tool.name === "search_docs");
|
|
33
|
-
await document.modelContext.executeTool(search, JSON.stringify({ query: "configuration" }));
|
|
34
|
-
const read = tools.find((tool) => tool.name === "read_current_page");
|
|
35
|
-
await document.modelContext.executeTool(read, "{}");
|
|
36
|
-
```
|
|
35
|
+
Search registration lasts for the document and is not tied to React unmounts. Reload after changing feature configuration. With `webmcp.enabled` disabled, the endpoint returns 404 and new documents do not load the bridge. Unsupported browsers continue to work normally.
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
`read_current_page` remains browser-local: it reads the live URL without its query or fragment, requires a Markdown response, and retains its 15-second timeout, cancellation, untrusted-content hint and registration cleanup.
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
For protected documentation, authorize the MCP route and supplied search handler. Direct handler reuse does not execute middleware scoped only to `/api/search`. Cross-origin cookie requests are rejected; protocol responses use `Cache-Control: no-store`. Tool allowlists and read-only annotations are not authorization. Never put tokens in client config.
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
The remote discovery manifest remains independent; configured external servers are not replaced.
|
|
42
|
+
|
|
43
|
+
## Verify locally
|
|
44
|
+
|
|
45
|
+
Use a compatible browser with WebMCP enabled. With agent-browser 0.36.0 or newer:
|
|
43
46
|
|
|
44
47
|
```bash
|
|
45
48
|
agent-browser --session docs-check open http://localhost:3000/docs
|
|
46
49
|
agent-browser --session docs-check webmcp list
|
|
47
|
-
agent-browser --session docs-check webmcp invoke search_docs --params '{"query":"configuration"}'
|
|
50
|
+
agent-browser --session docs-check webmcp invoke search_docs --params '{"query":"configuration","locale":"en"}'
|
|
48
51
|
agent-browser --session docs-check webmcp invoke read_current_page --params '{}'
|
|
49
52
|
agent-browser --session docs-check close
|
|
50
53
|
```
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Both tools limit network requests to 15 seconds. When the browser supplies an execution signal, cancellation also aborts the request. Some experimental browser versions, including Chrome 152, omit that signal: canceling an invocation in those versions does not immediately abort its underlying fetch, which remains bounded by the request deadline.
|
|
55
|
+
Check the invocation's `status` and the search result's `isError`, not just command delivery. Navigate to another page and confirm reading follows the new URL; switch language and search with an explicit locale. Repeat under a configured base path. Disable the feature and reload to verify registration and endpoint opt-out.
|
package/template/geistdocs.tsx
CHANGED
|
@@ -27,6 +27,7 @@ export const config = defineConfig({
|
|
|
27
27
|
siteId,
|
|
28
28
|
siteUrl: isSiteUrlConfigured ? siteUrl.toString() : undefined,
|
|
29
29
|
translations,
|
|
30
|
+
webmcp: { enabled: true },
|
|
30
31
|
content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
|
|
31
32
|
ai: {
|
|
32
33
|
prompt,
|
package/template/package.json
CHANGED