Skip to content

Fix mcp-hub to serve built docs metadata#4396

Open
NathanFlurry wants to merge 1 commit intomainfrom
docs-mcp-server-plan
Open

Fix mcp-hub to serve built docs metadata#4396
NathanFlurry wants to merge 1 commit intomainfrom
docs-mcp-server-plan

Conversation

@NathanFlurry
Copy link
Member

Description

Replace the mcp-hub sample corpus path with the real website metadata build output, simplify the Docker image to build the website directly, and remove the fake semantic/hybrid search modes from docs.search. This also updates metadata heading slug generation to match the website so the MCP server can load the real docs corpus without duplicate resource IDs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Ran pnpm install --no-frozen-lockfile, SKIP_TYPECHECK_CODE_BLOCKS=1 pnpm --filter rivet-website run build, pnpm --filter @rivetkit/mcp-hub test, pnpm --filter @rivetkit/mcp-hub run build, a local MCP initialize/search smoke test against the built docs corpus, and docker build -f rivetkit-typescript/packages/mcp-hub/Dockerfile ..

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link

railway-app bot commented Mar 10, 2026

🚅 Deployed to the rivet-pr-4396 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-inspector 😴 Sleeping (View Logs) Web Mar 10, 2026 at 6:08 pm
mcp-hub ❌ Build Failed (View Logs) Web Mar 10, 2026 at 6:02 pm
ladle ❌ Build Failed (View Logs) Web Mar 10, 2026 at 6:01 pm
frontend-cloud ❌ Build Failed (View Logs) Web Mar 10, 2026 at 5:59 pm
website ❌ Build Failed (View Logs) Web Mar 10, 2026 at 5:58 pm

@claude
Copy link

claude bot commented Mar 10, 2026

PR Review: Fix mcp-hub to serve built docs metadata

Overall this is a clean, well-motivated fix. The core change — replacing the fake static corpus and the brittle workspace-import fallback with the real Astro-built output — is the right direction. A few things to flag:

Indentation Drift

Several files have inconsistent indentation that looks like a merge/rebase artifact:

search.ts (lines 125–133): The const paged = ... block and its return are indented one extra level relative to the surrounding code inside the search method. The closing }, for the search method is also off, making the object literal look malformed. While TypeScript will still parse this correctly, it's inconsistent with the rest of the file.

search.test.ts: Multiple test blocks now have const engine = createSearchEngine(...) and engine.search(...) indented deeper than the expect(...) assertions that follow them. For example:

        const engine = createSearchEngine(metadata);   // extra indent
        const results = engine.search("", { ... });    // extra indent
    expect(results.results).toHaveLength(0);            // less indent

This looks like a rebase conflict artifact.

index.ts (around line 193): The structuredContent block is indented one level deeper than the text entry in the same array.

These are cosmetic but they will likely trip up auto-formatters and make future diffs noisy.


Docker Production Stage: npm install After pnpm Build

COPY --from=builder /app/rivetkit-typescript/packages/mcp-hub/package.json ./package.json
RUN npm install --omit=dev

The production stage re-runs npm install from scratch using only the mcp-hub package.json. Since the two production dependencies (@modelcontextprotocol/sdk, zod) are plain npm packages this will work, but it means two separate installs happen during the build. An alternative is to copy the already-resolved node_modules from the builder for just these packages, which would be faster and more deterministic:

COPY --from=builder /app/rivetkit-typescript/packages/mcp-hub/node_modules ./node_modules

Not a blocker, but worth noting for image build time.


resolveDocsMetadataPath URL Relativity

const workspacePath = fileURLToPath(
    new URL("../../../../website/dist/metadata/docs.json", import.meta.url),
);

This path is correct when the built output is at dist/index.js (4 levels up: dist/mcp-hub/packages/rivetkit-typescript/ → repo root). It will silently break if the output directory ever changes. The serve script similarly uses a relative path. Both are fine for now but fragile — a comment explaining the assumed layout would help future maintainers.


slugifyWithCounter Scoping

extractHeadings and ensureHeadings each create their own slugifyWithCounter() instance. Since ensureHeadings is only called when extractHeadings returns empty, the two instances never run on the same document, so there's no duplicate-slug collision risk. The logic is correct; just noting it's non-obvious at first glance.


Minor: Missing blank line in search.ts

matchesFilters immediately follows the closing brace of createSearchEngine on line 142 with no blank line between them. Worth adding for readability.


Deleted data/docs.json Had rivet.gg URLs

The removed fake corpus used "canonical_url": "https://rivet.gg/docs/...". Good catch removing it — it would have caused tests to assert against stale domain names.


Summary: The core change is solid and the simplification is warranted. The indentation issues in search.ts and search.test.ts are the most important to clean up before merge since they suggest the diff wasn't cleanly applied in those areas.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 10, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4396

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4396

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4396

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4396

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4396

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4396

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4396

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4396

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4396

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4396

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4396

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4396

commit: d25f4dd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant