MCP + OAuth2.1 + AWS Cognito Example MCP Server

MCP Server Authorization Example with AWS Cognito

Remote serverstreamable-http

What is the MCP + OAuth2.1 + AWS Cognito Example MCP server?

MCP + OAuth2.1 + AWS Cognito Example MCP server exists for a simple reason — assistants are far more useful when they can act on MCP + OAuth2.1 + AWS Cognito Example directly instead of describing what you should do. MCP Server Authorization Example with AWS Cognito.

What you get

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.

What the assistant can call

Once MCP + OAuth2.1 + AWS Cognito Example is connected, these are the calls the assistant has available:

  • Provider — agnostic OAuth 2.1 implementation (example uses AWS Cognito)
  • Auto — discovery client with dynamic registration (DCR)
  • Clients — Discover authorization servers dynamically without hardcoded provider-specific logic
  • Pre — registered** client credentials (if available for the server)
  • Prerequisites — The Prerequisites tool exposed by this server
  • Setup — 1. Clone the repository bash git clone https://github.com/empires-security/mcp-oauth2-aws-cognito.git cd mcp-oauth2-aws-cognito
  • Cleanup — 1. Cleanup AWS resources bash npm run cleanup

Configuration and credentials

You will need one environment variable: CLIENT_SECRET. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Node.js 18+ installed - AWS test account with access to: - Cognito for Authorization Server (1 user pool, 2 app clients) - API Gateway / Lambda / DynamoDB for DCR and CIMD bridge (2 resources, 2 functions, 1 table) - CloudFormation for deploy (1 stack) - Basic knowledge of OAuth 2.1 flows

Setting it up

Being a remote server, there is no local install. You register the endpoint with your client, authorise it once, and the tools appear.

Choosing this one

Plenty of cloud and infrastructure servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. MCP + OAuth2.1 + AWS Cognito Example's toolset — Provider, Auto, Clients and 4 more — is a fair guide to whether it matches your workflow. It is maintained by empires-security; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Before you rely on it

  • Your data travels to the provider's service, so the usual questions apply about what you send and what they retain.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the mcp + oauth2.1 + aws cognito example mcp server does with a few real requests.

Available tools

ToolWhat it does
Provideragnostic OAuth 2.1 implementation (example uses AWS Cognito)
Autodiscovery client with dynamic registration (DCR)
ClientsDiscover authorization servers dynamically without hardcoded provider-specific logic
Preregistered** client credentials (if available for the server)
PrerequisitesThe Prerequisites tool exposed by this server.
Setup1. Clone the repository bash git clone https://github.com/empires-security/mcp-oauth2-aws-cognito.git cd mcp-oauth2-aws-cognito
Cleanup1. Cleanup AWS resources bash npm run cleanup

Configuration

  • Node.js 18+ installed - AWS test account with access to: - Cognito for Authorization Server (1 user pool, 2 app clients) - API Gateway / Lambda / DynamoDB for DCR and CIMD bridge (2 resources, 2 functions, 1 table) - CloudFormation for deploy (1 stack) - Basic knowledge of OAuth 2.1 flows
VariableDescriptionRequired
CLIENT_SECRETCredential the server authenticates with.Yes

Example prompts to try

  • Use MCP + OAuth2.1 + AWS Cognito Example to Provider.
  • Use MCP + OAuth2.1 + AWS Cognito Example to Auto.
  • Use MCP + OAuth2.1 + AWS Cognito Example to Clients.

Frequently asked questions

Dynamic Client Registration (DCR) lets clients register with the authorization server at runtime via an API endpoint. Client ID Metadata Documents (CIMD) allow a client to use an HTTPS URL as its `client_id`; the authorization server fetches the metadata document from that URL, avoiding pre‑registration entirely.