Skip to content

Commit d572a59

Browse files
committed
v1.0.3
1 parent 286249c commit d572a59

25 files changed

Lines changed: 7698 additions & 0 deletions

File tree

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# Research Report: Model Context Protocol (MCP) Specification - January 2026
2+
3+
Generated: 2026-01-30
4+
5+
## Summary
6+
7+
The Model Context Protocol has undergone significant evolution since its introduction in November 2024. Your codebase uses `@modelcontextprotocol/sdk ^1.12.0`, which is **substantially outdated** - the current version is **1.25.2**. Major features added since 1.12.0 include Streamable HTTP transport, OAuth 2.1 authorization, the Tasks primitive for async operations, elicitation for user interaction, and structured tool outputs.
8+
9+
## Questions Answered
10+
11+
### Q1: Current MCP SDK Version
12+
**Answer:** The latest `@modelcontextprotocol/sdk` version is **1.25.2** (published ~11 days ago as of January 2026).
13+
**Source:** [npm - @modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
14+
**Confidence:** High (VERIFIED)
15+
16+
**Your version (1.12.0) is ~13 minor versions behind.** A stable v2 release is anticipated in Q1 2026, with v1.x receiving bug fixes for 6+ months after v2 ships.
17+
18+
### Q2: Protocol Changes Since 2024
19+
**Answer:** Multiple specification releases with breaking changes:
20+
21+
| Spec Version | Release Date | Major Changes |
22+
|--------------|--------------|---------------|
23+
| 2024-11-05 | Nov 2024 | Initial release |
24+
| 2025-03-26 | Mar 2025 | OAuth 2.1 authorization, Streamable HTTP transport, tool annotations |
25+
| 2025-06-18 | Jun 2025 | Structured outputs, elicitation, RFC 8707 resource indicators, removed JSON-RPC batching |
26+
| 2025-11-25 | Nov 2025 | Tasks primitive, URL mode elicitation, sampling with tools |
27+
28+
**Source:** [MCP Specification 2025-11-25](https://modelcontextprotocol.io/specification/2025-11-25)
29+
**Confidence:** High (VERIFIED)
30+
31+
### Q3: New Features - Resources, Prompts, Tools
32+
**Answer:** Major additions since 2024:
33+
34+
**Tools:**
35+
- **Tool Annotations** (2025-03-26): Tools can describe their behavior (read-only, destructive) for safer execution
36+
- **Tool Output Schemas** (2025-06-18): Declare expected return types, improving context window efficiency
37+
- **Sampling with Tools** (2025-11-25): MCP servers can initiate sampling requests with tool definitions included
38+
39+
**Resources:**
40+
- No major structural changes, but improved metadata discovery via `.well-known` URLs (in progress)
41+
42+
**Prompts:**
43+
- **Elicitation** (2025-06-18): Servers can request additional information from users during interactions using JSON Schema validation
44+
- **URL Mode Elicitation** (2025-11-25): Send users to browser for OAuth/credentials without exposing them to client
45+
46+
**New Primitives:**
47+
- **Tasks** (2025-11-25): Async long-running operations with states (working, input_required, completed, failed, cancelled)
48+
49+
**Source:** [One Year of MCP Blog Post](http://blog.modelcontextprotocol.io/posts/2025-11-25-first-mcp-anniversary/)
50+
**Confidence:** High (VERIFIED)
51+
52+
### Q4: Transport Mechanisms
53+
**Answer:** Current transport landscape:
54+
55+
| Transport | Status | Use Case |
56+
|-----------|--------|----------|
57+
| **STDIO** | Standard | Local integrations, command-line tools (recommended for clients to support) |
58+
| **Streamable HTTP** | Standard (Current) | Remote servers, replaces HTTP+SSE (added in 2025-03-26) |
59+
| **HTTP+SSE** | Deprecated | Backwards compatibility only (from 2024-11-05) |
60+
| **WebSocket** | Proposed (SEP-1288) | Long-lived bidirectional communication (not yet in spec) |
61+
62+
**Key Change:** SDK 1.10.0 (April 2025) was first to support Streamable HTTP. Your 1.12.0 should have basic support, but newer versions have improvements.
63+
64+
**Imports:**
65+
```typescript
66+
// Current (Streamable HTTP)
67+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
68+
69+
// Legacy (SSE) - for backwards compatibility
70+
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
71+
```
72+
73+
**Source:** [MCP Transports Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports)
74+
**Confidence:** High (VERIFIED)
75+
76+
### Q5: Authentication/Authorization
77+
**Answer:** Major overhaul with OAuth 2.1:
78+
79+
**Key Requirements:**
80+
- MCP servers are now classified as **OAuth 2.0 Resource Servers**
81+
- OAuth 2.1 with **PKCE** is mandatory for all clients
82+
- **RFC 9728** (Protected Resource Metadata) is now mandatory (no fallback defaults)
83+
- **RFC 8707** (Resource Indicators) required in token requests
84+
85+
**Authorization Flow:**
86+
1. Server returns HTTP 401 with `WWW-Authenticate` header containing `resource_metadata` URL
87+
2. Client fetches PRM document to find `authorization_servers` field
88+
3. Client initiates OAuth 2.1 flow with PKCE
89+
90+
**Grant Types:**
91+
- Authorization Code: For human end users
92+
- Client Credentials: For application-to-application
93+
94+
**Dynamic Client Registration:** RFC 7591 SHOULD be supported to avoid manual registration friction.
95+
96+
**Source:** [MCP Authorization Specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization)
97+
**Confidence:** High (VERIFIED)
98+
99+
### Q6: Best Practices for Building MCP Servers (2025/2026)
100+
**Answer:**
101+
102+
**Project Setup:**
103+
```bash
104+
npm init -y
105+
npm install @modelcontextprotocol/sdk zod
106+
# Set "type": "module" in package.json
107+
# Target ES2022 with Node16 module resolution
108+
```
109+
110+
**Critical Rules:**
111+
1. **STDIO servers**: Never write to stdout - use `console.error()` for logging (stdout corrupts JSON-RPC)
112+
2. **HTTP servers**: Standard logging is fine
113+
3. **Schema validation**: Use Zod for both input validation and type safety
114+
4. **Middleware packages**: Use thin adapters (`@modelcontextprotocol/express`, `@modelcontextprotocol/hono`, `@modelcontextprotocol/node`)
115+
116+
**Security:**
117+
- Treat each MCP server like a microservice with its own blast radius
118+
- Use TLS, require auth between client and server
119+
- Scope API keys minimally
120+
- High-impact servers (filesystem, terminal, databases) should start read-only
121+
- Use secrets manager instead of hardcoding
122+
- For remote deployments: use a proxy/gateway for auth
123+
124+
**Production Patterns:**
125+
- OAuth token management with refresh
126+
- Request retry logic
127+
- Comprehensive error handling
128+
- Edge deployment (Cloudflare Workers) for sub-50ms cold starts
129+
130+
**Source:** [MCPcat - Building MCP Server TypeScript](https://mcpcat.io/guides/building-mcp-server-typescript/)
131+
**Confidence:** High (VERIFIED)
132+
133+
### Q7: Streaming Support
134+
**Answer:**
135+
136+
**Evolution:**
137+
- **2024-11-05**: HTTP+SSE for streaming
138+
- **2025-03-26**: Streamable HTTP replaces SSE (more proxy-friendly)
139+
- Streamable HTTP can still use SSE internally for multi-message streaming
140+
141+
**How It Works:**
142+
- Server can return SSE stream for progress updates, multiple results, or server-initiated requests
143+
- GET requests support persistent SSE connections
144+
- POST requests can return SSE for streaming responses
145+
146+
**Progress Tracking:**
147+
- Context object provides `progress_token` for long-running operations
148+
- SDK handles progress reporting via notifications
149+
150+
**SDK Support:**
151+
```typescript
152+
// Server with Streamable HTTP
153+
import { StreamableHttpServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
154+
```
155+
156+
**Source:** [Why MCP Deprecated SSE](https://blog.fka.dev/blog/2025-06-06-why-mcp-deprecated-sse-and-go-with-streamable-http/)
157+
**Confidence:** High (VERIFIED)
158+
159+
### Q8: Error Handling
160+
**Answer:**
161+
162+
**Wire Format:** JSON-RPC 2.0 error objects with `code`, `message`, and optional `data`.
163+
164+
**Error Code Ranges:**
165+
| Range | Purpose |
166+
|-------|---------|
167+
| -32768 to -32000 | Reserved (JSON-RPC standard + MCP-specific) |
168+
| Outside range | Custom application errors |
169+
170+
**Common Codes:**
171+
| Code | Name | Description |
172+
|------|------|-------------|
173+
| -32602 | Invalid Params | Malformed parameters |
174+
| -32002 | Resource Not Found | Resource doesn't exist or can't be accessed |
175+
| -32602 | Unsupported Protocol Version | Version mismatch (includes supported versions in data) |
176+
177+
**Best Practices:**
178+
- Use date-based protocol versioning (e.g., "2025-06-18")
179+
- During init, client proposes version, server accepts or suggests alternative
180+
- Copy request ID to response (missing ID is common bug)
181+
- Notifications (no ID) should not receive responses
182+
183+
**Convention for Custom Codes:**
184+
- -31xxx: Authentication errors
185+
- -30xxx: Resource access errors
186+
187+
**Source:** [MCP Error Codes](https://www.mcpevals.io/blog/mcp-error-codes)
188+
**Confidence:** High (VERIFIED)
189+
190+
## Version Gap Analysis: 1.12.0 vs 1.25.2
191+
192+
**You are missing:**
193+
194+
| Version | Key Feature |
195+
|---------|-------------|
196+
| 1.13.x | Bug fixes and stability improvements |
197+
| 1.14.x | Enhanced transport handling |
198+
| 1.15.x-1.22.x | Incremental improvements, OAuth helpers |
199+
| **1.23.0** | **Full support for MCP spec 2025-11-25** (Tasks, elicitation, structured outputs) |
200+
| 1.24.x | Performance improvements, bug fixes |
201+
| 1.25.x | Latest stable, refined middleware packages |
202+
203+
**Critical Missing Capabilities:**
204+
1. **Tasks Primitive** - async operations (available in 1.23.0+)
205+
2. **Elicitation** - user interaction during tool execution
206+
3. **Structured Tool Outputs** - declared return schemas
207+
4. **Latest OAuth helpers** - improved authorization flow
208+
5. **Zod v4 support** - SDK now imports from `zod/v4` (backwards compat with Zod 3.25+)
209+
210+
## Recommendations
211+
212+
### Immediate Actions
213+
214+
1. **Upgrade SDK:**
215+
```bash
216+
npm install @modelcontextprotocol/sdk@latest
217+
```
218+
219+
2. **Update Zod if needed:** Ensure Zod is 3.25+ (you have 3.25.32 - compatible)
220+
221+
3. **Review Transport Usage:** Migrate from SSE to Streamable HTTP if using remote transports
222+
223+
### Consider Implementing
224+
225+
1. **Tool Annotations:** Add behavior metadata to your tools:
226+
```typescript
227+
server.tool({
228+
name: 'create_issue',
229+
annotations: { destructive: true, idempotent: false }
230+
});
231+
```
232+
233+
2. **Tool Output Schemas:** Declare return types for better context efficiency:
234+
```typescript
235+
server.tool({
236+
name: 'get_project',
237+
outputSchema: z.object({
238+
id: z.string(),
239+
name: z.string(),
240+
status: z.string()
241+
})
242+
});
243+
```
244+
245+
3. **OAuth 2.1 Authorization:** If exposing remotely, implement proper OAuth flow
246+
247+
### Migration Path
248+
249+
| Priority | Task | Effort |
250+
|----------|------|--------|
251+
| High | Upgrade to 1.25.x | Low |
252+
| High | Test existing tools work | Low |
253+
| Medium | Add tool annotations | Low |
254+
| Medium | Add output schemas | Medium |
255+
| Low | Implement Tasks for long-running ops | High |
256+
| Low | Add elicitation for interactive tools | Medium |
257+
258+
## Sources
259+
260+
1. [npm - @modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk) - Package registry
261+
2. [GitHub - modelcontextprotocol/typescript-sdk](https://github.com/modelcontextprotocol/typescript-sdk) - Official SDK repository
262+
3. [MCP Specification 2025-11-25](https://modelcontextprotocol.io/specification/2025-11-25) - Latest specification
263+
4. [One Year of MCP Blog Post](http://blog.modelcontextprotocol.io/posts/2025-11-25-first-mcp-anniversary/) - Anniversary release notes
264+
5. [MCP Authorization Specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization) - OAuth 2.1 details
265+
6. [MCP Transports Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports) - Transport layer docs
266+
7. [Auth0 - MCP Specs Update June 2025](https://auth0.com/blog/mcp-specs-update-all-about-auth/) - Authorization deep dive
267+
8. [WorkOS - MCP 2025-11-25 Spec Update](https://workos.com/blog/mcp-2025-11-25-spec-update) - Feature overview
268+
9. [MCP Error Codes](https://www.mcpevals.io/blog/mcp-error-codes) - Error handling guide
269+
10. [MCPcat - Building MCP Server TypeScript](https://mcpcat.io/guides/building-mcp-server-typescript/) - Best practices
270+
271+
## Open Questions
272+
273+
- Exact changelog for versions 1.12.0 through 1.22.x (detailed release notes not readily available)
274+
- WebSocket transport timeline (SEP-1288 proposed but not yet in spec)
275+
- V2 SDK breaking changes (pre-alpha, details not yet published)

0 commit comments

Comments
 (0)