Skip to content

Commit e0a7d3b

Browse files
authored
Merge pull request modelcontextprotocol#667 from jonathanhefner/section-numbers
Add automatic section numbers via CSS
2 parents 8090380 + bfb0c5b commit e0a7d3b

22 files changed

+187
-81
lines changed

docs/introduction.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ flowchart LR
4545

4646
Choose the path that best fits your needs:
4747

48-
#### Quick Starts
48+
### Quick Starts
4949

5050
<CardGroup cols={2}>
5151
<Card title="For Server Developers" icon="bolt" href="/quickstart/server">
@@ -60,7 +60,7 @@ Choose the path that best fits your needs:
6060
</Card>
6161
</CardGroup>
6262

63-
#### Examples
63+
### Examples
6464

6565
<CardGroup cols={2}>
6666
<Card title="Example Servers" icon="grid" href="/examples">

docs/specification/2025-03-26/basic/authorization.mdx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ title: Authorization
44

55
<Info>**Protocol Revision**: 2025-03-26</Info>
66

7-
## 1. Introduction
7+
## Introduction
88

9-
### 1.1 Purpose and Scope
9+
### Purpose and Scope
1010

1111
The Model Context Protocol provides authorization capabilities at the transport level,
1212
enabling MCP clients to make requests to restricted MCP servers on behalf of resource
1313
owners. This specification defines the authorization flow for HTTP-based transports.
1414

15-
### 1.2 Protocol Requirements
15+
### Protocol Requirements
1616

1717
Authorization is **OPTIONAL** for MCP implementations. When supported:
1818

@@ -22,7 +22,7 @@ Authorization is **OPTIONAL** for MCP implementations. When supported:
2222
- Implementations using alternative transports **MUST** follow established security best
2323
practices for their protocol.
2424

25-
### 1.3 Standards Compliance
25+
### Standards Compliance
2626

2727
This authorization mechanism is based on established specifications listed below, but
2828
implements a selected subset of their features to ensure security and interoperability
@@ -34,9 +34,9 @@ while maintaining simplicity:
3434
- OAuth 2.0 Dynamic Client Registration Protocol
3535
([RFC7591](https://datatracker.ietf.org/doc/html/rfc7591))
3636

37-
## 2. Authorization Flow
37+
## Authorization Flow
3838

39-
### 2.1 Overview
39+
### Overview
4040

4141
1. MCP auth implementations **MUST** implement OAuth 2.1 with appropriate security
4242
measures for both confidential and public clients.
@@ -49,7 +49,7 @@ while maintaining simplicity:
4949
that do not support Authorization Server Metadata **MUST** follow the default URI
5050
schema.
5151

52-
### 2.1.1 OAuth Grant Types
52+
### OAuth Grant Types
5353

5454
OAuth specifies different flows or grant types, which are different ways of obtaining an
5555
access token. Each of these targets different use cases and scenarios.
@@ -63,7 +63,7 @@ audience. For instance:
6363
- For instance, an agent calls a secure MCP tool to check inventory at a specific
6464
store. No need to impersonate the end user.
6565

66-
### 2.2 Example: authorization code grant
66+
### Example: authorization code grant
6767

6868
This demonstrates the OAuth 2.1 flow for the authorization code grant type, used for user
6969
auth.
@@ -104,7 +104,7 @@ sequenceDiagram
104104
Note over C,M: Begin standard MCP message exchange
105105
```
106106

107-
### 2.3 Server Metadata Discovery
107+
### Server Metadata Discovery
108108

109109
For server capability discovery:
110110

@@ -132,15 +132,15 @@ sequenceDiagram
132132
Note over C: Continue with authorization flow
133133
```
134134

135-
#### 2.3.1 Server Metadata Discovery Headers
135+
#### Server Metadata Discovery Headers
136136

137137
MCP clients _SHOULD_ include the header `MCP-Protocol-Version: <protocol-version>` during
138138
Server Metadata Discovery to allow the MCP server to respond based on the MCP protocol
139139
version.
140140

141141
For example: `MCP-Protocol-Version: 2024-11-05`
142142

143-
#### 2.3.2 Authorization Base URL
143+
#### Authorization Base URL
144144

145145
The authorization base URL **MUST** be determined from the MCP server URL by discarding
146146
any existing `path` component. For example:
@@ -154,11 +154,11 @@ If the MCP server URL is `https://api.example.com/v1/mcp`, then:
154154
This ensures authorization endpoints are consistently located at the root level of the
155155
domain hosting the MCP server, regardless of any path components in the MCP server URL.
156156

157-
#### 2.3.3 Fallbacks for Servers without Metadata Discovery
157+
#### Fallbacks for Servers without Metadata Discovery
158158

159159
For servers that do not implement OAuth 2.0 Authorization Server Metadata, clients
160-
**MUST** use the following default endpoint paths relative to the authorization base URL
161-
(as defined in [Section 2.3.2](#232-authorization-base-url)):
160+
**MUST** use the following default endpoint paths relative to the [authorization base
161+
URL](#authorization-base-url):
162162

163163
| Endpoint | Default Path | Description |
164164
| ---------------------- | ------------ | ------------------------------------ |
@@ -177,7 +177,7 @@ Clients **MUST** first attempt to discover endpoints via the metadata document b
177177
falling back to default paths. When using default paths, all other protocol requirements
178178
remain unchanged.
179179

180-
### 2.4 Dynamic Client Registration
180+
### Dynamic Client Registration
181181

182182
MCP clients and servers **SHOULD** support the
183183
[OAuth 2.0 Dynamic Client Registration Protocol](https://datatracker.ietf.org/doc/html/rfc7591)
@@ -200,7 +200,7 @@ these servers, MCP clients will have to either:
200200
OAuth client themselves (e.g., through a configuration interface hosted by the
201201
server).
202202

203-
### 2.5 Authorization Flow Steps
203+
### Authorization Flow Steps
204204

205205
The complete Authorization flow proceeds as follows:
206206

@@ -233,7 +233,7 @@ sequenceDiagram
233233
C->>M: API Requests with Access Token
234234
```
235235

236-
#### 2.5.1 Decision Flow Overview
236+
#### Decision Flow Overview
237237

238238
```mermaid
239239
flowchart TD
@@ -257,9 +257,9 @@ flowchart TD
257257
N --> O[Use Access Token]
258258
```
259259

260-
### 2.6 Access Token Usage
260+
### Access Token Usage
261261

262-
#### 2.6.1 Token Requirements
262+
#### Token Requirements
263263

264264
Access token handling **MUST** conform to
265265
[OAuth 2.1 Section 5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-5)
@@ -285,7 +285,7 @@ Host: mcp.example.com
285285
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
286286
```
287287

288-
#### 2.6.2 Token Handling
288+
#### Token Handling
289289

290290
Resource servers **MUST** validate access tokens as described in
291291
[Section 5.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-5.2).
@@ -294,7 +294,7 @@ If validation fails, servers **MUST** respond according to
294294
error handling requirements. Invalid or expired tokens **MUST** receive a HTTP 401
295295
response.
296296

297-
### 2.7 Security Considerations
297+
### Security Considerations
298298

299299
The following security requirements **MUST** be implemented:
300300

@@ -304,7 +304,7 @@ The following security requirements **MUST** be implemented:
304304
4. Servers **MUST** validate redirect URIs to prevent open redirect vulnerabilities
305305
5. Redirect URIs **MUST** be either localhost URLs or HTTPS URLs
306306

307-
### 2.8 Error Handling
307+
### Error Handling
308308

309309
Servers **MUST** return appropriate HTTP status codes for authorization errors:
310310

@@ -314,22 +314,22 @@ Servers **MUST** return appropriate HTTP status codes for authorization errors:
314314
| 403 | Forbidden | Invalid scopes or insufficient permissions |
315315
| 400 | Bad Request | Malformed authorization request |
316316

317-
### 2.9 Implementation Requirements
317+
### Implementation Requirements
318318

319319
1. Implementations **MUST** follow OAuth 2.1 security best practices
320320
2. PKCE is **REQUIRED** for all clients
321321
3. Token rotation **SHOULD** be implemented for enhanced security
322322
4. Token lifetimes **SHOULD** be limited based on security requirements
323323

324-
### 2.10 Third-Party Authorization Flow
324+
### Third-Party Authorization Flow
325325

326-
#### 2.10.1 Overview
326+
#### Overview
327327

328328
MCP servers **MAY** support delegated authorization through third-party authorization
329329
servers. In this flow, the MCP server acts as both an OAuth client (to the third-party
330330
auth server) and an OAuth authorization server (to the MCP client).
331331

332-
#### 2.10.2 Flow Description
332+
#### Flow Description
333333

334334
The third-party authorization flow comprises these steps:
335335

@@ -363,7 +363,7 @@ sequenceDiagram
363363
M->>C: MCP access token
364364
```
365365

366-
#### 2.10.3 Session Binding Requirements
366+
#### Session Binding Requirements
367367

368368
MCP servers implementing third-party authorization **MUST**:
369369

@@ -372,7 +372,7 @@ MCP servers implementing third-party authorization **MUST**:
372372
3. Implement appropriate token lifecycle management
373373
4. Handle third-party token expiration and renewal
374374

375-
#### 2.10.4 Security Considerations
375+
#### Security Considerations
376376

377377
When implementing third-party authorization, servers **MUST**:
378378

@@ -382,9 +382,9 @@ When implementing third-party authorization, servers **MUST**:
382382
4. Consider security implications of token chaining
383383
5. Implement proper error handling for third-party auth failures
384384

385-
## 3. Best Practices
385+
## Best Practices
386386

387-
#### 3.1 Local clients as Public OAuth 2.1 Clients
387+
#### Local clients as Public OAuth 2.1 Clients
388388

389389
We strongly recommend that local clients implement OAuth 2.1 as a public client:
390390

@@ -394,13 +394,13 @@ We strongly recommend that local clients implement OAuth 2.1 as a public client:
394394
3. Following token refresh best practices to maintain sessions
395395
4. Properly handling token expiration and renewal
396396

397-
#### 3.2 Authorization Metadata Discovery
397+
#### Authorization Metadata Discovery
398398

399399
We strongly recommend that all clients implement metadata discovery. This reduces the
400400
need for users to provide endpoints manually or clients to fallback to the defined
401401
defaults.
402402

403-
#### 3.3 Dynamic Client Registration
403+
#### Dynamic Client Registration
404404

405405
Since clients do not know the set of MCP servers in advance, we strongly recommend the
406406
implementation of dynamic client registration. This allows applications to automatically

docs/specification/draft/architecture/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: Architecture
33
---
44

5+
<div id="enable-section-numbers" />
6+
57
The Model Context Protocol (MCP) follows a client-host-server architecture where each
68
host can run multiple client instances. This architecture enables users to integrate AI
79
capabilities across applications while maintaining clear security boundaries and

0 commit comments

Comments
 (0)