Skip to content

feat(lspmesh): LSP aggregator + MCP server (packages/ai/lspmesh)#2036

Merged
filiphsps merged 26 commits into
masterfrom
feat/lspmesh
Jun 16, 2026
Merged

feat(lspmesh): LSP aggregator + MCP server (packages/ai/lspmesh)#2036
filiphsps merged 26 commits into
masterfrom
feat/lspmesh

Conversation

@filiphsps

Copy link
Copy Markdown
Owner

Migrates .claude/mcp/lsp-symbols.mjs into lspmesh — a published TypeScript package at packages/ai/lspmesh: a dual-protocol LSP aggregator that fronts multiple language servers (TypeScript + Tailwind + Biome) behind one endpoint, plus by-name MCP search tools.

Spec/plan: .specs/2026-06-16-lspmesh-lsp-aggregator/.

What it is

  • One bin, two modes, shared enginelspmesh lsp (LSP server, Claude Code op set) and lspmesh mcp (MCP server). util.parseArgs.
  • Aggregation — routes each request to every backend whose extension map matches the file and merges per-op; workspace/symbol seeds via git grep + polls until tsserver indexes; find_symbol/find_references/find_implementations union over every definition, tagged with definedAt.
  • Config-driven backends (typescript + tailwind + biome), no bundled servers.
  • Built on @modelcontextprotocol/sdk + vscode-jsonrpc/vscode-languageserver. TS-only, @/ path aliases, version injected from package.json.

Carry-over hardening (from lsp-symbols)

Request timeouts, dead-backend respawn, mtime-aware didChange, seed ordering + basename boost, definition-shaped ranking, multi-definition union.

Tests

  • 42 unit tests + 4 real-backend integration tests (typescript+tailwind+biome against a fixture, plus a parity check vs the old lsp-symbols on this repo). Integration surfaced and fixed 3 real bugs (missing poll loop, fixture-needs-typescript, unhandled rejections).

Packaging / consolidation

  • npm name reserved (lspmesh@0.0.0 stub); changeset bumps to 0.0.1 via the existing OIDC trusted-publishing release.yml.
  • Claude marketplace plugin added; docs site integrated (new "AI" category + TypeDoc API ref).
  • Commerce consolidated onto lspmesh (runs from the local dist for LSP+MCP); typescript-lsp + tailwind-lsp-adapter plugins disabled; lsp-symbols.mjs removed; CLAUDE.md updated.

Gates (all green)

lint · typecheck · 42 unit · build:packages · integration 4/4 · docs:gen:check.

Follow-up (owner)

  • Configure the npm Trusted Publisher for lspmesh (repo + release.yml) before the 0.0.1 release. (done per author)

filiphsps added 24 commits June 16, 2026 10:20
…ses.

The bin parses argv with node:util parseArgs (built-in; extensible for future flags) into lsp or mcp modes plus a --root override, --help, and --version. Internal imports now use @/ path aliases (wired in tsconfig + vite/vitest) instead of relative .js specifiers, and the version constant is centralized in version.ts.
…ey surfaced.

Integration suite spawns the real typescript, tailwind, and biome backends against a fixture workspace (typescript symlinked in, since typescript-language-server requires it in the workspace) plus a parity check against the commerce repo, with a dedicated vitest config so unit runs stay fast. Fixes found by running them: workspaceSymbol now polls until the seeded tsserver project finishes indexing (it returned empty otherwise); request() and a respawned client's initialize no longer leak unhandled rejections when a backend is disposed mid-flight; and registry.init now logs a backend that fails to start instead of failing silently. The fixture workspace is excluded from the repo's biome via biome.json.
…I category.

Ships the package's own overview + configuration guides (mirrored into the site), adds an "AI" category to _categories.json keyed ai/lspmesh, and points package.json homepage at the generated docs page like the other public packages. tsconfig.typedoc maps the @/ alias so TypeDoc resolves lspmesh's imports and emits its API reference.
…ymbols + the ts/tailwind LSP plugins.

Commerce now runs lspmesh from the workspace dist build for both LSP and MCP: the lspmesh@commerce-plugins plugin is enabled and typescript-lsp + tailwind-lsp-adapter are disabled (lspmesh fronts all three backends), and the old lsp-symbols.mjs MCP server is deleted. CLAUDE.md points at lspmesh. Gated on the parity integration test, which matches the old lsp-symbols behavior on this repo.
… from package.json.

package.json sits at the published 0.0.0 so the changeset bumps it to 0.0.1 on release; the version is injected into the build from package.json so --version and the MCP server version never drift. release.yml already publishes via npm OIDC trusted publishing (no token), so only the npmjs.com trusted-publisher setup for lspmesh remains.
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 83.89% (🎯 65%) 10506 / 12523
🔵 Statements 82.57% (🎯 60%) 11514 / 13943
🔵 Functions 82.29% (🎯 75%) 2808 / 3412
🔵 Branches 70.89% (🎯 50%) 6629 / 9351
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ai/lspmesh/src/cli.ts 92.59% 100% 50% 92% 51-53
packages/ai/lspmesh/src/version.ts 100% 50% 100% 100%
packages/ai/lspmesh/src/config/default-config.ts 100% 100% 100% 100%
packages/ai/lspmesh/src/config/load-config.ts 87.5% 80.95% 100% 95.83% 24, 26, 28, 46
packages/ai/lspmesh/src/core/backend-client.ts 86.95% 69.56% 59.09% 96.61% 41, 49, 51, 82, 102, 114, 119, 140, 148
packages/ai/lspmesh/src/core/backend-registry.ts 91.3% 62.5% 100% 88.23% 20-21
packages/ai/lspmesh/src/core/definitions.ts 85.71% 87.5% 100% 100% 7
packages/ai/lspmesh/src/core/engine.ts 88.23% 56.66% 86.2% 96.15% 43, 125, 128, 149-150, 160, 164, 169, 204, 223
packages/ai/lspmesh/src/core/git-grep.ts 90% 100% 80% 87.5% 15
packages/ai/lspmesh/src/core/locations.ts 92.3% 33.33% 100% 100% 23
packages/ai/lspmesh/src/core/merge.ts 100% 100% 100% 100%
packages/ai/lspmesh/src/core/routing.ts 100% 100% 100% 100%
packages/ai/lspmesh/src/core/seed.ts 95% 93.33% 100% 100% 14
packages/ai/lspmesh/src/lsp/server.ts 100% 100% 100% 100%
packages/ai/lspmesh/src/mcp/server.ts 100% 62.5% 100% 100%
Generated in workflow #13187 for commit 11ea4b0 by the Vitest Coverage Report Action

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.19883% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.69%. Comparing base (6c8a942) to head (11ea4b0).
⚠️ Report is 26 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/ai/lspmesh/src/cli.ts 88.46% 3 Missing ⚠️
packages/ai/lspmesh/src/core/backend-client.ts 95.83% 3 Missing ⚠️
packages/ai/lspmesh/src/core/engine.ts 96.70% 3 Missing ⚠️
packages/ai/lspmesh/src/core/backend-registry.ts 91.30% 2 Missing ⚠️
packages/ai/lspmesh/src/config/load-config.ts 95.83% 1 Missing ⚠️
packages/ai/lspmesh/src/core/git-grep.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2036      +/-   ##
==========================================
+ Coverage   83.41%   83.69%   +0.28%     
==========================================
  Files         677      692      +15     
  Lines       15267    15609     +342     
  Branches     4522     4591      +69     
==========================================
+ Hits        12735    13064     +329     
- Misses       2532     2545      +13     
Components Coverage Δ
App: Storefront 81.63% <ø> (ø)
App: Admin 85.70% <ø> (ø)
App: Landing ∅ <ø> (∅)
Pkg: @nordcom/commerce-db 89.30% <ø> (ø)
Pkg: @nordcom/commerce-errors 100.00% <ø> (ø)
Pkg: @nordcom/commerce-marketing-common ∅ <ø> (∅)
Pkg: @nordcom/commerce-shopify-graphql 100.00% <ø> (ø)
Pkg: @nordcom/commerce-shopify-html 94.93% <ø> (ø)
Layer: Apps 82.92% <ø> (ø)
Layer: Packages 81.65% <96.19%> (+0.98%) ⬆️
Flag Coverage Δ
unit 83.69% <96.19%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/ai/lspmesh/src/config/default-config.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/core/definitions.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/core/locations.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/core/merge.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/core/routing.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/core/seed.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/lsp/server.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/mcp/server.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/version.ts 100.00% <100.00%> (ø)
packages/ai/lspmesh/src/config/load-config.ts 95.83% <95.83%> (ø)
... and 5 more

…mid-write.

Disposing a backend kills its child process, so an in-flight sendNotification write to the now-dead stdin rejects with EPIPE or ERR_STREAM_DESTROYED; fire-and-forget notifications had no catch, surfacing as unhandled rejections in CI's full test run. Notifications now go through a #notify helper that guards the dead flag and swallows the write rejection, and the stdin/stdout streams plus the connection get no-op error sinks so a killed pipe never bubbles up.
@vercel vercel Bot temporarily deployed to Preview – commerce-admin June 16, 2026 10:33 Inactive
Extracts the LSP request logic into a testable createLspHandlers factory and the CLI dispatch into an injectable run(), then unit-tests the engine find_* methods, the LSP handlers, the CLI dispatch, and buildMcpServer. The remaining thin stdio-transport bootstraps (startLspServer/startMcpServer/the bin entry) are exercised by the integration suite and marked v8-ignore. Package line coverage ~96%.
@filiphsps filiphsps merged commit 8c43763 into master Jun 16, 2026
9 of 12 checks passed
@filiphsps filiphsps deleted the feat/lspmesh branch June 16, 2026 10:48
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