Skip to content

feat(#4149): Make the MCP server build as an npm package - #4270

Open
twjeffery wants to merge 2 commits into
devfrom
tom/4149-mcp-package
Open

feat(#4149): Make the MCP server build as an npm package#4270
twjeffery wants to merge 2 commits into
devfrom
tom/4149-mcp-package

Conversation

@twjeffery

Copy link
Copy Markdown
Collaborator

The server that moved over in 4258 could not actually be run from this repo. It had no dependencies declared, nothing compiled it, and the build knew nothing about it. This wires all of that up, so the next PR only has to add the release config.

  1. libs/design-system-mcp is now a real project, set up the same way as the other libs. Building it runs the docs content generator first and copies the generated records in beside the bundled server, so dist/libs/design-system-mcp is the complete package: the server, its data, the readme and the package.json.
  2. The package rebuilds when the content changes. A docs content change or a component wrapper change now marks this project affected, which is what will drive republishing once the release config exists. It also means content PRs build this package on GitHub from now on, so a content change that breaks the generated data fails the PR instead of being found after a release.
  3. A check that the built package actually works. After the build, the package gets packed and installed into a temporary folder the way a team would install it, then asked real questions through the same command an MCP client runs. It has to come back with at least 300 records, the example to component connections present, and working search and get answers, or the check fails on GitHub. I also made sure it fails when it should: a corrupt record file, missing data and a too-small data set all stop it. Building it this way also compiles and type checks the server on every PR that touches it, which nothing was doing before, so a change that breaks it fails the PR instead of shipping. If that is more weight on content PRs than you would want, now is the cheap time to say so.
  4. Two fixes so the installed package works outside this repo:
    • npm installs the goa-design-system-mcp command as a link to the real file, and the server looked for its data next to the link, where there is nothing. Installed that way it could not start. It now also looks next to the real file.
    • The server reported itself as version 2.0.0 no matter what. The real version is stamped into the package when a release publishes it, after the code is built, so the server now reads its own version when it starts. Run from source it reports 0.0.0, which is honest, since that build was never released.
  5. Cleanup that comes with this: the three packages the generator was quietly borrowing from the root install (typescript, yaml and fastest-levenshtein) are now declared in docs like the rest of its dependencies, installing at the root now also installs this package's dependencies (the same way docs already works), and sync-to-dcp.sh is gone, since copying data to the other repo by hand is exactly what this replaces.

To try it: npx nx run design-system-mcp:post does the whole loop, build, pack, install, ask. Or run the server straight from source: cd docs && GOA_MCP_DATA_DIR=generated/mcp npx tsx ../libs/design-system-mcp/src/main.ts

Not here yet: the release config and how versions get numbered. That is the next PR, and it is small now that this one exists.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://GovAlta.github.io/ui-components/pr-preview-angular/pr-4270/

Built to branch gh-pages at 2026-09-04 20:07 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Preview links

Target URL
Docs https://govalta.github.io/ui-components/pr-preview/pr-4270/
React playground https://govalta.github.io/ui-components/pr-preview-react/pr-4270/
Angular playground https://govalta.github.io/ui-components/pr-preview-angular/pr-4270/

Built from commit 5d6865f. Previews are removed automatically when this PR closes.

@twjeffery twjeffery self-assigned this Sep 4, 2026
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.

Design System MCP: realign with current DS release and publish as versioned npm package

1 participant