-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: refactor mcp servers into separate packages #9061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
reidbarber
wants to merge
6
commits into
main
Choose a base branch
from
mcp-multiple-packages-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+966
−702
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1fa0e82
refactor mcp server to be two separate servers
reidbarber 18bd3a2
update README and docs
reidbarber f67a57d
fix data loading
reidbarber d8be5cd
cleanup
reidbarber 125206c
improve structure
reidbarber accba22
yarn.lock
reidbarber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # @react-aria/mcp | ||
|
|
||
| The `@react-aria/mcp` package provides a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro) server for React Aria documentation. It exposes a set of tools that MCP clients can discover and call to browse the docs. | ||
|
|
||
| ## Installation | ||
|
|
||
| ### Quick Start | ||
|
|
||
| Simply run the server using npx: | ||
|
|
||
| ```bash | ||
| npx @react-aria/mcp | ||
| ``` | ||
|
|
||
| ### Using with an MCP client | ||
|
|
||
| Add the server to your MCP client configuration (the exact file and schema may depend on your client). | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "React Aria": { | ||
| "command": "npx", | ||
| "args": ["@react-aria/mcp"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| <details> | ||
| <summary>Cursor</summary> | ||
|
|
||
| #### Click the button to install: | ||
|
|
||
| [](cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Aria&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAcmVhY3QtYXJpYS9tY3AiXX0%3D) | ||
|
|
||
| Or follow the MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above. | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>VS Code</summary> | ||
|
|
||
| #### Click the button to install: | ||
|
|
||
| [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](vscode:mcp/install?%7B%22name%22%3A%22React%20Aria%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-aria%2Fmcp%22%5D%7D) | ||
|
|
||
| #### Or install manually: | ||
|
|
||
| Follow the MCP install [guide](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server) and use the standard config above. You can also add the server using the VS Code CLI: | ||
|
|
||
| ```bash | ||
| code --add-mcp '{"name":"React Aria","command":"npx","args":["@react-aria/mcp"]}' | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Claude Code</summary> | ||
|
|
||
| Use the Claude Code CLI to add the server: | ||
|
|
||
| ```bash | ||
| claude mcp add react-aria npx @react-aria/mcp | ||
| ``` | ||
| For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp). | ||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Codex</summary> | ||
|
|
||
| Create or edit the configuration file `~/.codex/config.toml` and add: | ||
|
|
||
| ```toml | ||
| [mcp_servers.react-aria] | ||
| command = "npx" | ||
| args = ["@react-aria/mcp"] | ||
| ``` | ||
|
|
||
| For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers). | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Gemini CLI</summary> | ||
|
|
||
| Use the Gemini CLI to add the server: | ||
|
|
||
| ```bash | ||
| gemini mcp add react-aria npx @react-aria/mcp | ||
| ``` | ||
|
|
||
| For more information, see the [Gemini CLI MCP documentation](https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md#how-to-set-up-your-mcp-server). | ||
|
|
||
| </details> | ||
|
|
||
| <details> | ||
| <summary>Windsurf</summary> | ||
|
|
||
| Follow Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp) and use the standard config above. | ||
|
|
||
| </details> | ||
|
|
||
| ## Tools | ||
|
|
||
| | Tool | Input | Description | | ||
| | --- | --- | --- | | ||
| | `list_react_aria_pages` | `{ includeDescription?: boolean }` | List available pages in the React Aria docs. | | ||
| | `get_react_aria_page_info` | `{ page_name: string }` | Return page description and list of section titles. | | ||
| | `get_react_aria_page` | `{ page_name: string, section_name?: string }` | Return full page markdown, or only the specified section. | | ||
|
|
||
| ## Development | ||
|
|
||
| ### Testing locally | ||
|
|
||
| Build the docs and MCP server locally, then start the docs server. | ||
|
|
||
| ```bash | ||
| yarn workspace @react-spectrum/s2-docs generate:md | ||
| yarn workspace @react-aria/mcp build | ||
| yarn start:s2-docs | ||
| ``` | ||
|
|
||
| Update your MCP client configuration to use the local MCP server: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "React Aria": { | ||
| "command": "node", | ||
| "args": ["{your path here}/react-spectrum/packages/dev/mcp/react-aria/dist/index.js"], | ||
| "env": { | ||
| "DOCS_CDN_BASE": "http://localhost:1234" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 is why i asked if the code was being inlined instead of actually shared
There was a problem hiding this comment.
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-sharedis a private package@react-spectrum/mcpand@react-aria/mcpimport from there using relative pathsI'm not sure about outputing src/ in the dist folder. Would that be a tsconfig.json setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
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.