@react-spectrum/mcp 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -45
- package/dist/data/icons.json +7 -0
- package/dist/data/illustrations.json +2 -0
- package/dist/data/styleMacroPropertyValues.json +5947 -0
- package/dist/data/styleProperties.json +4063 -0
- package/dist/s2/src/index.js +117 -0
- package/dist/s2/src/s2-data.js +62 -0
- package/dist/shared/src/page-manager.js +83 -0
- package/dist/shared/src/parser.js +61 -0
- package/dist/shared/src/server.js +76 -0
- package/dist/shared/src/types.js +1 -0
- package/dist/shared/src/utils.js +30 -0
- package/package.json +10 -10
- package/src/index.ts +107 -401
- package/src/s2-data.ts +57 -0
- package/dist/index.js +0 -395
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
# @react-spectrum/mcp
|
|
2
2
|
|
|
3
|
-
The `@react-spectrum/mcp` package
|
|
3
|
+
The `@react-spectrum/mcp` package provides a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/docs/getting-started/intro) server for React Spectrum (S2) documentation. It exposes a set of tools that MCP clients can discover and call to browse the docs, search for icons and illustrations, and more.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Quick Start
|
|
8
|
+
|
|
9
|
+
Simply run the server using npx:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx @react-spectrum/mcp@latest
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Using with an MCP client
|
|
16
|
+
|
|
17
|
+
Add the server to your MCP client configuration (the exact file and schema may depend on your client).
|
|
8
18
|
|
|
9
19
|
```json
|
|
10
20
|
{
|
|
11
21
|
"mcpServers": {
|
|
12
|
-
"
|
|
22
|
+
"React Spectrum (S2)": {
|
|
13
23
|
"command": "npx",
|
|
14
|
-
"args": ["@react-spectrum/mcp"
|
|
15
|
-
},
|
|
16
|
-
"react-aria-docs": {
|
|
17
|
-
"command": "npx",
|
|
18
|
-
"args": ["@react-spectrum/mcp", "react-aria"]
|
|
24
|
+
"args": ["@react-spectrum/mcp@latest"]
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
}
|
|
@@ -26,13 +32,7 @@ Add one or both servers to your MCP client configuration (the exact file and sch
|
|
|
26
32
|
|
|
27
33
|
#### Click the button to install:
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[](https://cursor.com/en/install-mcp?name=s2-docs&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgczIifQ%3D%3D)
|
|
32
|
-
|
|
33
|
-
React Aria:
|
|
34
|
-
|
|
35
|
-
[](https://cursor.com/en/install-mcp?name=react-aria-docs&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3AgcmVhY3QtYXJpYSJ9)
|
|
35
|
+
[](cursor://anysphere.cursor-deeplink/mcp/install?name=React%20Spectrum%20(S2)&config=eyJjb21tYW5kIjoibnB4IEByZWFjdC1zcGVjdHJ1bS9tY3BAbGF0ZXN0In0%3D)
|
|
36
36
|
|
|
37
37
|
Or follow the MCP install [guide](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) and use the standard config above.
|
|
38
38
|
|
|
@@ -43,23 +43,14 @@ Or follow the MCP install [guide](https://docs.cursor.com/en/context/mcp#install
|
|
|
43
43
|
|
|
44
44
|
#### Click the button to install:
|
|
45
45
|
|
|
46
|
-
|
|
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
|
-
|
|
46
|
+
[<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%20Spectrum%20(S2)%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40react-spectrum%2Fmcp%40latest%22%5D%7D)
|
|
54
47
|
|
|
55
48
|
#### Or install manually:
|
|
56
49
|
|
|
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
|
|
50
|
+
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:
|
|
58
51
|
|
|
59
52
|
```bash
|
|
60
|
-
|
|
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"]}'
|
|
53
|
+
code --add-mcp '{"name":"React Spectrum (S2)","command":"npx","args":["@react-spectrum/mcp@latest"]}'
|
|
63
54
|
```
|
|
64
55
|
|
|
65
56
|
</details>
|
|
@@ -67,11 +58,10 @@ code --add-mcp '{"name":"react-aria-docs","command":"npx","args":["@react-spectr
|
|
|
67
58
|
<details>
|
|
68
59
|
<summary>Claude Code</summary>
|
|
69
60
|
|
|
70
|
-
Use the Claude Code CLI to add the
|
|
61
|
+
Use the Claude Code CLI to add the server:
|
|
71
62
|
|
|
72
63
|
```bash
|
|
73
|
-
claude mcp add s2
|
|
74
|
-
claude mcp add react-aria-docs npx @react-spectrum/mcp react-aria
|
|
64
|
+
claude mcp add react-spectrum-s2 npx @react-spectrum/mcp@latest
|
|
75
65
|
```
|
|
76
66
|
For more information, see the [Claude Code MCP documentation](https://docs.claude.com/en/docs/claude-code/mcp).
|
|
77
67
|
</details>
|
|
@@ -82,13 +72,9 @@ For more information, see the [Claude Code MCP documentation](https://docs.claud
|
|
|
82
72
|
Create or edit the configuration file `~/.codex/config.toml` and add:
|
|
83
73
|
|
|
84
74
|
```toml
|
|
85
|
-
[mcp_servers.s2
|
|
86
|
-
command = "npx"
|
|
87
|
-
args = ["@react-spectrum/mcp", "s2"]
|
|
88
|
-
|
|
89
|
-
[mcp_servers.react-aria-docs]
|
|
75
|
+
[mcp_servers.react-spectrum-s2]
|
|
90
76
|
command = "npx"
|
|
91
|
-
args = ["@react-spectrum/mcp"
|
|
77
|
+
args = ["@react-spectrum/mcp@latest"]
|
|
92
78
|
```
|
|
93
79
|
|
|
94
80
|
For more information, see the [Codex MCP documentation](https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers).
|
|
@@ -98,11 +84,10 @@ For more information, see the [Codex MCP documentation](https://github.com/opena
|
|
|
98
84
|
<details>
|
|
99
85
|
<summary>Gemini CLI</summary>
|
|
100
86
|
|
|
101
|
-
Use the Gemini CLI to add the
|
|
87
|
+
Use the Gemini CLI to add the server:
|
|
102
88
|
|
|
103
89
|
```bash
|
|
104
|
-
gemini mcp add s2
|
|
105
|
-
gemini mcp add react-aria-docs npx @react-spectrum/mcp react-aria
|
|
90
|
+
gemini mcp add react-spectrum-s2 npx @react-spectrum/mcp@latest
|
|
106
91
|
```
|
|
107
92
|
|
|
108
93
|
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).
|
|
@@ -120,8 +105,36 @@ Follow Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/m
|
|
|
120
105
|
|
|
121
106
|
| Tool | Input | Description |
|
|
122
107
|
| --- | --- | --- |
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
108
|
+
| `list_s2_pages` | `{ includeDescription?: boolean }` | List available pages in the S2 docs. |
|
|
109
|
+
| `get_s2_page_info` | `{ page_name: string }` | Return page description and list of section titles. |
|
|
110
|
+
| `get_s2_page` | `{ page_name: string, section_name?: string }` | Return full page markdown, or only the specified section. |
|
|
111
|
+
| `search_s2_icons` | `{ terms: string \| string[] }` | Search S2 workflow icon names. |
|
|
112
|
+
| `search_s2_illustrations` | `{ terms: string \| string[] }` | Search S2 illustration names. |
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
### Testing locally
|
|
117
|
+
|
|
118
|
+
Build the docs and MCP server locally, then start the docs server.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
yarn workspace @react-spectrum/s2-docs generate:md
|
|
122
|
+
yarn workspace @react-spectrum/mcp build
|
|
123
|
+
yarn start:s2-docs
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Update your MCP client configuration to use the local MCP server:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"React Spectrum (S2)": {
|
|
132
|
+
"command": "node",
|
|
133
|
+
"args": ["{your path here}/react-spectrum/packages/dev/mcp/s2/dist/s2/src/index.js"],
|
|
134
|
+
"env": {
|
|
135
|
+
"DOCS_CDN_BASE": "http://localhost:1234"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
package/dist/data/icons.json
CHANGED
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
"GroupNo",
|
|
184
184
|
"Hand",
|
|
185
185
|
"Heart",
|
|
186
|
+
"HeartFilled",
|
|
186
187
|
"HelpCircle",
|
|
187
188
|
"History",
|
|
188
189
|
"Home",
|
|
@@ -219,6 +220,7 @@
|
|
|
219
220
|
"Mask",
|
|
220
221
|
"MaskDisable",
|
|
221
222
|
"Maximize",
|
|
223
|
+
"MediaOffline",
|
|
222
224
|
"Mention",
|
|
223
225
|
"MenuHamburger",
|
|
224
226
|
"Microphone",
|
|
@@ -323,6 +325,10 @@
|
|
|
323
325
|
"SwitchVertical",
|
|
324
326
|
"Table",
|
|
325
327
|
"Tag",
|
|
328
|
+
"TagBold",
|
|
329
|
+
"TagItalic",
|
|
330
|
+
"TagStrikeThrough",
|
|
331
|
+
"TagUnderline",
|
|
326
332
|
"Target",
|
|
327
333
|
"Temperature",
|
|
328
334
|
"Template",
|
|
@@ -390,6 +396,7 @@
|
|
|
390
396
|
"VolumeOff",
|
|
391
397
|
"VolumeOne",
|
|
392
398
|
"VolumeTwo",
|
|
399
|
+
"Wallet",
|
|
393
400
|
"WebNavBar",
|
|
394
401
|
"WebPage",
|
|
395
402
|
"ZoomIn",
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"NoFile",
|
|
128
128
|
"NoFilter",
|
|
129
129
|
"NoImage",
|
|
130
|
+
"NoInternetConnection",
|
|
130
131
|
"NoLibraries",
|
|
131
132
|
"NoLibrariesBrands",
|
|
132
133
|
"NoReviewLinks",
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"Shapes",
|
|
162
163
|
"ShoppingBag",
|
|
163
164
|
"ShoppingCart",
|
|
165
|
+
"SocialPost",
|
|
164
166
|
"Sparkles",
|
|
165
167
|
"SpeedFast",
|
|
166
168
|
"StampClone",
|