Skip to content

feat: introduce @lynx-js/docs-mcp-server#1925

Merged
colinaaa merged 2 commits intolynx-family:mainfrom
hzy:p/hzy/docs-mcp-server
Nov 8, 2025
Merged

feat: introduce @lynx-js/docs-mcp-server#1925
colinaaa merged 2 commits intolynx-family:mainfrom
hzy:p/hzy/docs-mcp-server

Conversation

@hzy
Copy link
Copy Markdown
Collaborator

@hzy hzy commented Nov 7, 2025

Summary by CodeRabbit

  • New Features

    • Added a new documentation MCP server that serves and indexes documentation resources through the Model Context Protocol, supporting integration with Claude Code, VS Code, Cursor, and other compatible clients.
  • Documentation

    • Added setup and integration guides for the new documentation server.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 7, 2025

🦋 Changeset detected

Latest commit: 654bea7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hzy hzy requested review from colinaaa and Copilot and removed request for Copilot November 7, 2025 15:05
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 7, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

A new MCP server package is introduced that serves Markdown documentation from a configurable base URL. The server extracts and registers internal links as MCP resources, enabling dynamic content fetching on demand. Supporting configuration files, documentation, and a changelog entry accompany the implementation.

Changes

Cohort / File(s) Change Summary
Changeset entry
.changeset/public-carrots-search.md
New changelog placeholder file added
MCP server implementation
packages/mcp-servers/docs-mcp-server/main.ts
New MCP server initializes with package version, fetches root Markdown from configurable base URL, parses and registers document links as MCP resources with dynamic content resolution, includes CLI with --base-url option
Project configuration
packages/mcp-servers/docs-mcp-server/package.json, packages/mcp-servers/docs-mcp-server/tsconfig.json
New package manifest for @lynx-js/docs-mcp-server with dependencies and build scripts; TypeScript configuration extending root config with dist output target
Documentation
packages/mcp-servers/docs-mcp-server/README.md
New README covering usage, MCP integration configuration, and multi-client setup instructions

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Review main.ts link extraction and filtering logic to ensure correct host matching and path normalization
  • Verify Markdown parsing and MCP resource registration properly handle edge cases
  • Confirm CLI option handling and default base URL configuration

Poem

🐰 A carrot-fueled server takes flight,
Fetching docs through the digital night!
Links dance like clover in markdown arrays,
Resources bloom in so many ways. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: introducing a new MCP server package @lynx-js/docs-mcp-server, which aligns perfectly with the changeset additions.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e8296d and 654bea7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/mcp-servers/docs-mcp-server/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-11-06T01:17:11.892Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/connector.ts:347-368
Timestamp: 2025-11-06T01:17:11.892Z
Learning: In the lynx-family/lynx-stack repository, for the devtool-mcp-server package, the getSource and getConsole methods intentionally throw errors when collectors don't exist (rather than returning empty arrays) to provide clear feedback to code agents and automation tools that something is wrong (e.g., debugger not enabled, collectors not initialized), enabling them to take corrective action.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
🔇 Additional comments (5)
packages/mcp-servers/docs-mcp-server/package.json (5)

6-9: Verify publishing of source TypeScript file.

Including main.ts in the published files (line 9) increases package size unnecessarily on the npm registry. Typically, only the compiled dist/ directory is published. Since publishConfig.bin correctly points to dist/main.js, the source file should not be needed for production consumption.

Consider whether this inclusion is intentional for monorepo development purposes or if it can be safely removed.


28-30: Verify Node.js version targeting below root project requirement.

The package targets node: ">=18.17", which is lower than the root project's ^22 || ^24 requirement. While a similar pattern exists in devtool-mcp-server (per prior learnings), confirm whether this is intentional. If supporting Node.js v18, verify whether any polyfills (e.g., Promise.withResolvers) are needed in the implementation, similar to the devtool-mcp-server approach noted in prior PRs.


3-3: Confirm initial version choice.

The package is versioned at 0.2.1 for a new package entry. Most packages start at 0.1.0 or 1.0.0. Verify whether this version reflects an intentional strategy (e.g., pre-release, versioning relative to related packages, or migration context).


14-22: Dependencies look reasonable.

The dependency set (MCP SDK, commander, debug, mdast utilities, undici) aligns well with the MCP server's purpose of serving Markdown documentation. The versions are stable and appropriate.


31-33: publishConfig correctly configured.

The publishConfig.bin remapping to dist/main.js ensures the compiled binary is used in production, which is correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI review requested due to automatic review settings November 7, 2025 15:06
@hzy hzy force-pushed the p/hzy/docs-mcp-server branch from 5c72897 to 76360c1 Compare November 7, 2025 15:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new MCP (Model Context Protocol) server package for serving Lynx documentation to LLMs. The server fetches and parses markdown documentation from the Lynx website, registers them as MCP resources, and makes them available to LLM clients through the stdio transport protocol.

  • Adds a new @lynx-js/docs-mcp-server package with dependencies for MCP SDK, markdown parsing, and HTTP fetching
  • Implements a CLI tool that fetches documentation from a configurable base URL and exposes it via MCP
  • Updates workspace configuration to include the new MCP servers packages

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds packages/mcp-servers/* to workspace packages
pnpm-lock.yaml Adds dependencies for MCP SDK, commander, debug, markdown utilities, and undici
packages/mcp-servers/docs-mcp-server/package.json Defines package metadata, scripts, and dependencies for the docs MCP server
packages/mcp-servers/docs-mcp-server/tsconfig.json TypeScript configuration for the MCP server package
packages/mcp-servers/docs-mcp-server/main.ts Main implementation of the MCP server CLI tool
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +10
"outDir": "dist",
},
"include": ["src", "main.ts"],
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma on line 8 in a JSON file will cause parse errors. JSON does not allow trailing commas before closing braces.

Suggested change
"outDir": "dist",
},
"include": ["src", "main.ts"],
"outDir": "dist"
},
"include": ["src", "main.ts"]

Copilot uses AI. Check for mistakes.
Comment on lines +134 to +135
// NOTE: This instruction for now is not supported by Codex's MCP support,
// see https://github.com/openai/codex/issues/6148
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references 'Codex', which appears to be incorrect. Based on the context of MCP (Model Context Protocol), this should likely reference 'Claude' or another LLM client, not OpenAI's Codex.

Suggested change
// NOTE: This instruction for now is not supported by Codex's MCP support,
// see https://github.com/openai/codex/issues/6148
// NOTE: This instruction is not currently supported by most MCP clients (e.g., Claude).
// See the relevant client documentation or issue trackers for updates.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 0% with 133 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/mcp-servers/docs-mcp-server/main.ts 0.00% 133 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
packages/mcp-servers/docs-mcp-server/main.ts (1)

134-135: Update MCP client reference from "Codex" to appropriate LLM client.

The comment incorrectly references "Codex" (OpenAI's old model). Based on the MCP protocol context, this should reference Claude or other supported LLM clients. This was flagged in a prior review but remains unaddressed.

-   // NOTE: This instruction for now is not supported by Codex's MCP support,
-   // see https://github.com/openai/codex/issues/6148
+   // NOTE: This instruction for now is not fully supported by all MCP clients.
+   // See the relevant client documentation for updates on supported features.
packages/mcp-servers/docs-mcp-server/tsconfig.json (1)

8-9: Fix JSON syntax error: trailing comma before closing brace.

JSON does not permit trailing commas. Line 8 has a trailing comma that will cause parsing errors during build and TypeScript compilation.

Apply this diff to fix the syntax error:

  "compilerOptions": {
    "allowImportingTsExtensions": false,
    "isolatedDeclarations": false,
    "emitDeclarationOnly": false,
    "types": ["node"],
-   "outDir": "dist",
+   "outDir": "dist"
  },
🧹 Nitpick comments (2)
packages/mcp-servers/docs-mcp-server/package.json (2)

17-17: Upgrade empathic to use caret range for consistency.

The empathic dependency is pinned to an exact version while all other dependencies use caret ranges. Adopt the same versioning pattern for consistency and to allow patch updates.

-   "empathic": "2.0.0",
+   "empathic": "^2.0.0",

14-14: Consider upgrading @modelcontextprotocol/sdk to the latest patch.

The latest version of @modelcontextprotocol/sdk is 1.20.1, which includes recent fixes. You're currently at 1.20.0. Consider updating to the latest patch version.

-   "@modelcontextprotocol/sdk": "^1.20.0",
+   "@modelcontextprotocol/sdk": "^1.20.1",
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb6d94 and 76360c1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/public-carrots-search.md (1 hunks)
  • packages/mcp-servers/docs-mcp-server/main.ts (1 hunks)
  • packages/mcp-servers/docs-mcp-server/package.json (1 hunks)
  • packages/mcp-servers/docs-mcp-server/tsconfig.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/public-carrots-search.md
🧠 Learnings (19)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/connector.ts:347-368
Timestamp: 2025-11-06T01:17:11.892Z
Learning: In the lynx-family/lynx-stack repository, for the devtool-mcp-server package, the getSource and getConsole methods intentionally throw errors when collectors don't exist (rather than returning empty arrays) to provide clear feedback to code agents and automation tools that something is wrong (e.g., debugger not enabled, collectors not initialized), enabling them to take corrective action.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/tsconfig.json
  • packages/mcp-servers/docs-mcp-server/package.json
  • pnpm-workspace.yaml
  • packages/mcp-servers/docs-mcp-server/main.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • .changeset/public-carrots-search.md
  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/public-carrots-search.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/public-carrots-search.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
  • pnpm-workspace.yaml
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-11-06T01:17:11.892Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/connector.ts:347-368
Timestamp: 2025-11-06T01:17:11.892Z
Learning: In the lynx-family/lynx-stack repository, for the devtool-mcp-server package, the getSource and getConsole methods intentionally throw errors when collectors don't exist (rather than returning empty arrays) to provide clear feedback to code agents and automation tools that something is wrong (e.g., debugger not enabled, collectors not initialized), enabling them to take corrective action.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
  • packages/mcp-servers/docs-mcp-server/main.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/mcp-servers/docs-mcp-server/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • pnpm-workspace.yaml
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • pnpm-workspace.yaml
🪛 LanguageTool
.changeset/public-carrots-search.md

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
pnpm-workspace.yaml (1)

6-6: Workspace configuration correctly updated.

The addition of packages/mcp-servers/* properly integrates new MCP server packages into the monorepo workspace, enabling dependency resolution and hoisting for all packages under that directory.

packages/mcp-servers/docs-mcp-server/package.json (1)

20-20: Verify undici version addresses known security vulnerabilities.

The version 6.22.0 should resolve CVE-2025-22150 (fixed in 6.21.1+), however please confirm the package.json dependency declaration is using the correct version and that no other undici-related vulnerabilities apply to this use case.

Comment on lines +1 to +3
---

---
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Changeset requires meaningful content for this public package.

An empty changeset is only appropriate for private packages. Since @lynx-js/docs-mcp-server is a new public package, the changeset should document the addition with a version bump and description. Based on learnings, public packages require meaningful changelog entries.

Add changeset content describing this new package:

---
-
+@lynx-js/docs-mcp-server: minor
---

+Introduce a new MCP server for providing Lynx documentation resources to LLM clients. The server fetches and registers Markdown documentation from a configurable base URL with automatic resource discovery and content resolution.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
---
---
@lynx-js/docs-mcp-server: minor
---
Introduce a new MCP server for providing Lynx documentation resources to LLM clients. The server fetches and registers Markdown documentation from a configurable base URL with automatic resource discovery and content resolution.
🧰 Tools
🪛 LanguageTool

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

🤖 Prompt for AI Agents
.changeset/public-carrots-search.md lines 1-3: the changeset file is empty which
is invalid for a new public package; update this file to include a meaningful
changeset entry that names the package @lynx-js/docs-mcp-server, specifies the
new version bump (e.g., minor or patch as appropriate), and includes a short
descriptive summary of the change (e.g., "add new public package
@lynx-js/docs-mcp-server: initial release — implements X and Y"), then save the
file so the changeset contains valid YAML/frontmatter and a description for the
changelog.

Comment on lines +109 to +118
async () => ({
contents: [
{
uri: `lynx-docs://${strippedUrl}`,
text: await fetch(link.url).then((res) => res.text()),
mimeType: 'text/markdown',
},
],
}),
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add error handling for content resolution fetch.

The dynamic content resolver on line 113 lacks error handling. If the fetch fails or the URL is inaccessible, the error will propagate unhandled and crash the MCP server. Wrap the fetch in a try-catch to provide graceful error handling.

    async () => ({
      contents: [
        {
          uri: `lynx-docs://${strippedUrl}`,
-         text: await fetch(link.url).then((res) => res.text()),
+         text: await fetch(link.url)
+           .then((res) => {
+             if (!res.ok) throw new Error(`HTTP ${res.status}: ${res.statusText}`);
+             return res.text();
+           })
+           .catch((error) => {
+             debug(`Failed to fetch ${link.url}:`, error);
+             throw new Error(`Cannot retrieve content for ${link.url}`);
+           }),
          mimeType: 'text/markdown',
        },
      ],
    }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async () => ({
contents: [
{
uri: `lynx-docs://${strippedUrl}`,
text: await fetch(link.url).then((res) => res.text()),
mimeType: 'text/markdown',
},
],
}),
);
async () => ({
contents: [
{
uri: `lynx-docs://${strippedUrl}`,
text: await fetch(link.url)
.then((res) => {
if (!res.ok) throw new Error(`HTTP ${res.status}: ${res.statusText}`);
return res.text();
})
.catch((error) => {
debug(`Failed to fetch ${link.url}:`, error);
throw new Error(`Cannot retrieve content for ${link.url}`);
}),
mimeType: 'text/markdown',
},
],
}),
🤖 Prompt for AI Agents
In packages/mcp-servers/docs-mcp-server/main.ts around lines 109 to 118, the
dynamic content resolver calls fetch(link.url) without error handling which can
propagate exceptions and crash the MCP server; wrap the await
fetch(...).then(res => res.text()) in a try-catch, log the error (using the
existing server logger or console.error), and return a safe fallback object with
the same shape (e.g., contents array with a placeholder text or empty string and
appropriate mimeType) so the resolver always resolves gracefully instead of
allowing the exception to bubble.

Comment on lines +122 to +124
async function main(baseUrl: string) {
const ROOT_DOC_URL = `${baseUrl}/llms.txt`;
const ROOT_DOC_MARKDOWN = await fetch(ROOT_DOC_URL).then((res) => res.text());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add error handling for root document fetch.

The root document fetch on line 124 lacks error handling. If the fetch fails or baseUrl/llms.txt is unreachable, the error will crash the server during startup.

async function main(baseUrl: string) {
  const ROOT_DOC_URL = `${baseUrl}/llms.txt`;
- const ROOT_DOC_MARKDOWN = await fetch(ROOT_DOC_URL).then((res) => res.text());
+ try {
+   const response = await fetch(ROOT_DOC_URL);
+   if (!response.ok) {
+     throw new Error(`Failed to fetch root doc: HTTP ${response.status}`);
+   }
+   const ROOT_DOC_MARKDOWN = await response.text();
+ } catch (error) {
+   debug(`Error fetching root documentation from ${ROOT_DOC_URL}:`, error);
+   throw error;
+ }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/mcp-servers/docs-mcp-server/main.ts around lines 122 to 124, the
fetch of the root document (ROOT_DOC_URL) has no error handling; wrap the fetch
and text extraction in a try/catch (or check response.ok) to handle network or
non-2xx responses, log the error with context, and fallback to a safe default
(e.g., empty string or cached content) so server startup does not crash; ensure
the function returns or continues safely when the root doc cannot be retrieved.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Nov 7, 2025

CodSpeed Performance Report

Merging #1925 will not alter performance

Comparing hzy:p/hzy/docs-mcp-server (654bea7) with main (3bc8903)

Summary

✅ 63 untouched
⏩ 3 skipped1

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Nov 7, 2025

React Example

#6153 Bundle Size — 234.35KiB (0%).

2e8296d(current) vs ebc1a60 main#6145(baseline)

Bundle metrics  Change 3 changes Improvement 1 improvement
                 Current
#6153
     Baseline
#6145
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 164(-0.61%) 165
Improvement  Duplicate Modules 66(-1.49%) 67
Change  Duplicate Code 46.71%(-0.15%) 46.78%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6153
     Baseline
#6145
No change  IMG 145.76KiB 145.76KiB
No change  Other 88.59KiB 88.59KiB

Bundle analysis reportBranch hzy:p/hzy/docs-mcp-serverProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Nov 7, 2025

Web Explorer

#6168 Bundle Size — 366.74KiB (0%).

654bea7(current) vs 3bc8903 main#6165(baseline)

Bundle metrics  Change 1 change
                 Current
#6168
     Baseline
#6165
No change  Initial JS 146.2KiB 146.2KiB
No change  Initial CSS 32.22KiB 32.22KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 219(-0.9%) 221
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.21% 3.21%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6168
     Baseline
#6165
No change  JS 240.72KiB 240.72KiB
No change  Other 93.8KiB 93.8KiB
No change  CSS 32.22KiB 32.22KiB

Bundle analysis reportBranch hzy:p/hzy/docs-mcp-serverProject dashboard


Generated by RelativeCIDocumentationReport issue

@hzy hzy force-pushed the p/hzy/docs-mcp-server branch from 76360c1 to 2e8296d Compare November 7, 2025 15:38
@colinaaa colinaaa merged commit 835e083 into lynx-family:main Nov 8, 2025
79 of 83 checks passed
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.

3 participants