Skip to content

Conversation

@reidbarber
Copy link
Member

@reidbarber reidbarber commented Oct 17, 2025

Splits the mcp servers into separate packages. Include a private internal package for shared code.

Before:

npx @react-spectrum/mcp s2
npx @react-spectrum/mcp react-aria

After:

npx @react-spectrum/mcp@
npx @react-aria/mcp

Also updates the npx commands to use @latest

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Generate markdown docs:

yarn workspace @react-spectrum/s2-docs generate:md

Build the MCP servers:

yarn build:mcp

Start a docs server:

yarn start:s2-docs

Update your MCP config:

{
  "mcpServers": {
    "React Spectrum (S2)": {
      "command": "node",
      "args": [
        "{your-path}/react-spectrum/packages/dev/mcp/s2/dist/s2/src/index.js"
      ],
      "env": {
        "DOCS_CDN_BASE": "http://localhost:1234"
      }
    },
    "React Aria": {
      "command": "node",
      "args": [
        "{your-path}/react-spectrum/packages/dev/mcp/react-aria/dist/react-aria/src/index.js"
      ],
      "env": {
        "DOCS_CDN_BASE": "http://localhost:1234"
      }
    }
  }
}

🧢 Your Project:

@rspbot
Copy link

rspbot commented Oct 17, 2025

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

I'm sure I just missed some conversation but, why split it in two? I thought having 2 different api end points was good enough?

Comment on lines 2 to 3
"name": "mcp-packages",
"private": true,
Copy link
Member

Choose a reason for hiding this comment

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

why not have these be shared? is the code just inlined when bundled right now such that you don't need a shared package?
the project structure is a bit odd as a result

Copy link
Member Author

Choose a reason for hiding this comment

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

Where would the dependencies go without a shared package? I guess one option is to have the shared code in one of the two packages, but it seemed better to have an internal shared one.

Copy link
Member

Choose a reason for hiding this comment

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

right, but the structure is weird as it is right now

  • this package is private
  • this package is inside of a 'src' directory
  • modules imported from this package are referenced via a relative path instead of from the package workspace name

this is why i asked if the code was being inlined instead of actually shared

Copy link
Member Author

Choose a reason for hiding this comment

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

I've improved the structure to avoid confusion. I think this is what we want:

  • mcp-shared is a private package
  • @react-spectrum/mcp and @react-aria/mcp import from there using relative paths

I'm not sure about outputing src/ in the dist folder. Would that be a tsconfig.json setting?

Copy link
Member

Choose a reason for hiding this comment

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

is a private package
import from there using relative paths

why?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think these packages are bundled right now, just compiled with tsc.

@rspbot
Copy link

rspbot commented Oct 23, 2025

snowystinger
snowystinger previously approved these changes Nov 5, 2025
Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

structure is still weird to me, but i'd prefer we move this along and we can figure out the private vs public shared package later

@rspbot
Copy link

rspbot commented Nov 13, 2025

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

looks good to me, tested the functionality in cursor and it seems to work well. Noticed a warning when building the mcp package, but might be benign?

"version": "0.1.0",
"description": "MCP server for React Spectrum (S2) and React Aria documentation",
"description": "MCP server for React Spectrum (S2) documentation",
"type": "module",
Copy link
Member

Choose a reason for hiding this comment

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

maybe benign but I got this when running yarn workspace @react-spectrum/mcp build

(node:82090) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/danilu/dev/react-spectrum/packages/dev/s2-docs/src/iconAliases.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/danilu/dev/react-spectrum/packages/dev/s2-docs/package.json.

weird since this does have "type": module...

@reidbarber reidbarber added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit 46eb0ef Nov 14, 2025
35 checks passed
@reidbarber reidbarber deleted the mcp-multiple-packages-refactor branch November 14, 2025 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants