1 import {
2 Tabs,
3 TabsContent,
4 TabsContentWrapper,
5 TabsList,
6 TabsTrigger,
7 ChildDocs,
8 Link,
9 Prerequisites,
10 CodeTab,
11 CodeTabs
12 } from "docs-ui"
13
14 export const metadata = {
15 title: `${pageNumber} Docs MCP Server`,
16 }
17
18 # {metadata.title}
19
20 The Medusa documentation provides a remote Model Context Protocol (MCP) server that allows you to find information from the Medusa documentation right in your IDEs or AI tools, such as Cursor.
21
22 Medusa hosts a Streamable HTTP MCP server at `https://docs.medusajs.com/mcp` that you can add to AI agents supporting MCP server connections.
23
24 ## Authentication
25
26 The Docs MCP server is available for [Cloud](!cloud!) users only. It requires authenticating with your Cloud account to use it.
27
28 The Docs MCP server supports two authentication methods:
29
30 1. OAuth: This is the recommended authentication method. It allows you to authenticate with your Cloud account without generating a token manually. When you connect to the Docs MCP server, you will be prompted to log into your Cloud account in a browser window to authenticate.
31 2. [Personal Access Key](!cloud!/access-keys#manage-personal-access-keys): Use your Cloud personal access key as a Bearer token in the Authorization header when connecting to the Docs MCP server. This method is useful if you face issues with OAuth or prefer to use a token for authentication.
32
33 ---
34
35 ## Connect to the Docs MCP Server
36
37 <Prerequisites
38 items={[
39 {
40 text: "Cloud account",
41 link: "!cloud!"
42 }
43 ]}
44 />
45
46 ### Claude Code
47
48 To connect to the Docs MCP server in Claude Code, run the following command in your terminal:
49
50 <CodeTabs group="mcp-server-auth">
51 <CodeTab label="OAuth" value="oauth">
52
53 ```bash
54 claude mcp add --transport http medusa https://docs.medusajs.com/mcp
55 ```
56
57 </CodeTab>
58 <CodeTab label="Personal Access Key" value="personal-access-key">
59
60 ```bash
61 claude mcp add --transport http medusa https://docs.medusajs.com/mcp --header "Authorization: Bearer {token}"
62 ```
63
64 </CodeTab>
65 </CodeTabs>
66
67 Then, start Claude Code and authenticate with your Cloud account:
68
69 ```sh
70 claude
71 /mcp # for oauth
72 ```
73
74 If you're connecting with OAuth, select the `medusa` MCP server and choose "Authenticate". This will open a browser window where you can log into your Cloud account to authenticate.
75
76 ### Codex
77
78 To connect to the Docs MCP server in Codex, use one of the following methods:
79
80 <CodeTabs group="mcp-server-auth">
81 <CodeTab label="OAuth" value="oauth">
82
83 ```bash
84 codex mcp add medusa --url https://docs.medusajs.com/mcp
85 ```
86
87 </CodeTab>
88 <CodeTab label="Personal Access Key" value="personal-access-key">
89
90 ```toml title="~/.codex/config.toml"
91 [mcp_servers.medusa]
92 url = "https://docs.medusajs.com/mcp"
93 bearer_token_env_var = "{token}"
94 ```
95
96 </CodeTab>
97 </CodeTabs>
98
99 If you're connecting with OAuth, run the following command in your terminal to authenticate with your Cloud account:
100
101 ```bash
102 codex mcp login medusa
103 ```
104
105 This will open a browser window where you can log into your Cloud account to authenticate.
106
107 ### Cursor
108
109 Add the following to your `.cursor/mcp.json` file or Cursor settings, as explained in the [Cursor documentation](https://cursor.com/docs/mcp):
110
111 <CodeTabs group="mcp-server-auth">
112 <CodeTab label="OAuth" value="oauth">
113
114 ```json title=".cursor/mcp.json"
115 {
116 "mcpServers": {
117 "medusa": {
118 "url": "https://docs.medusajs.com/mcp"
119 }
120 }
121 }
122 ```
123
124 </CodeTab>
125 <CodeTab label="Personal Access Key" value="personal-access-key">
126
127 ```json title=".cursor/mcp.json"
128 {
129 "mcpServers": {
130 "medusa": {
131 "url": "https://docs.medusajs.com/mcp",
132 "headers": {
133 "Authorization": "Bearer {token}"
134 }
135 }
136 }
137 }
138 ```
139
140 </CodeTab>
141 </CodeTabs>
142
143 If you're connecting with OAuth, open Settings -> Tools & MCPs and click "Connect" next to the `medusa` MCP server. This will open a browser window where you can log into your Cloud account to authenticate.
144
145 ### VS Code
146
147 <Link href="https://vscode.dev/redirect/mcp/install?name=medusa&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fdocs.medusajs.com%2Fmcp%22%7D" target="_blank" rel="noopener noreferrer" variant="content">Click here</Link> to add the Docs MCP server to VSCode.
148
149 To manually connect to the Docs MCP server in VSCode, add the following to your `.vscode/mcp.json` file in your workspace:
150
151 <CodeTabs group="mcp-server-auth">
152 <CodeTab label="OAuth" value="oauth">
153
154 ```json title=".vscode/mcp.json"
155 {
156 "servers": {
157 "medusa": {
158 "type": "http",
159 "url": "https://docs.medusajs.com/mcp"
160 }
161 }
162 }
163 ```
164
165 </CodeTab>
166 <CodeTab label="Personal Access Key" value="personal-access-key">
167
168 ```json title=".vscode/mcp.json"
169 {
170 "servers": {
171 "medusa": {
172 "type": "http",
173 "url": "https://docs.medusajs.com/mcp",
174 "headers": {
175 "Authorization": "Bearer {token}"
176 }
177 }
178 }
179 }
180 ```
181
182 </CodeTab>
183 </CodeTabs>
184
185 If you're connecting with OAuth, once you start the MCP server connection, you will be prompted to authenticate with your Cloud account in a browser window. Log in to authenticate and start using the Docs MCP server in VSCode.
186
187 ### OpenCode
188
189 Add the following to your [OpenCode config file](https://opencode.ai/docs/config/) (for example, `~/.config/opencode/opencode.json`):
190
191 <CodeTabs group="mcp-server-auth">
192 <CodeTab label="OAuth" value="oauth">
193
194 ```json title="~/.config/opencode/opencode.json"
195 {
196 "$schema": "https://opencode.ai/config.json",
197 "mcp": {
198 "medusa": {
199 "type": "remote",
200 "url": "https://docs.medusajs.com/mcp"
201 }
202 },
203 }
204 ```
205
206 </CodeTab>
207 <CodeTab label="Personal Access Key" value="personal-access-key">
208
209 ```json title="~/.config/opencode/opencode.json"
210 {
211 "$schema": "https://opencode.ai/config.json",
212 "mcp": {
213 "medusa": {
214 "type": "remote",
215 "url": "https://docs.medusajs.com/mcp",
216 "headers": {
217 "Authorization": "Bearer {token}"
218 },
219 "oauth": false
220 }
221 },
222 }
223 ```
224
225 </CodeTab>
226 </CodeTabs>
227
228 If you're connecting with OAuth, run the following command in your terminal to authenticate with your Cloud account:
229
230 ```bash
231 opencode mcp auth medusa
232 ```
233
234 This will open a browser window where you can log into your Cloud account to authenticate.
235
236 ---
237
238 ## How to Use the Docs MCP Server
239
240 After connecting to the Docs MCP server in your AI tool or IDE, you can start asking questions or requesting your AI assistant to build Medusa customizations. It will fetch the relevant information from the Medusa documentation and provide you with accurate answers, code snippets, and explanations.
241
242 For example, you can ask:
243
244 1. "Create a Product Review module for Medusa. Refer to the Medusa documentation for information."
245 2. "How to update Medusa to the latest version?"
246 3. "Explain the Medusa workflow system."
247 4. "Integrate Medusa with X provider. Refer to the Medusa documentation for information."
248
249 ---
250
251 ## Docs MCP Server Tools
252
253 Beyond answering questions from the documentation, the Docs MCP server provides tools that return curated, step-by-step implementation guides for common tasks. These guides tell your AI agent exactly which Medusa APIs and patterns to use, so it doesn't have to infer them.
254
255 The following chapters cover each tool, who it's useful for, and how to use it:
256
257 <ChildDocs type="item" onlyTopLevel />