Skip to content

Commit 76b1d1e

Browse files
committed
docs: fix markdownlint in auth multiprotocol docs
1 parent 1ad8c89 commit 76b1d1e

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

docs/authorization-multiprotocol.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Discovery answers: *Which auth protocols does this resource support, and where i
5858
- For the protocol list: if the PRM has `mcp_auth_protocols`, use it (priority 1). Otherwise try path-relative `/.well-known/authorization_servers{path}`, then root `/.well-known/authorization_servers`. If both fail and the PRM has `authorization_servers`, use OAuth fallback.
5959
- Merge the protocol list with WWW-Authenticate `auth_protocols` if present, then select one via `AuthProtocolRegistry.select_protocol(available, default_protocol, preferences)`.
6060

61-
**Relationship between authorization URL endpoints**
61+
#### Relationship between authorization URL endpoints
6262

6363
There are three distinct URL trees involved:
6464

@@ -70,9 +70,9 @@ There are three distinct URL trees involved:
7070
| **MCP Resource Server (RS)** | `/.well-known/authorization_servers` | RS | Unified protocol discovery (MCP extension): `protocols`, `default_protocol`, `protocol_preferences` |
7171
| **MCP Resource Server (RS)** | `/{resource_path}` (e.g. `/mcp`) | RS | Protected MCP endpoint |
7272

73-
**URL tree (example: AS on 9000, RS on 8002)**
73+
#### URL tree (example: AS on 9000, RS on 8002)
7474

75-
```
75+
```text
7676
OAuth Authorization Server (http://localhost:9000)
7777
├── /.well-known/oauth-authorization-server ← OAuth AS metadata
7878
├── /authorize
@@ -87,7 +87,7 @@ MCP Resource Server (http://localhost:8002)
8787
└── /mcp ← Protected MCP endpoint
8888
```
8989

90-
**Client discovery order**
90+
#### Client discovery order
9191

9292
1. On 401, read `resource_metadata` from WWW-Authenticate (e.g. `http://localhost:8002/.well-known/oauth-protected-resource/mcp`).
9393
2. If absent, try the path-based URL: `{origin}/.well-known/oauth-protected-resource{resource_path}` (e.g. `http://localhost:8002/.well-known/oauth-protected-resource/mcp`).
@@ -184,9 +184,9 @@ The server exposes protected MCP endpoints and declares supported auth methods v
184184
2. **Unified discovery**`create_authorization_servers_discovery_routes(protocols, default_protocol, protocol_preferences)` registers `/.well-known/authorization_servers`. The handler returns `{ "protocols": [ AuthProtocolMetadata, ... ] }` plus optional default and preferences.
185185
3. **401 responses** — Middleware (e.g. RequireAuthMiddleware) returns 401 with WWW-Authenticate including at least Bearer (and optionally `resource_metadata`, `auth_protocols`, `default_protocol`, `protocol_preferences`).
186186

187-
**Configuration and URL tree — requirements by server type**
187+
#### Configuration and URL tree — requirements by server type
188188

189-
**Authorization Server (AS) — configuration requirements**
189+
#### Authorization Server (AS) — configuration requirements
190190

191191
| Item | Description |
192192
|------|-------------|
@@ -198,7 +198,7 @@ The server exposes protected MCP endpoints and declares supported auth methods v
198198

199199
No changes to the AS are required for multi-protocol itself; the AS need only support standard OAuth 2.0 and (optionally) DPoP-bound tokens.
200200

201-
**MCP Resource Server (RS) — configuration requirements**
201+
#### MCP Resource Server (RS) — configuration requirements
202202

203203
| Item | Description |
204204
|------|-------------|
@@ -355,13 +355,15 @@ If you use `OAuthClientProvider` or `simple-auth-client` and want to add multi-p
355355
#### Step 2: Client — switch to MultiProtocolAuthProvider
356356

357357
**Before (OAuth only):**
358+
358359
```python
359360
from mcp.client.auth.oauth2 import OAuthClientProvider
360361
provider = OAuthClientProvider(...)
361362
client = httpx.AsyncClient(auth=provider)
362363
```
363364

364365
**After (multi-protocol):**
366+
365367
```python
366368
from mcp.client.auth.multi_protocol import MultiProtocolAuthProvider, TokenStorage
367369
from mcp.client.auth.registry import AuthProtocolRegistry
@@ -388,6 +390,7 @@ provider._http_client = client
388390
- Alternatively, use `OAuthTokenStorageAdapter` to wrap storage that supports only OAuthToken.
389391

390392
**If you add API Key:**
393+
391394
```python
392395
async def get_tokens(self) -> AuthCredentials | OAuthToken | None:
393396
return self._creds # may be OAuthToken or APIKeyCredentials
@@ -399,6 +402,7 @@ async def set_tokens(self, tokens: AuthCredentials | OAuthToken) -> None:
399402
#### Step 4: Server — add MultiProtocolAuthBackend and PRM extensions
400403

401404
**Before (OAuth only):**
405+
402406
```python
403407
# Single OAuth verifier
404408
token_verifier = TokenVerifier(...)
@@ -407,6 +411,7 @@ oauth_verifier = OAuthTokenVerifier(token_verifier)
407411
```
408412

409413
**After (multi-protocol):**
414+
410415
```python
411416
from mcp.server.auth.verifiers import (
412417
MultiProtocolAuthBackend,

examples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ for real-world servers.
88

99
- **Server**: [simple-auth-multiprotocol](servers/simple-auth-multiprotocol/) — RS with OAuth, API Key, DPoP, and Mutual TLS (placeholder).
1010

11-
**API Key**
11+
### API Key
1212

1313
- Use `MCP_API_KEY` on the client; start RS with `--api-keys=...` (no AS required).
1414
- One-command test (from repo root): `MCP_AUTH_PROTOCOL=api_key ./scripts/run_phase2_multiprotocol_integration_test.sh`
1515

16-
**OAuth + DPoP**
16+
### OAuth + DPoP
1717

1818
- Start AS and RS with `--dpop-enabled`; client: `MCP_USE_OAUTH=1 MCP_DPOP_ENABLED=1`.
1919
- One-command test (from repo root): `./scripts/run_phase4_dpop_integration_test.sh` (use `MCP_SKIP_OAUTH=1` to skip manual OAuth step).
2020

21-
**Mutual TLS (placeholder)**
21+
### Mutual TLS (placeholder)
2222

2323
- mTLS is a placeholder (no client cert validation). Script: `MCP_AUTH_PROTOCOL=mutual_tls ./scripts/run_phase2_multiprotocol_integration_test.sh`
2424
- mTLS is a placeholder (no client cert validation). Script: `MCP_AUTH_PROTOCOL=mutual_tls ./scripts/run_phase2_multiprotocol_integration_test.sh`

examples/servers/simple-auth-multiprotocol/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ MCP Resource Server example that supports **OAuth 2.0** (introspection), **API K
2424
You can run the Resource Server **without** the Authorization Server when using API Key authentication:
2525

2626
1. **Start the Resource Server** (from this directory):
27+
2728
```bash
2829
uv run mcp-simple-auth-multiprotocol-rs --port=8002 --api-keys=demo-api-key-12345
2930
```
3031

3132
2. **Run the client** from `examples/clients/simple-auth-multiprotocol-client`:
33+
3234
```bash
3335
MCP_SERVER_URL=http://localhost:8002/mcp MCP_API_KEY=demo-api-key-12345 uv run mcp-simple-auth-multiprotocol-client
3436
```
@@ -47,14 +49,17 @@ DPoP (Demonstrating Proof-of-Possession, RFC 9449) binds the access token to a c
4749
`uv run mcp-simple-auth-as --port=9000`
4850

4951
2. **Start this Resource Server with DPoP enabled** (from this directory):
52+
5053
```bash
5154
uv run mcp-simple-auth-multiprotocol-rs --port=8002 --auth-server=http://localhost:9000 --api-keys=demo-api-key-12345 --dpop-enabled
5255
```
5356

5457
3. **Run the client** with OAuth and DPoP from `examples/clients/simple-auth-multiprotocol-client`:
58+
5559
```bash
5660
MCP_SERVER_URL=http://localhost:8002/mcp MCP_USE_OAUTH=1 MCP_DPOP_ENABLED=1 uv run mcp-simple-auth-multiprotocol-client
5761
```
62+
5863
Complete OAuth in the browser, then at `mcp>` run `list`, `call get_time {}`, `quit`. Server logs should show "Authentication successful with DPoP".
5964

6065
**One-command verification** (from repo root):
@@ -72,7 +77,7 @@ Mutual TLS is a **placeholder** in this example: the server accepts the `mutual_
7277
## Options
7378

7479
- `--port`: RS port (default 8002).
75-
- `--auth-server`: AS URL (default http://localhost:9000).
80+
- `--auth-server`: AS URL (default <http://localhost:9000>).
7681
- `--api-keys`: Comma-separated valid API keys (default demo-api-key-12345).
7782
- `--oauth-strict`: Enable RFC 8707 resource validation.
7883
- `--dpop-enabled`: Enable DPoP proof verification (RFC 9449); use with OAuth.

tests/PHASE1_OAUTH2_REGRESSION_TEST_PLAN.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Run existing tests to ensure no regressions. Phase 1 does not change call sites:
4747

4848
- **RequireAuthMiddleware**
4949
- Instantiate with only `(app, required_scopes, resource_metadata_url)`.
50-
- WWW-Authenticate must still start with `Bearer ` and include `error`, `error_description`, and optionally `resource_metadata`; no requirement for `auth_protocols` / `default_protocol` / `protocol_preferences`.
50+
- WWW-Authenticate must still start with `Bearer` and include `error`, `error_description`, and optionally `resource_metadata`; no requirement for `auth_protocols` / `default_protocol` / `protocol_preferences`.
5151
- Existing tests in `tests/server/auth/middleware/test_bearer_auth.py` (e.g. `TestRequireAuthMiddleware`) must pass.
5252

5353
### 3.4 Commands
@@ -72,12 +72,14 @@ Manual (or script-assisted) run to confirm the full OAuth2 flow still works with
7272

7373
1. **Start Authorization Server (AS)**
7474
From `examples/servers/simple-auth`:
75+
7576
```bash
7677
uv run mcp-simple-auth-as --port=9000
7778
```
7879

7980
2. **Start Resource Server (RS)**
8081
In another terminal, from `examples/servers/simple-auth`:
82+
8183
```bash
8284
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http
8385
```
@@ -90,6 +92,7 @@ Manual (or script-assisted) run to confirm the full OAuth2 flow still works with
9092

9193
4. **Run client**
9294
From `examples/clients/simple-auth-client`:
95+
9396
```bash
9497
MCP_SERVER_PORT=8001 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client
9598
```

0 commit comments

Comments
 (0)