Skip to content

fix(mcp): serve only the newest API snapshot per package (#1862) - #1874

Merged
kdinev merged 5 commits into
masterfrom
dkalinov/mcp-api-newest-snapshot-1862
Nov 5, 2026
Merged

kdinev merged 5 commits into
masterfrom
dkalinov/mcp-api-newest-snapshot-1862

Conversation

@dkalinovInfra

Copy link
Copy Markdown
Contributor

Description

get_api_reference and search_api answered Angular lookups from the igniteui-angular 9.0.x API snapshot for many current components (IgxTabsComponent, IgxGridComponent, IgxComboComponent, …), and served React placeholder entries from igniteui-react 17.5.0 / 18.0.0 (IgrPieChart, IgrDataGrid, createGrid, …).

Cause: ApiDocLoader.parseLlmsFullTxt loaded every {version} folder of a package into one map keyed by name, so the last folder read won. readdirSync returns 15.1.x, 21.0.x, 22.0.0, 9.0.x (string order), so 9.0.x overwrote 22.0.0. Names that only exist in old snapshots (e.g. IgxTabsGroupComponent) were served as current.

The old snapshots were removed once before (51a419e, May 20) but came back with #1750, because the export scripts copy every version folder from the api-docs build.

Changes:

  • Loader (src/lib/api-doc-loader.ts): loads only the newest snapshot per package. New compareVersionNames orders folders by version (9.0.x < 15.1.x < 21.0.x < 22.0.0 < latest; x counts as 0).
  • Export scripts (scripts/export-{angular,react,wc,blazor}-api.ts): export only the newest version per package and remove older exported version folders, so a re-export no longer brings stale snapshots back. Shared helper in scripts/lib/api-export.ts reuses compareVersionNames.
  • Data: removed the stale snapshots (also shrinks the published package):
    • docs/angular-api/igniteui-angular/9.0.x, 15.1.x, 21.0.x
    • docs/react-api/igniteui-react/17.5.0, 18.0.0

No tool takes a version parameter, so nothing depended on the older snapshots.

Related Issue

Closes #1862

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration change

Affected Packages

  • igniteui-cli (packages/cli)
  • @igniteui/cli-core (packages/core)
  • @igniteui/angular-templates (packages/igx-templates)
  • @igniteui/angular-schematics (packages/ng-schematics)
  • @igniteui/mcp-server (packages/igniteui-mcp)

Checklist

  • I have tested my changes locally (MCP package vitest run: 19 files, 440 tests passed; full root npm run test not run)
  • I have built the project successfully (npm run build) — only tsc --noEmit for the MCP package and the changed scripts
  • I have run the linter (npm run lint) — ESLint on the changed files: api-doc-loader.ts clean; the other changed files are excluded by the repo's ESLint ignore patterns
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

Additional Context

Loader run against the real docs/*-api data after the change:

Angular: 1712 entries · React: 550 · Web Components: 844 · Blazor: 2704
IgxTabsComponent       → .../igniteui-angular/22.0.0/classes/IgxTabsComponent (includes tabAlignment)
IgxGridComponent       → .../igniteui-angular/22.0.0/classes/IgxGridComponent
IgxTabsGroupComponent  → not found
IgrPieChart            → not found
IgrDataGrid            → not found
createGrid             → not found

New tests in src/__tests__/lib/api-doc-loader.test.ts:

  • version folder ordering (9.0.x < 15.1.x < 21.0.x < 22.0.0 < latest)
  • only the newest snapshot is read; names that exist only in older snapshots are not indexed

The export scripts were not run end to end (they need the blazor/api-docs Astro build, and dotnet for Blazor). newestVersionDir / pruneOtherVersions were checked on a temporary directory.

Follow-up (not in this PR): the React pie-chart doc links to IgrPieChart, which now returns "not found" instead of the placeholder. The real class appears to come from a React charts package that isn't in the bundled API data.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings November 2, 2026 11:28

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues block the change to serve only the newest API snapshot per package.

No open issues 🎉

What changed in this PR

This PR addresses #1862 by making the MCP server serve only the newest API snapshot per package, preventing older Angular definitions and React placeholder entries from appearing as current APIs.

Changes:

  • Adds numeric version-folder ordering and newest-snapshot selection, with regression tests.
  • Updates all four framework exporters to select the newest snapshot and remove older exported versions.
  • Deletes stale bundled API snapshots.

Paths below are relative to packages/igniteui-mcp/igniteui-doc-mcp/.

File Description
src/​lib/​api-doc-loader.ts Orders version folders and loads only the newest snapshot per package.
src/​__tests__/​lib/​api-doc-loader.test.ts Tests version ordering and exclusion of older snapshot entries.
scripts/​lib/​api-export.ts Adds shared snapshot selection and pruning helpers.
scripts/​export-wc-api.ts Exports only the newest Web Components snapshot per package.
scripts/​export-react-api.ts Exports only the newest React snapshot per package.
scripts/​export-blazor-api.ts Exports only the newest Blazor snapshot per package.
scripts/​export-angular-api.ts Exports only the newest Angular snapshot while preserving deduplication.
docs/​react-api/​igniteui-react/​18.0.0/​llms-full.txt Removes an outdated React placeholder snapshot.
docs/​react-api/​igniteui-react/​17.5.0/​llms-full.txt Removes an outdated React placeholder snapshot.
docs/​angular-api/​igniteui-angular/​9.0.x/​llms-full.txt Removes the legacy Angular snapshot that overwrote current definitions.

Review effort: Balanced

@coveralls

coveralls commented Nov 2, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 95.379%. remained the same — dkalinov/mcp-api-newest-snapshot-1862 into master

kdinev
kdinev previously approved these changes Nov 5, 2026
@kdinev
kdinev enabled auto-merge (squash) November 5, 2026 11:41
@kdinev
kdinev merged commit 5fc188c into master Nov 5, 2026
4 checks passed
@kdinev
kdinev deleted the dkalinov/mcp-api-newest-snapshot-1862 branch November 5, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: Angular get_api_reference answers from the igniteui-angular 9.0.x snapshot for current components

5 participants