Skip to content

feat: MCP server PRD (issue #185)#186

Open
clbotdev wants to merge 16 commits into
mainfrom
issue-185
Open

feat: MCP server PRD (issue #185)#186
clbotdev wants to merge 16 commits into
mainfrom
issue-185

Conversation

@clbotdev

Copy link
Copy Markdown

Summary

This PR adds the Product Requirements Document (PRD) for building an MCP server for the MediaLit API (issue #185).

What's included

  • PRD document at apps/api/docs/mcp-server-prd.md covering:
    • Architecture decisions (stdio primary, Streamable HTTP as phase 2)
    • 11 MCP tools mapped from REST endpoints
    • Auth design (API key via env var)
    • File structure (src/mcp/)
    • 4 implementation phases (MVP → write tools → Streamable HTTP → polish)
    • Testing strategy (MCP Inspector, unit, integration, E2E)
    • Integration guide (Claude Code setup)
    • Error handling patterns
    • Future considerations

Closes #185

Comment thread apps/api/docs/mcp-server-prd.md Outdated
Comment thread apps/api/docs/mcp-server-prd.md Outdated
Comment thread apps/api/docs/mcp-server-prd.md Outdated
Comment thread apps/api/docs/mcp-server-prd.md Outdated
@clbotdev clbotdev force-pushed the issue-185 branch 3 times, most recently from 85496d8 to 5992935 Compare June 13, 2026 13:38
Comment thread apps/api/docs/mcp-server-prd.md Outdated
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/index.ts Fixed
Comment thread apps/api/src/mcp/auth-middleware.ts Fixed
clbotdev pushed a commit that referenced this pull request Jun 13, 2026
Key fixes:
- Per-request MCP sessions: each connection gets its own transport +
  server pair, fixing the 'Server already initialized' error with ChatGPT
- CORS middleware on OAuth endpoints (token, register, discovery)
- Accept header normalization handles both application/json and
  text/event-stream for MCP SDK compatibility
- Dynamic Client Registration (RFC 7591) at /mcp/register
- API key resolution for OAuth bearer token users
- Redirect URI validation accepts prefix match for public clients
- Dev mode shows OTP directly on the authorize page
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/mcp/oauth-model.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
Comment thread apps/api/src/mcp/oauth-server.ts Fixed
clbotdev pushed a commit that referenced this pull request Jun 13, 2026
- Remove public client fallback — clients must use DCR (RFC 7591)
- Exact redirect URI matching (prevents open-redirect via prefix spoofing)
- OTP rate limiting (60s cooldown) and max attempt limit (5 tries)
- Input validation on pendingId, email, and OTP format
- HTML-escape clientId rendered on authorize page
- Structured logging replaces noisy console.log/console.warn
- Remove dev-only OTP display from authorize page frontend
- Generic error messages to prevent internal detail leakage
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/mcp/tools/upload.ts Fixed
Comment thread apps/api/src/mcp/tools/upload.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/oauth/jwt.ts Fixed
Comment thread apps/api/src/oauth/jwt.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/mcp/tools/upload.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/authorize-page.ts Fixed
- MCP (OAuth) will default to the default app
Comment thread apps/api/src/index.ts Fixed
Comment thread apps/api/src/index.ts Fixed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread apps/api/src/oauth/server.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/oauth/model.ts Fixed
Comment thread apps/api/src/oauth/server.ts Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server

3 participants