-
Notifications
You must be signed in to change notification settings - Fork 1.3k
docs: add MCP server docs #9020
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import {Layout} from '../../src/Layout'; | ||
import {StaticTable} from '../../src/StaticTable'; | ||
import {Command} from '../../src/Command'; | ||
import {Link} from '@react-spectrum/s2'; | ||
export default Layout; | ||
|
||
export const section = 'Guides'; | ||
export const description = 'MCP Server for React Aria'; | ||
export const tags = ['mcp', 'ai', 'documentation', 'tools']; | ||
|
||
# MCP Server | ||
|
||
The `@react-spectrum/mcp` package allows you to run [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro) servers for React Aria locally. It exposes a set of tools that MCP clients can discover and call to browse the docs. | ||
|
||
## Using with an MCP client | ||
|
||
Add one or both servers to your MCP client configuration (the exact file and schema may depend on your client). | ||
|
||
```js | ||
{ | ||
"mcpServers": { | ||
"React Aria": { | ||
"command": "npx", | ||
"args": ["@react-spectrum/mcp", "react-aria"] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Cursor | ||
|
||
<Link href="cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Aria&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgcmVhY3QtYXJpYSJ9" aria-label="Add to Cursor"> | ||
<picture> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-dark.svg" media="(prefers-color-scheme: light)" /> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-light.svg" media="(prefers-color-scheme: dark)" /> | ||
<img src="https://cursor.com/deeplink/mcp-install-light.svg" alt="Add to Cursor" /> | ||
</picture> | ||
</Link> | ||
|
||
|
||
Or follow Cursor's MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above. | ||
|
||
### VS Code | ||
|
||
<Link href="vscode:mcp/install?%7B%22name%22%3A%22React%20Aria%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%22%2C%22react-aria%22%5D%7D" aria-label="Add to Visual Studio Code"> | ||
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in Visual Studio Code" /> | ||
</Link> | ||
|
||
Or follow VS Code's 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 servers using the VS Code CLI: | ||
|
||
<Command command='code --add-mcp '{"name":"React Aria","command":"npx","args":["@react-spectrum/mcp","react-aria"]}'' /> | ||
|
||
### Claude Code | ||
|
||
Use the Claude Code CLI to add the servers: | ||
|
||
<Command command="claude mcp add react-aria npx @react-spectrum/mcp react-aria" /> | ||
|
||
For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp). | ||
|
||
### Codex | ||
|
||
Create or edit the configuration file `~/.codex/config.toml` and add: | ||
|
||
```js | ||
[mcp_servers.react-aria] | ||
command = "npx" | ||
args = ["@react-spectrum/mcp", "react-aria"] | ||
``` | ||
|
||
For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers). | ||
|
||
### Gemini CLI | ||
|
||
Use the Gemini CLI to add the servers: | ||
|
||
<Command command="gemini mcp add react-aria npx @react-spectrum/mcp react-aria" /> | ||
|
||
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). | ||
|
||
### Windsurf | ||
|
||
Follow the Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp) and use the standard config above. |
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 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,117 @@ | ||
import {Layout} from '../../src/Layout'; | ||
import {StaticTable} from '../../src/StaticTable'; | ||
import {Command} from '../../src/Command'; | ||
import {Link} from '@react-spectrum/s2'; | ||
export default Layout; | ||
|
||
export const section = 'Guides'; | ||
export const description = 'MCP Server for React Spectrum'; | ||
export const tags = ['mcp', 'ai', 'documentation', 'tools']; | ||
|
||
# MCP Server | ||
|
||
The `@react-spectrum/mcp` package allows you to run [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro) servers for React Spectrum (S2) and React Aria locally. It exposes a set of tools that MCP clients can discover and call to browse the docs. | ||
|
||
## Using with an MCP client | ||
|
||
Add one or both servers to your MCP client configuration (the exact file and schema may depend on your client). | ||
|
||
```js | ||
{ | ||
"mcpServers": { | ||
"React Spectrum (S2)": { | ||
"command": "npx", | ||
"args": ["@react-spectrum/mcp", "s2"] | ||
}, | ||
"React Aria": { | ||
"command": "npx", | ||
"args": ["@react-spectrum/mcp", "react-aria"] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Cursor | ||
|
||
React Spectrum (S2): | ||
|
||
<Link href="cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Spectrum%20(S2)&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgczIifQ%3D%3D" aria-label="Add to Cursor"> | ||
<picture> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-dark.svg" media="(prefers-color-scheme: light)" /> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-light.svg" media="(prefers-color-scheme: dark)" /> | ||
<img src="https://cursor.com/deeplink/mcp-install-light.svg" alt="Add to Cursor" /> | ||
</picture> | ||
</Link> | ||
|
||
React Aria: | ||
|
||
<Link href="cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Aria&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgcmVhY3QtYXJpYSJ9" aria-label="Add to Cursor"> | ||
<picture> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-dark.svg" media="(prefers-color-scheme: light)" /> | ||
<source srcSet="https://cursor.com/deeplink/mcp-install-light.svg" media="(prefers-color-scheme: dark)" /> | ||
<img src="https://cursor.com/deeplink/mcp-install-light.svg" alt="Add to Cursor" /> | ||
</picture> | ||
</Link> | ||
|
||
|
||
Or follow Cursor's MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above. | ||
|
||
### VS Code | ||
|
||
React Spectrum (S2): | ||
|
||
<Link href="vscode:mcp/install?%7B%22name%22%3A%22React%20Spectrum%20(S2)%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%22%2C%22s2%22%5D%7D" aria-label="Add to Visual Studio Code"> | ||
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in Visual Studio Code" /> | ||
</Link> | ||
|
||
React Aria: | ||
|
||
<Link href="vscode:mcp/install?%7B%22name%22%3A%22React%20Aria%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%22%2C%22react-aria%22%5D%7D" aria-label="Add to Visual Studio Code"> | ||
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in Visual Studio Code" /> | ||
</Link> | ||
|
||
Or follow VS Code's 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 servers using the VS Code CLI: | ||
|
||
<Command command='code --add-mcp '{"name":"React Spectrum (S2)","command":"npx","args":["@react-spectrum/mcp","s2"]}'' /> | ||
|
||
<Command command='code --add-mcp '{"name":"React Aria","command":"npx","args":["@react-spectrum/mcp","react-aria"]}'' /> | ||
|
||
### Claude Code | ||
|
||
Use the Claude Code CLI to add the servers: | ||
|
||
<Command command="claude mcp add react-spectrum-s2 npx @react-spectrum/mcp s2" /> | ||
|
||
<Command command="claude mcp add react-aria npx @react-spectrum/mcp react-aria" /> | ||
|
||
For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp). | ||
|
||
### Codex | ||
|
||
Create or edit the configuration file `~/.codex/config.toml` and add: | ||
|
||
```js | ||
[mcp_servers.react-spectrum-s2] | ||
command = "npx" | ||
args = ["@react-spectrum/mcp", "s2"] | ||
|
||
[mcp_servers.react-aria] | ||
command = "npx" | ||
args = ["@react-spectrum/mcp", "react-aria"] | ||
``` | ||
|
||
For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers). | ||
|
||
### Gemini CLI | ||
|
||
Use the Gemini CLI to add the servers: | ||
|
||
<Command command="gemini mcp add react-spectrum-s2 npx @react-spectrum/mcp s2" /> | ||
|
||
<Command command="gemini mcp add react-aria npx @react-spectrum/mcp react-aria" /> | ||
|
||
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). | ||
|
||
### Windsurf | ||
|
||
Follow the Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp) and use the standard config above. |
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,58 @@ | ||
'use client'; | ||
|
||
import {CopyButton} from './CopyButton'; | ||
import React from 'react'; | ||
import {style} from '@react-spectrum/s2/style' with {type: 'macro'}; | ||
|
||
const container = style({ | ||
backgroundColor: 'layer-1', | ||
marginY: 20, | ||
borderRadius: 'xl', | ||
display: 'flex', | ||
flexDirection: 'column' | ||
}); | ||
|
||
const codeWrap = style({ | ||
padding: 16 | ||
}); | ||
|
||
const codeContainer = style({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: 12, | ||
padding: 4 | ||
}); | ||
|
||
const preStyle = style({ | ||
font: {default: 'code-xs', lg: 'code-sm'}, | ||
overflowX: 'auto', | ||
paddingY: 8, | ||
paddingX: 0, | ||
margin: 0, | ||
whiteSpace: 'pre', | ||
flex: 1, | ||
minWidth: 0 | ||
}); | ||
|
||
export interface CommandProps { | ||
/** The command to display. */ | ||
command: string, | ||
/** Optional label preceding the code block. */ | ||
label?: string | ||
} | ||
|
||
export function Command({command, label}: CommandProps) { | ||
return ( | ||
<div className={container} data-example-switcher> | ||
<div className={codeWrap}> | ||
{label && <div className={style({font: 'body-sm', marginBottom: 8, color: 'body'})}>{label}</div>} | ||
<div className={codeContainer}> | ||
<pre className={preStyle}>{command}</pre> | ||
<CopyButton ariaLabel="Copy command" tooltip="Copy command" text={command} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Command; |
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.
I know these are probably their styles, but they look so much like status badges letting you know if a github repo is passing tests. Probably why they are called badge.