Skip to content

Commit bdfe68c

Browse files
JAORMXclaude
andauthored
Update MCP protocol expert agent to spec 2025-11-25 (#2911)
* Update MCP protocol expert agent to spec 2025-11-25 Updates the MCP protocol expert agent documentation to reflect the latest MCP specification (2025-11-25). Key changes include: - Update spec version references from 2025-06-18 to 2025-11-25 - Add Tasks section documenting the new durable state machine feature - Update Elicitation section with new URL mode for sensitive data - Note HTTP+SSE transport deprecation in favor of Streamable HTTP - Add MCP-Protocol-Version and Mcp-Session-Id header requirements - Fix key file paths to match actual codebase structure - Add new spec URLs for Tasks, Transports, and Elicitation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Add MCP 2025-11-25 authorization updates to agents Updates both MCP protocol expert and OAuth expert agents with the authorization model changes from MCP spec 2025-11-25: mcp-protocol-expert.md: - Add brief Authorization section with key points - Defer to oauth-expert for implementation details - Add Authorization and Security Best Practices URLs oauth-expert.md: - Add MCP Authorization resources (RFC 9728, 8707, Client ID Metadata) - Add comprehensive MCP Authorization Model section covering: - Client Registration Priority order - Client ID Metadata Documents (new preferred approach) - Protected Resource Metadata (RFC 9728) - Resource Indicators (RFC 8707) - MCP-specific security requirements - Note ToolHive implementation status for each feature 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6cf23d4 commit bdfe68c

File tree

2 files changed

+145
-18
lines changed

2 files changed

+145
-18
lines changed

.claude/agents/mcp-protocol-expert.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ Do NOT invoke for:
4040
The MCP specification is versioned. To find and use the latest version:
4141

4242
1. **Start here**: Fetch https://modelcontextprotocol.io to find links to current documentation
43-
2. **Known working URLs** (as of 2025-06-18 spec version):
44-
- Main overview: `https://modelcontextprotocol.io/specification/2025-06-18`
45-
- Basic spec: `https://modelcontextprotocol.io/specification/2025-06-18/basic`
46-
- Transports: `https://modelcontextprotocol.io/specification/2025-06-18/basic/transports`
47-
- Lifecycle: `https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle`
43+
2. **Known working URLs** (as of 2025-11-25 spec version):
44+
- Main overview: `https://modelcontextprotocol.io/specification/2025-11-25`
45+
- Transports: `https://modelcontextprotocol.io/specification/2025-11-25/basic/transports`
46+
- Lifecycle: `https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle`
47+
- Tasks: `https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks`
48+
- Elicitation: `https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation`
4849

49-
3. **Check for newer versions**: The date in the URL (2025-06-18) indicates spec version. Look for newer dates.
50+
3. **Check for newer versions**: The date in the URL (2025-11-25) indicates spec version. Look for newer dates.
5051

5152
4. **Always verify URLs**: If a URL gives 404, try alternative paths or check the main site.
5253

@@ -71,10 +72,11 @@ When fetching specifications during a session:
7172

7273
### Transport Types
7374

74-
Per the 2025-06-18 specification, MCP defines these transports:
75-
- **stdio**: Standard input/output (preferred, clients SHOULD support)
76-
- **Streamable HTTP**: HTTP-based transport for multiple connections
77-
- **Custom transports**: Implementations MAY add custom transports
75+
Per the 2025-11-25 specification, MCP defines two standard transports:
76+
- **stdio**: Standard input/output. Server reads JSON-RPC from stdin, writes to stdout. Messages delimited by newlines. Preferred for single-process architectures.
77+
- **Streamable HTTP**: HTTP-based transport for multiple connections. Uses POST/GET on single endpoint. Supports optional SSE for streaming. Includes session management via `Mcp-Session-Id` header. Requires `MCP-Protocol-Version` header on subsequent requests.
78+
79+
**Note**: HTTP+SSE transport from 2024-11-05 is deprecated; use Streamable HTTP instead.
7880

7981
**Always fetch the latest transport documentation** as this evolves over time.
8082

@@ -85,8 +87,9 @@ Per the 2025-06-18 specification, MCP defines these transports:
8587
- **Clients**: Connectors within host applications
8688
- **Servers**: Services providing context and capabilities
8789

88-
**Server capabilities**: Resources, Prompts, Tools
90+
**Server capabilities**: Resources, Prompts, Tools, Utilities (Completion, Logging, Pagination)
8991
**Client capabilities**: Sampling, Roots, Elicitation
92+
**Protocol utilities**: Cancellation, Ping, Progress, Tasks
9093

9194
### Lifecycle Phases
9295

@@ -102,6 +105,39 @@ Per the 2025-06-18 specification, MCP defines these transports:
102105

103106
All messages MUST follow JSON-RPC 2.0 specification.
104107

108+
### Tasks (New in 2025-11-25)
109+
110+
Tasks enable durable state machines for tracking long-running operations:
111+
- **Methods**: `tasks/list`, `tasks/get`, `tasks/cancel`, `tasks/result`
112+
- **Notification**: `notifications/tasks/status`
113+
- **Status lifecycle**: working → input_required | completed | failed | cancelled
114+
- **Key fields**: taskId, status, statusMessage, createdAt, lastUpdatedAt, ttl, pollInterval
115+
- **Capability**: Declared via `tasks.requests.*` during initialization
116+
117+
ToolHive implementation: Parser support in `pkg/mcp/parser.go`
118+
119+
### Elicitation
120+
121+
Elicitation enables servers to request information from users:
122+
- **Method**: `elicitation/create`
123+
- **Form Mode**: Direct in-band data collection with JSON schema validation
124+
- **URL Mode** (New in 2025-11-25): Out-of-band for sensitive data (credentials, OAuth flows)
125+
- **Security**: Form mode MUST NOT be used for sensitive information
126+
127+
ToolHive implementation: Full support in `pkg/vmcp/composer/elicitation_handler.go`
128+
129+
### Authorization (Updated in 2025-11-25)
130+
131+
MCP 2025-11-25 significantly updated the authorization model for HTTP transports:
132+
- Based on OAuth 2.1, RFC 9728 (Protected Resource Metadata), RFC 8707 (Resource Indicators)
133+
- **Client ID Metadata Documents** is the NEW preferred client registration (over DCR)
134+
- Token audience validation and PKCE are REQUIRED
135+
- Security best practices: `https://modelcontextprotocol.io/specification/2025-11-25/basic/security_best_practices`
136+
137+
**For OAuth/auth implementation details, defer to the oauth-expert agent.**
138+
139+
ToolHive auth implementation: `pkg/auth/` (discovery, OAuth flows, token handling)
140+
105141
## ToolHive Implementation
106142

107143
### Package Structure
@@ -111,11 +147,13 @@ All messages MUST follow JSON-RPC 2.0 specification.
111147
- `pkg/api/`: REST API server wrapping MCP servers
112148

113149
### Key Files
114-
- `pkg/transport/types.go`: Transport interface definitions
115-
- `pkg/transport/stdio/`: stdio transport implementation
116-
- `pkg/transport/http/`: HTTP transport implementation
117-
- `pkg/transport/sse/`: SSE transport (check deprecation status)
118-
- `pkg/transport/streamable/`: Streamable HTTP implementation
150+
- `pkg/transport/types/transport.go`: Transport interface definitions
151+
- `pkg/transport/stdio.go`: stdio transport implementation
152+
- `pkg/transport/http.go`: HTTP transport implementation
153+
- `pkg/transport/proxy/streamable/`: Streamable HTTP proxy implementation
154+
- `pkg/transport/proxy/httpsse/`: HTTP+SSE proxy (legacy, prefer streamable)
155+
- `pkg/transport/session/`: Session management for transports
156+
- `pkg/mcp/parser.go`: MCP JSON-RPC message parsing middleware
119157

120158
### Design Patterns
121159
- Factory pattern for transport creation
@@ -163,6 +201,9 @@ When working on MCP-related code:
163201
- Proxy functionality enables networked MCP servers
164202
- Cedar policies control access to MCP resources
165203
- Stdio is the preferred transport (clients SHOULD support it)
204+
- Streamable HTTP requires `MCP-Protocol-Version` header on requests after initialize
205+
- Session management uses `Mcp-Session-Id` header for Streamable HTTP
206+
- Tasks provide durable state tracking for long-running operations (2025-11-25+)
166207

167208
## Security Considerations
168209

@@ -176,12 +217,19 @@ Per MCP spec, always consider:
176217

177218
**Primary (Always Check First)**:
178219
- MCP Main Site: https://modelcontextprotocol.io
179-
- Specification: Check main site for latest version
220+
- Latest Spec (2025-11-25): https://modelcontextprotocol.io/specification/2025-11-25
221+
- Tasks: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks
222+
- Transports: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports
223+
- Elicitation: https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation
224+
- Authorization: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization
225+
- Security Best Practices: https://modelcontextprotocol.io/specification/2025-11-25/basic/security_best_practices
180226

181227
**ToolHive Implementation**:
182228
- Transport code: `pkg/transport/`
229+
- MCP parsing: `pkg/mcp/`
183230
- Runner code: `pkg/runner/`
184231
- API code: `pkg/api/`
232+
- vMCP (Virtual MCP): `pkg/vmcp/`
185233

186234
## Remember
187235

.claude/agents/oauth-expert.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Do NOT invoke for:
3030
- **Token Standards**: JWT, token introspection, token revocation, token exchange
3131
- **Discovery**: OAuth/OIDC discovery documents, metadata endpoints
3232
- **Security**: PKCE, state parameters, nonce, token binding
33-
- **RFC Compliance**: OAuth 2.0 (RFC 6749), OIDC Core, JWT (RFC 7519), Token Exchange (RFC 8693)
33+
- **RFC Compliance**: OAuth 2.0/2.1, OIDC Core, JWT (RFC 7519), Token Exchange (RFC 8693), Protected Resource Metadata (RFC 9728)
3434

3535
## Critical: Always Use Latest Standards
3636

@@ -53,6 +53,13 @@ Do NOT invoke for:
5353
- OAuth 2.0 Security BCP (RFC 8252, RFC 8628): https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics
5454
- PKCE (RFC 7636): https://datatracker.ietf.org/doc/html/rfc7636
5555

56+
**MCP Authorization (for MCP server authentication)**:
57+
- MCP Auth Spec: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization
58+
- MCP Security Best Practices: https://modelcontextprotocol.io/specification/2025-11-25/basic/security_best_practices
59+
- Protected Resource Metadata (RFC 9728): https://datatracker.ietf.org/doc/html/rfc9728
60+
- Resource Indicators (RFC 8707): https://datatracker.ietf.org/doc/html/rfc8707
61+
- Client ID Metadata Documents: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-00
62+
5663
## ToolHive Authentication Architecture
5764

5865
### Package Structure
@@ -199,6 +206,78 @@ grant_type=urn:ietf:params:oauth:grant-type:token-exchange
199206
&actor_token_type=... // optional
200207
```
201208

209+
## MCP Authorization Model (2025-11-25)
210+
211+
MCP 2025-11-25 defines specific OAuth requirements for HTTP transports. This section covers MCP-specific OAuth patterns.
212+
213+
### Client Registration Priority
214+
215+
MCP defines a specific priority order for client registration:
216+
217+
1. **Pre-registration**: When client and server have existing relationship
218+
2. **Client ID Metadata Documents** (PREFERRED): Clients host metadata at HTTPS URLs
219+
3. **Dynamic Client Registration (DCR)**: Fallback for backwards compatibility
220+
4. **User prompt**: Last resort when no other option available
221+
222+
### Client ID Metadata Documents (NEW)
223+
224+
The preferred approach for MCP client registration when no prior relationship exists:
225+
226+
**Client Requirements**:
227+
- Host metadata at HTTPS URL with path component (e.g., `https://example.com/client.json`)
228+
- `client_id` MUST match the document URL exactly
229+
- Required fields: `client_id`, `client_name`, `redirect_uris`
230+
- MAY use `private_key_jwt` for client authentication
231+
232+
**Server Discovery**:
233+
- Check `client_id_metadata_document_supported: true` in auth server metadata
234+
- Fall back to DCR if not supported
235+
236+
**Example Metadata Document**:
237+
```json
238+
{
239+
"client_id": "https://app.example.com/oauth/client-metadata.json",
240+
"client_name": "Example MCP Client",
241+
"redirect_uris": ["http://localhost:3000/callback"],
242+
"grant_types": ["authorization_code"],
243+
"token_endpoint_auth_method": "none"
244+
}
245+
```
246+
247+
**ToolHive Status**: NOT YET IMPLEMENTED - DCR is currently used as primary approach
248+
249+
### Protected Resource Metadata (RFC 9728)
250+
251+
MCP servers MUST implement RFC 9728 for authorization server discovery:
252+
253+
**Discovery Methods** (in order):
254+
1. `WWW-Authenticate` header with `resource_metadata` parameter on 401 response
255+
2. Well-known URI: `/.well-known/oauth-protected-resource/<path>` (endpoint-specific)
256+
3. Well-known URI: `/.well-known/oauth-protected-resource` (root-level)
257+
258+
**ToolHive Implementation**: `pkg/auth/discovery/` - Full RFC 9728 support
259+
260+
### Resource Indicators (RFC 8707)
261+
262+
MCP clients MUST include `resource` parameter in auth and token requests:
263+
- Identifies the specific MCP server the token is for
264+
- Prevents token reuse across different services
265+
- Uses canonical URI format (lowercase scheme and host)
266+
267+
**ToolHive Implementation**: `OAuthFlowConfig.Resource` in `pkg/auth/discovery/`
268+
269+
### MCP-Specific Security Requirements
270+
271+
**REQUIRED**:
272+
- PKCE with S256 code challenge method
273+
- Token audience validation (reject tokens not issued for you)
274+
- Token passthrough FORBIDDEN (never forward client tokens upstream)
275+
276+
**Scope Handling**:
277+
1. Use `scope` from initial 401 `WWW-Authenticate` header if provided
278+
2. Fall back to `scopes_supported` from Protected Resource Metadata
279+
3. Handle 403 `insufficient_scope` for step-up authorization
280+
202281
## Security Best Practices
203282

204283
### Token Validation

0 commit comments

Comments
 (0)