|
| 1 | +import {Layout} from '../../src/Layout'; |
| 2 | +import {StaticTable} from '../../src/StaticTable'; |
| 3 | +import {Command} from '../../src/Command'; |
| 4 | +import {Link} from '@react-spectrum/s2'; |
| 5 | +export default Layout; |
| 6 | + |
| 7 | +export const section = 'Guides'; |
| 8 | +export const description = 'MCP Server for React Spectrum'; |
| 9 | +export const tags = ['mcp', 'ai', 'documentation', 'tools']; |
| 10 | + |
| 11 | +# MCP Server |
| 12 | + |
| 13 | +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. |
| 14 | + |
| 15 | +## Using with an MCP client |
| 16 | + |
| 17 | +Add one or both servers to your MCP client configuration (the exact file and schema may depend on your client). |
| 18 | + |
| 19 | +```js |
| 20 | +{ |
| 21 | + "mcpServers": { |
| 22 | + "React Spectrum (S2)": { |
| 23 | + "command": "npx", |
| 24 | + "args": ["@react-spectrum/mcp", "s2"] |
| 25 | + }, |
| 26 | + "React Aria": { |
| 27 | + "command": "npx", |
| 28 | + "args": ["@react-spectrum/mcp", "react-aria"] |
| 29 | + } |
| 30 | + } |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +### Cursor |
| 35 | + |
| 36 | +React Spectrum (S2): |
| 37 | + |
| 38 | +<Link href="cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Spectrum%20(S2)&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgczIifQ%3D%3D" aria-label="Add to Cursor"> |
| 39 | + <picture> |
| 40 | + <source srcSet="https://cursor.com/deeplink/mcp-install-dark.svg" media="(prefers-color-scheme: light)" /> |
| 41 | + <source srcSet="https://cursor.com/deeplink/mcp-install-light.svg" media="(prefers-color-scheme: dark)" /> |
| 42 | + <img src="https://cursor.com/deeplink/mcp-install-light.svg" alt="Add to Cursor" /> |
| 43 | + </picture> |
| 44 | +</Link> |
| 45 | + |
| 46 | +React Aria: |
| 47 | + |
| 48 | +<Link href="cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Aria&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgcmVhY3QtYXJpYSJ9" aria-label="Add to Cursor"> |
| 49 | + <picture> |
| 50 | + <source srcSet="https://cursor.com/deeplink/mcp-install-dark.svg" media="(prefers-color-scheme: light)" /> |
| 51 | + <source srcSet="https://cursor.com/deeplink/mcp-install-light.svg" media="(prefers-color-scheme: dark)" /> |
| 52 | + <img src="https://cursor.com/deeplink/mcp-install-light.svg" alt="Add to Cursor" /> |
| 53 | + </picture> |
| 54 | +</Link> |
| 55 | + |
| 56 | + |
| 57 | +Or follow Cursor's MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above. |
| 58 | + |
| 59 | +### VS Code |
| 60 | + |
| 61 | +React Spectrum (S2): |
| 62 | + |
| 63 | +<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"> |
| 64 | + <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" /> |
| 65 | +</Link> |
| 66 | + |
| 67 | +React Aria: |
| 68 | + |
| 69 | +<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"> |
| 70 | + <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" /> |
| 71 | +</Link> |
| 72 | + |
| 73 | +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: |
| 74 | + |
| 75 | +<Command command='code --add-mcp '{"name":"React Spectrum (S2)","command":"npx","args":["@react-spectrum/mcp","s2"]}'' /> |
| 76 | + |
| 77 | +<Command command='code --add-mcp '{"name":"React Aria","command":"npx","args":["@react-spectrum/mcp","react-aria"]}'' /> |
| 78 | + |
| 79 | +### Claude Code |
| 80 | + |
| 81 | +Use the Claude Code CLI to add the servers: |
| 82 | + |
| 83 | +<Command command="claude mcp add react-spectrum-s2 npx @react-spectrum/mcp s2" /> |
| 84 | + |
| 85 | +<Command command="claude mcp add react-aria npx @react-spectrum/mcp react-aria" /> |
| 86 | + |
| 87 | +For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp). |
| 88 | + |
| 89 | +### Codex |
| 90 | + |
| 91 | +Create or edit the configuration file `~/.codex/config.toml` and add: |
| 92 | + |
| 93 | +```js |
| 94 | +[mcp_servers.react-spectrum-s2] |
| 95 | +command = "npx" |
| 96 | +args = ["@react-spectrum/mcp", "s2"] |
| 97 | + |
| 98 | +[mcp_servers.react-aria] |
| 99 | +command = "npx" |
| 100 | +args = ["@react-spectrum/mcp", "react-aria"] |
| 101 | +``` |
| 102 | + |
| 103 | +For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers). |
| 104 | + |
| 105 | +### Gemini CLI |
| 106 | + |
| 107 | +Use the Gemini CLI to add the servers: |
| 108 | + |
| 109 | +<Command command="gemini mcp add react-spectrum-s2 npx @react-spectrum/mcp s2" /> |
| 110 | + |
| 111 | +<Command command="gemini mcp add react-aria npx @react-spectrum/mcp react-aria" /> |
| 112 | + |
| 113 | +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). |
| 114 | + |
| 115 | +### Windsurf |
| 116 | + |
| 117 | +Follow the Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp) and use the standard config above. |
0 commit comments