Skip to content

Commit 0b64349

Browse files
Fix CI for MDX files
Most `*.md` files were converted to `*.mdx` in modelcontextprotocol#283, but `package.json` scripts and CI config were not updated to match. This commit makes the necessary updates. Unfortunately, Prettier currently only supports MDX v1 (see [prettier#15221][] and [prettier#12209][]), which causes it to treat content inside JSX tags as JSX instead of Markdown unless the content is surrounded by blank lines (see [prettier#16589][]). Therefore, this commit also adds blank lines inside JSX elements where necessary. This commit also removes the 89-character line wrap rule for `.md` files rather than update it for `.mdx` files. It's not clear that the rule was helpful, and we already have many files that do not abide by it: ```console $ grep -l '.{90}' docs/**/*.mdx | wc -l 59 ``` For ease of rebasing, this commit _does not_ actually format the files using Prettier. That will be done in the next commit. [prettier#15221]: prettier/prettier#15221 [prettier#12209]: prettier/prettier#12209 [prettier#16589]: prettier/prettier#16589
1 parent c976a81 commit 0b64349

File tree

28 files changed

+437
-85
lines changed

28 files changed

+437
-85
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/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: 8 additions & 0 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,6 +89,7 @@ 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

@@ -208,6 +212,7 @@ Here's a basic example of implementing an MCP server:
208212

209213
<Tabs>
210214
<Tab title="TypeScript">
215+
211216
```typescript
212217
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
213218
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -237,8 +242,10 @@ Here's a basic example of implementing an MCP server:
237242
const transport = new StdioServerTransport();
238243
await server.connect(transport);
239244
```
245+
240246
</Tab>
241247
<Tab title="Python">
248+
242249
```python
243250
import asyncio
244251
import mcp.types as types
@@ -267,6 +274,7 @@ Here's a basic example of implementing an MCP server:
267274
if __name__ == "__main__":
268275
asyncio.run(main())
269276
```
277+
270278
</Tab>
271279
</Tabs>
272280

docs/docs/concepts/prompts.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ 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+
910
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
@@ -197,6 +199,7 @@ Here's a complete example of implementing prompts in an MCP server:
197199

198200
<Tabs>
199201
<Tab title="TypeScript">
202+
200203
```typescript
201204
import { Server } from "@modelcontextprotocol/sdk/server";
202205
import {
@@ -289,8 +292,10 @@ Here's a complete example of implementing prompts in an MCP server:
289292
throw new Error("Prompt implementation not found");
290293
});
291294
```
295+
292296
</Tab>
293297
<Tab title="Python">
298+
294299
```python
295300
from mcp.server import Server
296301
import mcp.types as types
@@ -372,6 +377,7 @@ Here's a complete example of implementing prompts in an MCP server:
372377

373378
raise ValueError("Prompt implementation not found")
374379
```
380+
375381
</Tab>
376382
</Tabs>
377383

docs/docs/concepts/resources.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ description: "Expose data and content from your servers to LLMs"
66
Resources are a core primitive in the Model Context Protocol (MCP) that allow servers to expose data and content that can be read by clients and used as context for LLM interactions.
77

88
<Note>
9+
910
Resources are designed to be **application-controlled**, meaning that the client application can decide how and when they should be used.
1011
Different MCP clients may handle resources differently. For example:
1112
- Claude Desktop currently requires users to explicitly select resources before they can be used
1213
- Other clients might automatically select resources based on heuristics
1314
- Some implementations may even allow the AI model itself to determine which resources to use
1415

1516
Server authors should be prepared to handle any of these interaction patterns when implementing resource support. In order to expose data to models automatically, server authors should use a **model-controlled** primitive such as [Tools](./tools).
17+
1618
</Note>
1719

1820
## Overview
@@ -119,7 +121,9 @@ The server responds with a list of resource contents:
119121
```
120122

121123
<Tip>
124+
122125
Servers may return multiple resources in response to one `resources/read` request. This could be used, for example, to return a list of files inside a directory when the directory is read.
126+
123127
</Tip>
124128

125129
## Resource updates
@@ -145,6 +149,7 @@ Here's a simple example of implementing resource support in an MCP server:
145149

146150
<Tabs>
147151
<Tab title="TypeScript">
152+
148153
```typescript
149154
const server = new Server({
150155
name: "example-server",
@@ -188,8 +193,10 @@ Here's a simple example of implementing resource support in an MCP server:
188193
throw new Error("Resource not found");
189194
});
190195
```
196+
191197
</Tab>
192198
<Tab title="Python">
199+
193200
```python
194201
app = Server("example-server")
195202

@@ -219,6 +226,7 @@ Here's a simple example of implementing resource support in an MCP server:
219226
app.create_initialization_options()
220227
)
221228
```
229+
222230
</Tab>
223231
</Tabs>
224232

docs/docs/concepts/sampling.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ description: "Let your servers request completions from LLMs"
66
Sampling is a powerful MCP feature that allows servers to request LLM completions through the client, enabling sophisticated agentic behaviors while maintaining security and privacy.
77

88
<Info>
9+
910
This feature of MCP is not yet supported in the Claude Desktop client.
11+
1012
</Info>
1113

1214
## How sampling works

docs/docs/concepts/tools.mdx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ description: "Enable LLMs to perform actions through your server"
66
Tools are a powerful primitive in the Model Context Protocol (MCP) that enable servers to expose executable functionality to clients. Through tools, LLMs can interact with external systems, perform computations, and take actions in the real world.
77

88
<Note>
9+
910
Tools are designed to be **model-controlled**, meaning that tools are exposed from servers to clients with the intention of the AI model being able to automatically invoke them (with a human in the loop to grant approval).
11+
1012
</Note>
1113

1214
## Overview
@@ -47,6 +49,7 @@ Here's an example of implementing a basic tool in an MCP server:
4749

4850
<Tabs>
4951
<Tab title="TypeScript">
52+
5053
```typescript
5154
const server = new Server({
5255
name: "example-server",
@@ -91,8 +94,10 @@ Here's an example of implementing a basic tool in an MCP server:
9194
throw new Error("Tool not found");
9295
});
9396
```
97+
9498
</Tab>
9599
<Tab title="Python">
100+
96101
```python
97102
app = Server("example-server")
98103

@@ -125,6 +130,7 @@ Here's an example of implementing a basic tool in an MCP server:
125130
return [types.TextContent(type="text", text=str(result))]
126131
raise ValueError(f"Tool not found: {name}")
127132
```
133+
128134
</Tab>
129135
</Tabs>
130136

@@ -255,6 +261,7 @@ Here's an example of proper error handling for tools:
255261

256262
<Tabs>
257263
<Tab title="TypeScript">
264+
258265
```typescript
259266
try {
260267
// Tool operation
@@ -279,8 +286,10 @@ Here's an example of proper error handling for tools:
279286
};
280287
}
281288
```
289+
282290
</Tab>
283291
<Tab title="Python">
292+
284293
```python
285294
try:
286295
# Tool operation
@@ -304,6 +313,7 @@ Here's an example of proper error handling for tools:
304313
]
305314
)
306315
```
316+
307317
</Tab>
308318
</Tabs>
309319

@@ -403,6 +413,7 @@ Here's how to define tools with annotations for different scenarios:
403413

404414
<Tabs>
405415
<Tab title="TypeScript">
416+
406417
```typescript
407418
server.setRequestHandler(ListToolsRequestSchema, async () => {
408419
return {
@@ -426,13 +437,15 @@ Here's how to define tools with annotations for different scenarios:
426437
};
427438
});
428439
```
440+
429441
</Tab>
430442
<Tab title="Python">
443+
431444
```python
432445
from mcp.server.fastmcp import FastMCP
433-
446+
434447
mcp = FastMCP("example-server")
435-
448+
436449
@mcp.tool(
437450
annotations={
438451
"title": "Calculate Sum",
@@ -442,14 +455,15 @@ Here's how to define tools with annotations for different scenarios:
442455
)
443456
async def calculate_sum(a: float, b: float) -> str:
444457
"""Add two numbers together.
445-
458+
446459
Args:
447460
a: First number to add
448461
b: Second number to add
449462
"""
450463
result = a + b
451464
return str(result)
452465
```
466+
453467
</Tab>
454468
</Tabs>
455469

0 commit comments

Comments
 (0)