
A modular FastMCP server for interacting with Microsoft Graph API, supporting advanced queries for users, sign-in logs, MFA status, and privileged users.

Demonstrates securing a Model Context Protocol server as an OAuth 2.1 Resource Server, using AWS Cognito as the backing authorization server while keeping the implementation provider-agnostic.
MCP OAuth 2.1 Resource Server example with AWS Cognito is cataloged as an MCP server attributed to empires-security. Demonstrates securing a Model Context Protocol server as an OAuth 2.1 Resource Server, using AWS Cognito as the backing authorization server while keeping the implementation provider-agnostic. It is categorized under auth security. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MCP OAuth 2.1 Resource Server example with AWS Cognito are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
The example uses AWS Cognito as the backing authorization server, but the core OAuth flow is described as provider-agnostic and works with any compliant authorization server.
The implementation covers pre-registered credentials, Client ID Metadata Documents, and Dynamic Client Registration as a fallback.
README.md · 3ab540c43e7e · 采集于 2026-11-13 09:02:56 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
This repository demonstrates how to secure a Model Context Protocol (MCP) server using OAuth 2.1 authorization flows, implemented entirely with Node.js and Express.js. While this example uses AWS Cognito as the backing authorization server, the implementation is provider-agnostic and can work with any OAuth 2.1 compliant authorization server.
Based on the MCP Authorization Specification (version 2025-11-25), this project showcases:
This implementation follows OAuth 2.1 standards to ensure compatibility with any compliant authorization server:
The new MCP Authorization Specification introduces a clean separation between Resource Servers and Authorization Servers, making it easier to integrate with existing identity providers like AWS Cognito, Okta, Auth0, and others.
Key components of the specification:
Protected Resource Metadata (PRM) document
/.well-known/oauth-protected-resourceDiscovery Process
OAuth 2.1 Authorization
Client Registration Priority (MCP 2025-11-25)
client_id_metadata_document_supported: true)Dynamic Client Registration (DCR)
Client ID Metadata Documents (CIMD)
client_idThis implementation showcases how to apply these concepts in a provider-agnostic way. The example uses AWS Cognito with custom Dynamic Client Registration through API Gateway endpoints and Lambda functions, but the core OAuth flow works with any compliant authorization server.
Client → MCP Server → Authorization Server (e.g., AWS Cognito)
(Resource Server) (OAuth 2.1 Provider)
For detailed overview, see the Architecture Overview.
Diagrams:
This implementation includes support for OAuth 2.1 Dynamic Client Registration, allowing clients to:
The DCR flow works as follows:
Implementation Note: AWS Cognito does not natively support Dynamic Client Registration as specified in OAuth 2.0 DCR (RFC7591). This implementation bridges this gap by using:
This approach allows us to maintain compliance with the MCP specification's DCR recommendation while leveraging AWS Cognito for robust authentication and authorization.
Security Note: This implementation uses anonymous DCR without additional authentication. For production environments, consider adding:
See our DCR Security Recommendations to enhance the security of the registration process.
The MCP Authorization Specification (2025-11-25) introduced Client ID Metadata Documents as the recommended client registration method. CIMD allows a client to use an HTTPS URL as its client_id, with the URL hosting a JSON document describing the client's OAuth metadata.
http://localhost:3003/client-metadata.json)client_id{
"client_id": "http://localhost:3003/client-metadata.json",
"redirect_uris": ["http://localhost:3003/callback"],
"client_name": "MCP CIMD Demo Client",
"grant_types": ["authorization_code"],
"response_types": ["code"],
"token_endpoint_auth_method": "none"
}
AWS Cognito does not natively support Client ID Metadata Documents, just as it doesn't natively support DCR. This implementation bridges CIMD transparently through the MCP server's authorization proxy:
client_id_metadata_document_supported: true in authorization server metadataauthorization_endpoint and token_endpoint in metadata to point to itselfclient_id:
client_id (pre-registered or DCR): requests are passed through to Cognito unchangedThe metadata-client has zero custom code for CIMD — it simply uses its metadata URL as client_id with standard OAuth endpoints, just like any spec-compliant client. All bridging is handled server-side.
The authorization proxy includes:
client_id validation (must match the metadata URL exactly)Note: In development, http://localhost URLs are permitted. Production deployments must use HTTPS.
Clone the repository
git clone https://github.com/empires-security/mcp-oauth2-aws-cognito.git
cd mcp-oauth2-aws-cognito
Install dependencies for clients and server
npm run install:all
Deploy AWS resources
npm run deploy
Review generated .env files in:
src/client/.envsrc/auto-client/.envsrc/metadata-client/.envsrc/mcp-server/.env.env.example filesStart all services (server + 3 clients)
npm run dev
Visit http://localhost:3000 to test the pre-registered client OAuth flow
Sign Up for a New User
Click the "Fetch MCP Data" button to make an authenticated request to the MCP server
Visit http://localhost:3002 to test the DCR flow (auto-discovery client with Dynamic Client Registration)
Visit http://localhost:3003 to test the CIMD flow (Client ID Metadata Document client)
npm run cleanup
For detailed setup instructions, see the Setup Guide.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MCP OAuth 2.1 Resource Server example with AWS Cognito from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/mcp-oauth2-aws-cognito)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

A modular FastMCP server for interacting with Microsoft Graph API, supporting advanced queries for users, sign-in logs, MFA status, and privileged users.

A Model Context Protocol (MCP) server that provides programmatic access to Keycloak administration functionality.

An MCP server for LLM-driven penetration testing that wraps Kali tools and adds scope enforcement, engagement tracking, and structured output.