This guide covers how to register AgentCore Gateways and Agent Runtimes in the MCP Gateway Registry. There are two approaches: bulk auto-registration (scan an entire AWS account) or per-server manual registration (one resource at a time).
| Approach | Best For | Token Management |
|---|---|---|
| Method 1: Bulk Scanner | Discovering and registering all resources in an AWS account at once | Automated via token_refresher.py |
| Method 2: Per-Server Registration | Registering individual gateways or agents manually (same as any other MCP server/agent) | Manual token generation |
The AgentCore scanner CLI automates the discovery and registration of all AgentCore Gateways and Agent Runtimes in your AWS account. Instead of manually creating JSON configuration files for each resource, the CLI scans your account, builds registrations, and writes a token refresh manifest -- all in one command. A separate token refresher process then keeps egress tokens up to date.
The scanner and token refresher work with any OIDC-compliant identity provider -- Cognito, Auth0, Okta, Entra ID, Keycloak, or any custom provider. The IdP is auto-detected from the OIDC discovery URL in each gateway's configuration.
Prerequisites: Before using auto-registration, complete the setup steps in the Auto-Registration Prerequisites Guide.
# Discover resources without registering (preview)
uv run python -m cli.agentcore sync --dry-run
# Register all gateways and runtimes
uv run python -m cli.agentcore sync
# Overwrite existing registrations (update metadata if changed)
uv run python -m cli.agentcore sync --overwrite
# List discovered resources without registering
uv run python -m cli.agentcore listThe sync command:
- Discovers all READY gateways and runtimes via AWS Bedrock AgentCore API
- Registers each gateway as an MCP Server and each runtime as an MCP Server (protocol=MCP) or A2A Agent (protocol=HTTP/A2A)
- Writes
token_refresh_manifest.jsonlisting all CUSTOM_JWT gateways that need token refresh
Note: Agents imported from runtimes are registered with an empty skills array. To add skills after import, use the agent edit dialog in the UI or the
PUT /api/agents/{path}API endpoint.
CUSTOM_JWT gateways need OAuth2 client secrets to generate egress tokens. Add them to your .env file:
# Per-client secret (highest priority) -- use the client_id from allowed_clients
OAUTH_CLIENT_SECRET_49ujl0b9ser72gnp6q1ph9v6vs=your-secret-here
# Or vendor-level secrets (shared across all gateways for that IdP)
AUTH0_CLIENT_SECRET=your-auth0-secret
OKTA_CLIENT_SECRET=your-okta-secret
ENTRA_CLIENT_SECRET=your-entra-secret
KEYCLOAK_CLIENT_SECRET=your-keycloak-secretCognito gateways need no configuration -- the token refresher auto-retrieves client secrets via the AWS API (describe_user_pool_client).
Secret resolution priority:
- Per-client env var:
OAUTH_CLIENT_SECRET_<client_id> - Cognito auto-retrieval via AWS API (Cognito only)
- Vendor-specific env var:
AUTH0_CLIENT_SECRET, etc.
The token refresher reads the manifest, resolves secrets, fetches OAuth2 tokens, PATCHes them into the registry, and triggers a security rescan for each updated server (enabled by default, requires admin privileges on the registry token):
# One-time refresh
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token
# Continuous mode (sidecar -- refreshes every 45 minutes)
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token \
--loop --interval 2700Or set up a cron job:
# Refresh every 45 minutes (tokens typically expire in 60 min)
*/45 * * * * cd /app && uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token \
>> /var/log/token-refresher.log 2>&1# Basic sync
uv run python -m cli.agentcore sync
# Dry-run preview
uv run python -m cli.agentcore sync --dry-run
# Overwrite existing registrations
uv run python -m cli.agentcore sync --overwrite
# Register only gateways (skip runtimes)
uv run python -m cli.agentcore sync --gateways-only
# Register only runtimes (skip gateways)
uv run python -m cli.agentcore sync --runtimes-only
# Also register individual mcpServer gateway targets as separate MCP Servers
uv run python -m cli.agentcore sync --include-mcp-targets
# Set visibility for registered resources
uv run python -m cli.agentcore sync --visibility public
# JSON output for CI/CD pipelines
uv run python -m cli.agentcore sync --output json
# Specify region and registry URL
uv run python -m cli.agentcore sync --region us-west-2 --registry-url https://registry.example.com
# Custom token file and timeout
uv run python -m cli.agentcore sync --token-file .token --timeout 60
# Enable debug logging
uv run python -m cli.agentcore sync --debug# List all discovered resources
uv run python -m cli.agentcore list
# List only gateways
uv run python -m cli.agentcore list --gateways-only
# List only runtimes
uv run python -m cli.agentcore list --runtimes-only
# JSON output
uv run python -m cli.agentcore list --output json
# Specify region
uv run python -m cli.agentcore list --region eu-west-1# One-time refresh
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token
# With per-client env vars
OAUTH_CLIENT_SECRET_49ujl0b9ser72gnp6q1ph9v6vs=secret \
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token
# With vendor-level env vars
AUTH0_CLIENT_SECRET=xxx OKTA_CLIENT_SECRET=yyy \
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token
# Continuous mode (sidecar)
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--registry-url https://registry.example.com \
--token-file .token \
--loop --interval 2700
# Enable debug logging
uv run python -m cli.agentcore.token_refresher \
--manifest token_refresh_manifest.json \
--token-file .token \
--debug| Argument | Subcommand | Default | Description |
|---|---|---|---|
--region |
sync, list | AWS_REGION env or us-east-1 |
AWS region to scan |
--registry-url |
sync, list | REGISTRY_URL env or http://localhost |
Registry base URL |
--token-file |
sync, list | REGISTRY_TOKEN_FILE env or .token |
Path to registry auth token file |
--timeout |
sync, list | 30 |
AWS API call timeout in seconds |
--gateways-only |
sync, list | false |
Only process gateways |
--runtimes-only |
sync, list | false |
Only process runtimes |
--output |
sync, list | text |
Output format: text or json |
--accounts |
sync, list | AGENTCORE_ACCOUNTS env or empty |
Comma-separated AWS account IDs for cross-account scanning |
--assume-role-name |
sync, list | AGENTCORE_ASSUME_ROLE_NAME env or AgentCoreSyncRole |
IAM role name to assume in each target account |
--debug |
sync, list | false |
Enable DEBUG logging |
--dry-run |
sync | false |
Preview without registering |
--overwrite |
sync | false |
Overwrite existing registrations |
--visibility |
sync | internal |
Registration visibility: public, internal, group-restricted |
--include-mcp-targets |
sync | false |
Register mcpServer gateway targets as separate MCP Servers |
--manifest |
sync | token_refresh_manifest.json |
Output path for token refresh manifest |
| Argument | Default | Description |
|---|---|---|
--manifest |
token_refresh_manifest.json |
Path to manifest file |
--registry-url |
REGISTRY_URL env or http://localhost |
Registry base URL |
--token-file |
REGISTRY_TOKEN_FILE env or .token |
Registry auth token file |
--loop |
false |
Run continuously |
--interval |
2700 (45 min) |
Refresh interval in seconds |
--scan / --no-scan |
--scan (enabled) |
Trigger security rescan after each credential update. Requires admin privileges on the registry token. Use --no-scan to disable. |
--debug |
false |
Enable DEBUG logging |
| Variable | Default | Description |
|---|---|---|
AWS_REGION |
us-east-1 |
AWS region to scan |
REGISTRY_URL |
http://localhost |
MCP Gateway Registry URL |
REGISTRY_TOKEN_FILE |
.token |
Path to registry auth token |
OAUTH_CLIENT_SECRET_<client_id> |
-- | Per-client OAuth2 secret (highest priority) |
AUTH0_CLIENT_SECRET |
-- | Client secret for Auth0 gateways |
OKTA_CLIENT_SECRET |
-- | Client secret for Okta gateways |
ENTRA_CLIENT_SECRET |
-- | Client secret for Entra gateways |
KEYCLOAK_CLIENT_SECRET |
-- | Client secret for Keycloak gateways |
AGENTCORE_ACCOUNTS |
-- | Comma-separated AWS account IDs for cross-account scanning |
AGENTCORE_ASSUME_ROLE_NAME |
AgentCoreSyncRole |
IAM role name to assume in each target account |
The CLI can scan multiple AWS accounts in a single run. It assumes an IAM role in each target account to discover and register resources.
# Scan two accounts
uv run python -m cli.agentcore sync --accounts 111111111111,222222222222
# Scan with a custom role name
uv run python -m cli.agentcore sync --accounts 111111111111,222222222222 --assume-role-name MyCrossAccountRole
# List resources across accounts
uv run python -m cli.agentcore list --accounts 111111111111,222222222222
# Or use environment variables
export AGENTCORE_ACCOUNTS=111111111111,222222222222
export AGENTCORE_ASSUME_ROLE_NAME=AgentCoreSyncRole
uv run python -m cli.agentcore syncHow it works:
- The CLI parses the
--accountsflag (orAGENTCORE_ACCOUNTSenv var) into a list of account IDs. - For each account, it calls
sts:AssumeRoleonarn:aws:iam::{account_id}:role/{role_name}to obtain temporary credentials. - A boto3 session is created with those temporary credentials and passed to the scanner and registration builder.
- Discovery and registration proceed as normal, scoped to each account's resources.
- If
--accountsis not provided, the CLI scans only the current account (default behavior).
If AssumeRole fails for any account, the CLI stops and reports the error.
Each target account needs an IAM role that trusts the caller's account and has AgentCore discovery permissions. See the Cross-Account IAM Prerequisites for setup details.
The IAM user or role lacks required permissions. Attach the discovery policy from the prerequisites guide.
The resource is already registered in the registry. Use --overwrite to update the existing registration with current metadata.
If the token refresher logs HTTP 500 from nginx -- registry token may be expired, regenerate the registry auth token and retry:
# Regenerate the registry ingress token
python credentials-provider/oauth/ingress_oauth.py
# Retry token refresh
uv run python -m cli.agentcore.token_refresher --manifest token_refresh_manifest.json --token-file .tokenThe registry auth token file (default: .token) does not exist. Generate it with:
python credentials-provider/oauth/ingress_oauth.pyIn --dry-run mode, the CLI performs discovery but does not register. Remove the --dry-run flag to perform actual registration.
Increase the timeout with --timeout 60 (or higher). The default is 30 seconds.
For registering individual AgentCore gateways or agents one at a time, use the same registration process as any other MCP server or agent in the registry. This is no different from how you register any MCP server or A2A agent -- you create a JSON configuration file and use the service management CLI.
This approach is useful when:
- You want to register a single gateway without scanning the entire account
- You need custom configuration (specific tool lists, descriptions, tags)
- You are integrating a specific AgentCore sample (e.g., Customer Support Assistant)
- Create a JSON config file describing the gateway or agent (path, proxy URL, auth scheme, tags, tool list)
- Register with the CLI:
./cli/service_mgmt.sh add gateway-config.json - Provide a JWT token when calling the gateway -- the IdP does not matter, just provide a valid bearer token at call time via
--token-file - Refresh the token when it expires -- how you obtain the token is up to you (curl, SDK, script)
The identity provider is irrelevant for manual registration. The registry uses passthrough authentication for auth_provider: "bedrock-agentcore" -- it forwards the bearer token to the AgentCore gateway, which validates it against whatever IdP is configured.
{
"server_name": "customer-support-assistant",
"description": "Amazon Bedrock AgentCore Gateway for customer support operations",
"path": "/customer-support-assistant",
"proxy_pass_url": "https://<YOUR-GATEWAY-ID>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp/",
"auth_provider": "bedrock-agentcore",
"auth_scheme": "bearer",
"supported_transports": ["streamable-http"],
"tags": ["bedrock", "agentcore", "customer-support"],
"headers": [
{
"Authorization": "Bearer $CUSTOMER_SUPPORT_AUTH_TOKEN"
}
],
"num_tools": 2,
"is_python": false,
"tool_list": [
{
"name": "LambdaUsingSDK___check_warranty_status",
"parsed_description": {
"main": "Check the warranty status of a product using its serial number"
},
"schema": {
"type": "object",
"properties": {
"serial_number": {"type": "string", "description": "Product serial number"}
},
"required": ["serial_number"]
}
}
]
}Key Configuration Parameters:
| Parameter | Description |
|---|---|
path |
URL path where this service is accessible through the registry |
proxy_pass_url |
Backend AgentCore Gateway URL. Replace <YOUR-GATEWAY-ID> with your actual Gateway ID |
auth_provider |
Set to bedrock-agentcore for passthrough authentication -- the registry forwards the bearer token without validating it |
tags |
Searchable tags used by intelligent_tool_finder for hybrid search (semantic + tag-based) |
tool_list |
Tool definitions with names, descriptions, and JSON schemas. Enables the registry to catalog tools for dynamic discovery by AI agents |
# Register the gateway
./cli/service_mgmt.sh add gateway-config.json
# Call a tool through the registry (provide a valid JWT from any IdP)
uv run cli/mcp_client.py \
--url http://localhost/customer-support-assistant/mcp \
--token-file .cognito_access_token \
call --tool LambdaUsingSDK___check_warranty_status \
--args '{"serial_number":"MNO33333333"}'| Method 1: Bulk Scanner | Method 2: Manual Registration | |
|---|---|---|
| Discovery | Automatic (scans AWS account) | Manual (you provide the config) |
| Token refresh | Automated (token_refresher.py) |
Manual (you manage token lifecycle) |
| Customization | Standard metadata from AWS API; skills must be added manually after import | Full control (tool lists, descriptions, tags, skills) |
| Scale | All gateways/runtimes at once | One resource at a time |
| IdP | Auto-detected from discovery URL | Any -- just provide a valid JWT |
Verify:
- Service is registered:
uv run cli/mcp_client.py --url http://localhost/mcpgw/mcp call --tool list_services --args '{}' - Path matches (use trailing slash for bedrock-agentcore services)
- Health status is healthy in the UI
- Refresh your egress access token (regenerate from your IdP)
- Verify token file path is correct
- Check token has not expired (TTL varies by IdP)
- Verify AgentCore gateway is accessible from the registry container
- Check network connectivity
- Review registry logs:
docker logs mcp-gateway-registry-registry-1