Skip to content

Commit 8cf6138

Browse files
authored
Merge pull request modelcontextprotocol#624 from jonathanhefner/fix-ci-for-mdx-files
Fix CI for MDX files
2 parents c976a81 + 19f7bbe commit 8cf6138

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1255
-569
lines changed

.github/workflows/markdown-format.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ on:
44
push:
55
paths:
66
- '**/*.md'
7+
- '**/*.mdx'
78
pull_request:
89
paths:
910
- '**/*.md'
11+
- '**/*.mdx'
1012

1113
jobs:
1214
format:
1315
runs-on: ubuntu-latest
1416
steps:
1517
- uses: actions/checkout@v4
16-
18+
1719
- name: Setup Node.js
1820
uses: actions/setup-node@v4
1921
with:
2022
node-version: '20'
21-
23+
2224
- name: Install dependencies
2325
run: npm ci
24-
26+
2527
- name: Check markdown formatting
26-
run: npm run format:check
28+
run: npm run format:check

docs/clients.mdx

Lines changed: 169 additions & 60 deletions
Large diffs are not rendered by default.

docs/development/roadmap.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ description: Our plans for evolving Model Context Protocol
77

88
The Model Context Protocol is rapidly evolving. This page outlines our current thinking on key priorities and direction for approximately **the next six months**, though these may change significantly as the project develops. To see what's changed recently, check out the **[specification changelog](/specification/2025-03-26/changelog/)**.
99

10-
<Note>The ideas presented here are not commitments—we may solve these challenges differently than described, or some may not materialize at all. This is also not an _exhaustive_ list; we may incorporate work that isn't mentioned here.</Note>
10+
<Note>
11+
12+
The ideas presented here are not commitments—we may solve these challenges differently than described, or some may not materialize at all. This is also not an _exhaustive_ list; we may incorporate work that isn't mentioned here.
13+
14+
</Note>
1115

1216
We value community participation! Each section links to relevant discussions where you can learn more and contribute your thoughts.
1317

docs/docs/concepts/architecture.mdx

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The protocol layer handles message framing, request/response linking, and high-l
3838

3939
<Tabs>
4040
<Tab title="TypeScript">
41+
4142
```typescript
4243
class Protocol<Request, Notification, Result> {
4344
// Handle incoming requests
@@ -53,8 +54,10 @@ The protocol layer handles message framing, request/response linking, and high-l
5354
notification(notification: Notification): Promise<void>
5455
}
5556
```
57+
5658
</Tab>
5759
<Tab title="Python">
60+
5861
```python
5962
class Session(BaseSession[RequestT, NotificationT, ResultT]):
6063
async def send_request(
@@ -86,20 +89,22 @@ The protocol layer handles message framing, request/response linking, and high-l
8689
"""Handle incoming notification from other side."""
8790
# Notification handling implementation
8891
```
92+
8993
</Tab>
9094
</Tabs>
9195

9296
Key classes include:
9397

94-
* `Protocol`
95-
* `Client`
96-
* `Server`
98+
- `Protocol`
99+
- `Client`
100+
- `Server`
97101

98102
### Transport layer
99103

100104
The transport layer handles the actual communication between clients and servers. MCP supports multiple transport mechanisms:
101105

102106
1. **Stdio transport**
107+
103108
- Uses standard input/output for communication
104109
- Ideal for local processes
105110

@@ -114,36 +119,39 @@ All transports use [JSON-RPC](https://www.jsonrpc.org/) 2.0 to exchange messages
114119
MCP has these main types of messages:
115120

116121
1. **Requests** expect a response from the other side:
117-
```typescript
118-
interface Request {
119-
method: string;
120-
params?: { ... };
121-
}
122-
```
122+
123+
```typescript
124+
interface Request {
125+
method: string;
126+
params?: { ... };
127+
}
128+
```
123129

124130
2. **Results** are successful responses to requests:
125-
```typescript
126-
interface Result {
127-
[key: string]: unknown;
128-
}
129-
```
131+
132+
```typescript
133+
interface Result {
134+
[key: string]: unknown;
135+
}
136+
```
130137

131138
3. **Errors** indicate that a request failed:
132-
```typescript
133-
interface Error {
134-
code: number;
135-
message: string;
136-
data?: unknown;
137-
}
138-
```
139+
140+
```typescript
141+
interface Error {
142+
code: number;
143+
message: string;
144+
data?: unknown;
145+
}
146+
```
139147

140148
4. **Notifications** are one-way messages that don't expect a response:
141-
```typescript
142-
interface Notification {
143-
method: string;
144-
params?: { ... };
145-
}
146-
```
149+
```typescript
150+
interface Notification {
151+
method: string;
152+
params?: { ... };
153+
}
154+
```
147155

148156
## Connection lifecycle
149157

@@ -176,6 +184,7 @@ After initialization, the following patterns are supported:
176184
### 3. Termination
177185

178186
Either party can terminate the connection:
187+
179188
- Clean shutdown via `close()`
180189
- Transport disconnection
181190
- Error conditions
@@ -191,13 +200,14 @@ enum ErrorCode {
191200
InvalidRequest = -32600,
192201
MethodNotFound = -32601,
193202
InvalidParams = -32602,
194-
InternalError = -32603
203+
InternalError = -32603,
195204
}
196205
```
197206

198207
SDKs and applications can define their own error codes above -32000.
199208

200209
Errors are propagated through:
210+
201211
- Error responses to requests
202212
- Error events on transports
203213
- Protocol-level error handlers
@@ -208,6 +218,7 @@ Here's a basic example of implementing an MCP server:
208218

209219
<Tabs>
210220
<Tab title="TypeScript">
221+
211222
```typescript
212223
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
213224
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -237,8 +248,10 @@ Here's a basic example of implementing an MCP server:
237248
const transport = new StdioServerTransport();
238249
await server.connect(transport);
239250
```
251+
240252
</Tab>
241253
<Tab title="Python">
254+
242255
```python
243256
import asyncio
244257
import mcp.types as types
@@ -267,6 +280,7 @@ Here's a basic example of implementing an MCP server:
267280
if __name__ == "__main__":
268281
asyncio.run(main())
269282
```
283+
270284
</Tab>
271285
</Tabs>
272286

@@ -275,6 +289,7 @@ Here's a basic example of implementing an MCP server:
275289
### Transport selection
276290

277291
1. **Local communication**
292+
278293
- Use stdio transport for local processes
279294
- Efficient for same-machine communication
280295
- Simple process management
@@ -286,12 +301,14 @@ Here's a basic example of implementing an MCP server:
286301
### Message handling
287302

288303
1. **Request processing**
304+
289305
- Validate inputs thoroughly
290306
- Use type-safe schemas
291307
- Handle errors gracefully
292308
- Implement timeouts
293309

294310
2. **Progress reporting**
311+
295312
- Use progress tokens for long operations
296313
- Report progress incrementally
297314
- Include total progress when known
@@ -304,17 +321,20 @@ Here's a basic example of implementing an MCP server:
304321
## Security considerations
305322

306323
1. **Transport security**
324+
307325
- Use TLS for remote connections
308326
- Validate connection origins
309327
- Implement authentication when needed
310328

311329
2. **Message validation**
330+
312331
- Validate all incoming messages
313332
- Sanitize inputs
314333
- Check message size limits
315334
- Verify JSON-RPC format
316335

317336
3. **Resource protection**
337+
318338
- Implement access controls
319339
- Validate resource paths
320340
- Monitor resource usage
@@ -329,12 +349,14 @@ Here's a basic example of implementing an MCP server:
329349
## Debugging and monitoring
330350

331351
1. **Logging**
352+
332353
- Log protocol events
333354
- Track message flow
334355
- Monitor performance
335356
- Record errors
336357

337358
2. **Diagnostics**
359+
338360
- Implement health checks
339361
- Monitor connection state
340362
- Track resource usage

docs/docs/concepts/prompts.mdx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ description: "Create reusable prompt templates and workflows"
66
Prompts enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.
77

88
<Note>
9-
Prompts are designed to be **user-controlled**, meaning they are exposed from servers to clients with the intention of the user being able to explicitly select them for use.
9+
10+
Prompts are designed to be **user-controlled**, meaning they are exposed from servers to clients with the intention of the user being able to explicitly select them for use.
11+
1012
</Note>
1113

1214
## Overview
1315

1416
Prompts in MCP are predefined templates that can:
17+
1518
- Accept dynamic arguments
1619
- Include context from resources
1720
- Chain multiple interactions
@@ -43,7 +46,7 @@ Clients can discover available prompts through the `prompts/list` endpoint:
4346
```typescript
4447
// Request
4548
{
46-
method: "prompts/list"
49+
method: "prompts/list";
4750
}
4851

4952
// Response
@@ -56,19 +59,19 @@ Clients can discover available prompts through the `prompts/list` endpoint:
5659
{
5760
name: "language",
5861
description: "Programming language",
59-
required: true
60-
}
61-
]
62-
}
63-
]
62+
required: true,
63+
},
64+
],
65+
},
66+
];
6467
}
6568
```
6669

6770
## Using prompts
6871

6972
To use a prompt, clients make a `prompts/get` request:
7073

71-
```typescript
74+
````typescript
7275
// Request
7376
{
7477
method: "prompts/get",
@@ -93,7 +96,7 @@ To use a prompt, clients make a `prompts/get` request:
9396
}
9497
]
9598
}
96-
```
99+
````
97100

98101
## Dynamic prompts
99102

@@ -169,25 +172,25 @@ const debugWorkflow = {
169172
role: "user",
170173
content: {
171174
type: "text",
172-
text: `Here's an error I'm seeing: ${error}`
173-
}
175+
text: `Here's an error I'm seeing: ${error}`,
176+
},
174177
},
175178
{
176179
role: "assistant",
177180
content: {
178181
type: "text",
179-
text: "I'll help analyze this error. What have you tried so far?"
180-
}
182+
text: "I'll help analyze this error. What have you tried so far?",
183+
},
181184
},
182185
{
183186
role: "user",
184187
content: {
185188
type: "text",
186-
text: "I've tried restarting the service, but the error persists."
187-
}
188-
}
189+
text: "I've tried restarting the service, but the error persists.",
190+
},
191+
},
189192
];
190-
}
193+
},
191194
};
192195
```
193196

@@ -197,6 +200,7 @@ Here's a complete example of implementing prompts in an MCP server:
197200

198201
<Tabs>
199202
<Tab title="TypeScript">
203+
200204
```typescript
201205
import { Server } from "@modelcontextprotocol/sdk/server";
202206
import {
@@ -289,8 +293,10 @@ Here's a complete example of implementing prompts in an MCP server:
289293
throw new Error("Prompt implementation not found");
290294
});
291295
```
296+
292297
</Tab>
293298
<Tab title="Python">
299+
294300
```python
295301
from mcp.server import Server
296302
import mcp.types as types
@@ -372,6 +378,7 @@ Here's a complete example of implementing prompts in an MCP server:
372378

373379
raise ValueError("Prompt implementation not found")
374380
```
381+
375382
</Tab>
376383
</Tabs>
377384

0 commit comments

Comments
 (0)