A discovery bundle gives an MCP server the compiled documentation it needs to search pages and return Markdown. Export one when you want to embed MCP in your backend, use the Python adapter for MCP, or implement a server in another language.
When to export a discovery bundle
Export one when an MCP adapter will run separately from Shoalrun's built-in website host. The decision is about the hosting path, not the implementation language.
| Hosting path | Run shoalrun mcp export? |
|---|---|
Built-in shoalrun serve MCP endpoint |
No. Its website build already contains the selected MCP data. |
| Generated Vercel MCP function | No. Its deployment output already includes the selected MCP data. |
createMcpHandler in your own Node backend |
Yes. The embedding API opens the exported bundle. |
| Python MCP adapter or an independent discovery implementation | Yes. Give that implementation the exported bundle. |
| In-app HTML or Markdown through static delivery or Content REST | No. Create a content export for that interface. |
If you offer both MCP and in-app help, choose the inputs for each interface separately. Choose how to serve content covers the complete combinations.
What the bundle is for
The bundle separates building your documentation from serving it. Your build machine runs Shoalrun, selects the content, and exports the bundle. You deploy that bundle with a serving adapter, which exposes search and reading tools to clients.
For example, you can build with Node on one machine, then copy the bundle to a Python service. That service can answer search_docs and get_page requests without receiving your source repository or running the Shoalrun compiler. An independent discovery service can consume the same data without using MCP.
The bundle contains selected Markdown, document and section identities, search data, and a revision that identifies the content snapshot. The adapter supplies the running service; copying the files alone doesn't create an MCP endpoint. See choose how to serve content for hosting options.
For help drawers, onboarding screens, or other in-app UI, use a content export instead. It supplies passive HTML or Markdown for selected pages, approved standalone sections, and snippet instances. The discovery bundle supports documentation search and contextual reading; it uses a different contract from the in-app content manifest.
Export an existing build
Enable MCP for the intended publication, build the website, then export its scoped corpus. From a project with Shoalrun installed:
npx --no-install shoalrun build docs.config.yaml site-dist
npx --no-install shoalrun mcp export site-dist --out discovery-bundle
The command requires an MCP-enabled website build. It doesn't rebuild source or start a listener. The destination must be separate from the built site. It replaces a previous discovery export, but refuses unrelated nonempty directories.
The output contains discovery.json and its inventoried data files. Hostnames, origins, endpoint paths, and executable analytics modules aren't exported. Keep the bundle on your server; the public endpoints needn't expose the raw discovery directory.
Manifest fields
Use the package's schemas/discovery.schema.json for machine validation. The required fields describe one exact publication and revision.
| Field | Meaning |
|---|---|
schemaVersion |
1 for this contract. Reject unsupported versions. |
kind |
shoalrun-discovery. |
publication |
Exact channel, version, language, and optional product. Audience isn't a publication coordinate. |
revision |
SHA-256 of the canonical manifest with the top-level revision field omitted. |
documents |
Unique page IDs, titles, summaries, website URLs, Markdown references, and contextual sections. |
files |
Relative paths mapped to exact byte lengths, SHA-256 digests, and media types. |
search |
The portable search-document format and its inventoried JSON path. |
capabilities |
Contextual-section support and the portable lexical search profile. |
native |
Optional declarations for Shoalrun's Node indexes. Independent adapters can ignore them. |
Each Markdown reference has path, bytes, digest, and mediaType: text/markdown. A section records its ID, title, Markdown URL, parent digest, and whether the author declared it standalone. That metadata doesn't change the bytes of the compiled contextual section.
Integrity and compatibility
Canonical JSON is compact UTF-8 JSON. Sort object keys recursively by Unicode scalar value, preserve array order, and retain non-ASCII characters. Omit only the top-level revision field when calculating the revision. Counts are nonnegative integers within JavaScript's safe integer range. File hashes cover exact distributed bytes.
Reject invalid paths, missing referenced files, mismatched sizes or hashes, duplicate document IDs, and sections whose parent digest differs. Confine reads to the assigned inventory and directory, including when resolving symlinks. A missing resource mustn't trigger a read from a sibling bundle, source repository, or another publication.
Digests establish consistency with a trusted manifest; they don't authenticate its publisher. Verify the actual bytes read against the pinned revision. When replacing a deployment, open a new handler for the new bundle rather than reusing an old handler against changing files.
Bundle schema versions, MCP protocol versions, documentation versions, and package releases are separate. The package's generated TypeScript declarations describe openDiscoveryBundle and exportDiscoveryBundle under @shoalrun/cli/mcp/server.
Search profiles
search.format is shoalrun-search-documents-v1. Its JSON feed has schemaVersion: 1 and a documents array containing each selected page's id, title, summary, url, markdownUrl, and searchable text. The text matches the selected page's Markdown bytes. You can index this feed with your own search engine; ranking needn't match Node's optimized search.
The optional native declaration uses format: shoalrun-node-index-v1, with documents.json, search-index.json, and an optional searchTerms: search-terms.json. An inventoried term file isn't automatically an active index: the native reader uses it only when native.searchTerms declares it. Declared native indexes must match the selected document and publication inventory.
The Python reference reports conservative UTF-8 byte budgeting rather than claiming exact cl100k_base tokenizer counts. Compare the Python behavior before relying on identical output sizes or search ranking across runtimes.
HTML, Markdown, and agents
Discovery bundles contain Markdown and JSON, not a themed HTML website or executable browser modules. MCP adapters expose search, page, outline, section, and publication tools from those files. Contextual section reads retain their compiled parent context. Use a separately selected content export for passive in-app HTML or approved standalone sections.