Skip to main content

cognito-mcp-proxy

Cognito OAuth stdio proxy for AWS Bedrock AgentCore Runtimes

A lightweight, uvx-installable package that bridges MCP clients (Kiro IDE, Claude Desktop) with AgentCore Runtimes secured by Cognito/EntraID OAuth. No .env files, no AWS CLI needed.

Architecture

Kiro IDE <--stdio (JSON-RPC)--> cognito-mcp-proxy <--HTTPS + Bearer JWT--> AgentCore Runtime
                                       |
                                 Cognito OAuth PKCE
                                 (browser sign-in)

How It Works

  1. On startup, opens your browser for Cognito/EntraID sign-in (OAuth PKCE)
  2. After auth, reads JSON-RPC messages from stdin (from Kiro)
  3. For each request: refreshes the JWT, sends it as Bearer token to the AgentCore runtime
  4. Parses the SSE/JSON response and writes JSON-RPC back to stdout

Installation & Usage

Add to your MCP config (~/.kiro/settings/mcp.json or .kiro/settings/mcp.json):

{
  "mcpServers": {
    "redshift-secure": {
      "command": "uvx",
      "args": ["cognito-mcp-proxy@latest"],
      "env": {
        "AGENTCORE_REGION": "us-east-1",
        "AGENTCORE_RUNTIME_ID": "arn:aws:bedrock-agentcore:us-east-1:123456789:runtime/YourRuntime-AbcXyz",
        "COGNITO_DOMAIN": "https://your-pool.auth.us-east-1.amazoncognito.com",
        "COGNITO_CLIENT_ID": "your_cognito_client_id"
      },
      "disabled": false,
      "autoApprove": ["whoami"]
    }
  }
}

Option 2: Direct Python (Fallback)

{
  "mcpServers": {
    "redshift-secure": {
      "command": "python",
      "args": ["-m", "cognito_mcp_proxy"],
      "env": {
        "AGENTCORE_REGION": "us-east-1",
        "AGENTCORE_RUNTIME_ID": "arn:aws:bedrock-agentcore:...",
        "COGNITO_DOMAIN": "https://...",
        "COGNITO_CLIENT_ID": "..."
      },
      "disabled": false
    }
  }
}

Environment Variables

All configuration is via environment variables set in the env block of your mcp.json:

Variable Required Default Description
AGENTCORE_REGION Yes* Extracted from ARN AWS region (e.g., us-east-1)
AGENTCORE_RUNTIME_ID Yes* — Runtime ARN (e.g., arn:aws:bedrock-agentcore:us-east-1:123456:runtime/MyRuntime-Abc)
AGENTCORE_QUALIFIER No DEFAULT Runtime qualifier/alias

AgentCore Runtime (Option B — advanced: full URL)

Variable Required Default Description
AGENTCORE_RUNTIME_URL Yes* — Full invocation URL (overrides region/ID/qualifier)

*One of Option A or Option B must be provided.

The proxy builds the URL as:

https://bedrock-agentcore.{REGION}.amazonaws.com/runtimes/{URL_ENCODED_ARN}/invocations?qualifier={QUALIFIER}

Cognito OAuth

Variable Required Default Description
COGNITO_DOMAIN Yes — Cognito User Pool domain (with or without https://)
COGNITO_CLIENT_ID Yes — Cognito App Client ID
COGNITO_REDIRECT_URI No http://localhost:22553/oauth/callback OAuth callback URI
COGNITO_SCOPE No openid email OAuth scopes
COGNITO_CALLBACK_PORT No 22553 Local port for OAuth callback server
COGNITO_REQUEST_TIMEOUT No 120 HTTP timeout in seconds for runtime calls

First-Time Setup

  1. Add the MCP configuration to your mcp.json (see above)
  2. Restart Kiro (or reconnect MCP servers)
  3. On first request, your browser opens for Cognito/Microsoft sign-in
  4. Complete sign-in — you'll see "Authentication complete"
  5. Return to Kiro and test: ask "run whoami using redshift-secure"

Connecting to Different Runtimes

Since all config is via env vars, you can have multiple entries pointing to different runtimes:

{
  "mcpServers": {
    "redshift-secure": {
      "command": "uvx",
      "args": ["cognito-mcp-proxy@latest"],
      "env": {
        "AGENTCORE_REGION": "us-east-1",
        "AGENTCORE_RUNTIME_ID": "arn:aws:bedrock-agentcore:us-east-1:123456:runtime/Redshift-Prod",
        "COGNITO_DOMAIN": "https://my-pool.auth.us-east-1.amazoncognito.com",
        "COGNITO_CLIENT_ID": "abc123"
      }
    },
    "another-runtime": {
      "command": "uvx",
      "args": ["cognito-mcp-proxy@latest"],
      "env": {
        "AGENTCORE_REGION": "us-west-2",
        "AGENTCORE_RUNTIME_ID": "arn:aws:bedrock-agentcore:us-west-2:123456:runtime/Other-Runtime",
        "COGNITO_DOMAIN": "https://other-pool.auth.us-west-2.amazoncognito.com",
        "COGNITO_CLIENT_ID": "xyz789"
      }
    }
  }
}

Key Differences from tester_bundle

Feature tester_bundle (old) cognito-mcp-proxy (new)
Installation Manual copy + pip install truststore uvx cognito-mcp-proxy@latest (zero setup)
Configuration Edit .env file Set env vars in mcp.json
Path management User must locate Python and script path Automatic via uvx
Upgrades Manual file replacement @latest auto-updates
Reuse One config per .env file Different env vars per mcp.json entry
Multi-runtime Copy entire folder per runtime Just add another mcp.json entry

Development

# Clone and build
cd cognito_mcp_proxy
uv venv
uv pip install -e .

# Run directly
cognito_mcp_proxy

# Test with MCP Inspector
npx @modelcontextprotocol/inspector cognito_mcp_proxy

Build & Publish

uv build
uv publish  # to PyPI

Troubleshooting

Browser doesn't open:

  • Check your default browser is set
  • Ensure VPN is connected (corporate network required)

"Invalid grant" error:

  • Disconnect and reconnect the MCP server in Kiro

Timeout errors:

  • Ensure VPN is active
  • Increase COGNITO_REQUEST_TIMEOUT if runtime is slow

"Required environment variable X is not set":

  • Check your mcp.json env block has all required variables

"AgentCore runtime not configured":

  • Set either AGENTCORE_RUNTIME_ID (+ optional AGENTCORE_REGION) or AGENTCORE_RUNTIME_URL

Notes

  • No AWS CLI or aws sso login needed
  • No credentials saved to disk — tokens live in memory only
  • Token auto-refreshes (valid ~30 days)
  • If already signed into Microsoft, auth completes with zero clicks
  • Corporate SSL handled via truststore package
  • Works with any AgentCore runtime — not limited to Redshift

Metadata

Release files for cognito-mcp-proxy 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognito-mcp-proxy 0.1.1
File Size Uploaded Provenance Actions
cognito_mcp_proxy-0.1.1.tar.gz 7.8 kB Without provenance Details for cognito_mcp_proxy-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cognito-mcp-proxy 0.1.1
File Interpreter ABI Platform Actions
cognito_mcp_proxy-0.1.1-py3-none-any.whl Python 3 none any Details for cognito_mcp_proxy-0.1.1-py3-none-any.whl

Total release size: 18.4 kB

Release files / cognito_mcp_proxy-0.1.1.tar.gz

Download URL cognito_mcp_proxy-0.1.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
904da2de64a0314364abeb09539126c0cf8d4f8189b46933f9f0098d4e09097e
BLAKE2b-256 checksum
How to use checksums
9d0c778936a5296961f76dfc51abcc649b3c0832b92dac10baa86acaec2d27c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / cognito_mcp_proxy-0.1.1-py3-none-any.whl

Download URL cognito_mcp_proxy-0.1.1-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63e4f2f93749603f3e50ac487683b910f53cb338f796e4c76e6ad36681067bd9
BLAKE2b-256 checksum
How to use checksums
e9be3be4d535f5a840408d6d628d25a165213878ec842b95f07fccb87c248753
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for cognito-mcp-proxy 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page