Skip to content

Commit 4358f5b

Browse files
committed
add README.md for @react-spectrum/mcp
1 parent 7d2883a commit 4358f5b

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

packages/dev/mcp/README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# @react-spectrum/mcp
2+
3+
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.
4+
5+
## Using with an MCP client
6+
7+
Add one or both servers to your MCP client configuration (the exact file and schema may depend on your client).
8+
9+
```json
10+
{
11+
"mcpServers": {
12+
"s2-docs": {
13+
"command": "npx",
14+
"args": ["@react-spectrum/mcp", "s2"]
15+
},
16+
"react-aria-docs": {
17+
"command": "npx",
18+
"args": ["@react-spectrum/mcp", "react-aria"]
19+
}
20+
}
21+
}
22+
```
23+
24+
<details>
25+
<summary>Cursor</summary>
26+
27+
#### Click the button to install:
28+
29+
React Spectrum (S2):
30+
31+
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=s2-docs&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgczIifQ%3D%3D)
32+
33+
React Aria:
34+
35+
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=react-aria-docs&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgcmVhY3QtYXJpYSJ9)
36+
37+
Or follow the MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above.
38+
39+
</details>
40+
41+
<details>
42+
<summary>VS Code</summary>
43+
44+
#### Click the button to install:
45+
46+
React Spectrum (S2):
47+
48+
[<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%22s2-docs%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%22%2C%22s2%22%5D%7D)
49+
50+
React Aria:
51+
52+
[<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-aria-docs%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%22%2C%22react-aria%22%5D%7D)
53+
54+
55+
#### Or install manually:
56+
57+
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 servers using the VS Code CLI:
58+
59+
```bash
60+
# For VS Code
61+
code --add-mcp '{"name":"s2-docs","command":"npx","args":["@react-spectrum/mcp","s2"]}'
62+
code --add-mcp '{"name":"react-aria-docs","command":"npx","args":["@react-spectrum/mcp","react-aria"]}'
63+
```
64+
65+
</details>
66+
67+
<details>
68+
<summary>Claude Code</summary>
69+
70+
Use the Claude Code CLI to add the servers:
71+
72+
```bash
73+
claude mcp add s2-docs npx @react-spectrum/mcp s2
74+
claude mcp add react-aria-docs npx @react-spectrum/mcp react-aria
75+
```
76+
For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp).
77+
</details>
78+
79+
<details>
80+
<summary>Codex</summary>
81+
82+
Create or edit the configuration file `~/.codex/config.toml` and add:
83+
84+
```toml
85+
[mcp_servers.s2-docs]
86+
command = "npx"
87+
args = ["@react-spectrum/mcp", "s2"]
88+
89+
[mcp_servers.react-aria-docs]
90+
command = "npx"
91+
args = ["@react-spectrum/mcp", "react-aria"]
92+
```
93+
94+
For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers).
95+
96+
</details>
97+
98+
<details>
99+
<summary>Gemini CLI</summary>
100+
101+
Use the Gemini CLI to add the servers:
102+
103+
```bash
104+
gemini mcp add s2-docs npx @react-spectrum/mcp s2
105+
gemini mcp add react-aria-docs npx @react-spectrum/mcp react-aria
106+
```
107+
108+
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).
109+
110+
</details>
111+
112+
<details>
113+
<summary>Windsurf</summary>
114+
115+
Follow Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp) and use the standard config above.
116+
117+
</details>
118+
119+
## Tools
120+
121+
| Tool | Input | Description |
122+
| --- | --- | --- |
123+
| `list_pages` | `{ includeDescription?: boolean }` | List available pages in the selected docs library. |
124+
| `get_page_info` | `{ page_name: string }` | Return page description and list of section titles. |
125+
| `get_page` | `{ page_name: string, section_name?: string }` | Return full page markdown, or only the specified section. |
126+
| `search_icons` (S2 only) | `{ terms: string or string[] }` | Search S2 workflow icon names. |
127+
| `search_illustrations` (S2 only) | `{ terms: string or string[] }` | Search S2 illustration names. |

0 commit comments

Comments
 (0)