Skip to content

feat: add MCP OAuth auth module with RestApi integration - #380

Merged
hoegertn merged 11 commits into
mainfrom
feat/mcp-auth
Aug 24, 2026
Merged

feat: add MCP OAuth auth module with RestApi integration#380
hoegertn merged 11 commits into
mainfrom
feat/mcp-auth

Conversation

@hoegertn

Copy link
Copy Markdown
Contributor
  • Add service-agnostic mcp-auth module (handlers, MCP server, JSON-RPC)
  • Add McpAuth CDK construct creating 5 Lambda functions for OAuth endpoints
  • Add McpCognitoAuth convenience construct for Cognito-backed auth
  • Integrate into RestApi via mcpAuth prop (cognito or generic config)
  • Auto-inject OAuth discovery, authorize, token, register paths into OpenAPI spec
  • All MCP auth endpoints are anonymous (no authorizer)
  • apiDomain and stageName derived from RestApi props (no duplication)
  • Please check if the PR fulfills these requirements
  • The commit message describes your change
  • Tests for the changes have been added if possible (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • What is the current behavior? (You can also link to an open issue here)

  • What is the new behavior (if this is a feature change)?

  • Does this PR introduce a breaking change? (What changes might users need to make in their setup due to this PR?)

  • Other information:

- Add service-agnostic mcp-auth module (handlers, MCP server, JSON-RPC)
- Add McpAuth CDK construct creating 5 Lambda functions for OAuth endpoints
- Add McpCognitoAuth convenience construct for Cognito-backed auth
- Integrate into RestApi via mcpAuth prop (cognito or generic config)
- Auto-inject OAuth discovery, authorize, token, register paths into OpenAPI spec
- All MCP auth endpoints are anonymous (no authorizer)
- apiDomain and stageName derived from RestApi props (no duplication)
github-actions Bot and others added 8 commits August 24, 2026 11:44
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Add 62 unit tests across 3 suites (construct, handlers, MCP server)
- Update llm.md with MCP auth usage, interfaces, and examples
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Critical:
- Replace regex param stripping with URLSearchParams in token handler
- Add grant_type validation (authorization_code, refresh_token only)
- Increase Lambda timeout to 15s (exceeds 10s fetch abort)

Warnings:
- Refactor createMcpAuth cognito path to use McpCognitoAuth (no duplication)
- Add env var validation in getConfigFromEnv
- Add ordering/rationale comments for MCP auth injection and permissions

Tests:
- Add RestApi+mcpAuth integration test (5 paths with security:[])
- Add grant_type validation tests to token handler suite
@hoegertn
hoegertn merged commit e9b3bfe into main Aug 24, 2026
4 checks passed
@hoegertn
hoegertn deleted the feat/mcp-auth branch August 24, 2026 21:53
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.

1 participant