
Connect Atlassian tools to Amazon Bedrock AgentCore Gateway with OAuth 2.0 (3LO)
A step-by-step guide to connecting OAuth 2.0-protected tools to a centrally managed AgentCore Gateway using three-legged authorization. Covers two production-ready approaches—built-in OpenAPI templates and direct MCP server integration via Dynamic Client Registration—using Atlassian Jira as the working example.
Organizations standardizing on a single, centrally managed gateway for agentic traffic — so that tools such as Claude Code, Amazon Quick, or an internally built agent all reach enterprise systems through one governed entry point — can build that gateway on Amazon Bedrock AgentCore Gateway a fully managed AI gateway that provides a single, secure entry point for agentic traffic — connecting agents to tools.
Adding a tool to the Gateway as a target means deciding how the Gateway authenticates to it outbound. This post covers two ways to do that under OAuth 2.0's three-legged flow (3LO) — the authorization-code grant used whenever a call needs to act on behalf of a specific end user rather than a generic service account:
- A built-in connector, backed by a credential provider configured with a client ID and secret registered ahead of time.
- A custom credential provider, backed by a client the Gateway registers for itself at setup time, using OAuth 2.0 Dynamic Client Registration (DCR) — with no pre-registered app at all.
Atlassian Jira is the example used throughout, since it exposes both integration surfaces: a classic REST API , reachable through the built-in connector, and a hosted Remote MCP Server (branded Rovo ), reachable through a custom provider.
- Method A — the built-in connector. AgentCore Gateway ships a pre-built OpenAPI schema, maintained by AWS, that exposes Jira's REST API as an MCP target — the fastest path to a working integration, guided entirely through the console.
- Method B — a custom credential provider with DCR. AgentCore Gateway's
mcpServertarget type connects directly to Atlassian's Remote MCP Server, giving you its complete, live tool set — including the cross-product search and Teamwork Graph tools described in Understand the Atlassian Rovo MCP server — fully scriptable via the AWS CLI and API.
Both methods rely on the same underlying primitives. Inbound authentication is how a caller proves its identity to the Gateway — a JSON Web Token (JWT) issued by an identity provider such as Amazon Cognito, using the OpenID Connect (OIDC) standard. Outbound authentication is how the Gateway itself authenticates to the target, handled by AgentCore Identity through a credential provider — a stored configuration that performs an OAuth 2.0 authorization and token exchange on the Gateway's behalf. The two methods below differ only in how that credential provider's client is set up; everything else about the Gateway stays the same.
Choosing between them: both methods connect Jira to the Gateway reliably in production — there's no need to set up both. Use the comparison table below to pick the one that fits your requirements, then jump directly to that section; each is self-contained.
Solution overview
AgentCore Gateway validates a JWT on every inbound request before accepting it, and pairs each target with a credential provider that AgentCore Identity uses to authenticate outbound on the Gateway's behalf.
The built-in connector uses a classic OAuth 2.0 (3LO) credential provider: you register an app with Atlassian ahead of time to get a fixed client ID and secret, configure that app with the scopes and callback URL AgentCore requires, and add a target with matching configuration. Creating the target triggers one administrator-level authorization, which the Gateway also uses to index the target's available operations.
The custom credential provider replaces that fixed client with one the Gateway registers for itself, using DCR: AgentCore issues a callback URL first, you register a client against Atlassian's discovery endpoint using that callback, and Atlassian returns a client ID and secret you feed back into the credential provider. No scopes are pre-configured on Atlassian's side — each user consents to the specific scopes requested at authorization time. In both methods, the page Atlassian redirects to after a successful authorization is under your control: it can be your own application, a plain landing page, or, as this walkthrough uses for the custom provider, a small Lambda function.
The two methods also differ in how well they fit a deployment pipeline. Adding a built-in connector target is a manual, console-only action and can't be scripted into CI/CD. The custom provider method has more moving parts, but every one is an AWS CLI or API call, making it the better fit for a fully automated rollout.
Once either is connected, an agent can call Jira tools directly in conversation, for example:
"What are my open Jira tickets in the KAN project, and which ones are unassigned?"
"Create a Jira bug in project KAN titled 'Login page 500 error on Safari' and assign it to me."

Once either is connected, an agent can call Jira tools directly in conversation, for example:
"What are my open Jira tickets in the KAN project, and which ones are unassigned?""Create a Jira bug in project KAN titled 'Login page 500 error on Safari' and assign it to me."
Method comparison

Shared prerequisites
- An AWS account with permissions to create AgentCore Gateways, AgentCore Identity credential providers, IAM roles/policies, and Amazon Cognito resources.
- An identity provider capable of issuing JWTs for inbound authentication. This post uses Amazon Cognito ; any OIDC-compliant IdP works instead — Microsoft Entra ID , Okta, etc.
- An Atlassian account with a Jira Cloud site.
- The AWS CLI configured with credentials for the target account/region.
Set up the inbound identity provider (Amazon Cognito)
Create a Amazon Cognito User Pool and an App Client that issues the JWTs your agents/clients use to call the Gateway; Cognito's developer guide and the AgentCore samples repository cover this setup in more depth than is in scope here.
- Auth flows: enable
ALLOW_ADMIN_USER_PASSWORD_AUTH(or SRP) so you can mint access tokens for testing.
- Record the User Pool ID, App Client ID, and the discovery URL:
https://cognito-idp.<region>.amazonaws.com/<user-pool-id>/.well-known/openid-configuration
Create the AgentCore Gateway
aws bedrock-agentcore-control create-gateway \ --name MyAtlassianGateway \ --role-arn arn:aws:iam::<account-id>:role/<gateway-execution-role> \ --protocol-type MCP \ --protocol-configuration '{"mcp":{"supportedVersions":["2025-11-25"]}}' \ --authorizer-type CUSTOM_JWT \ --authorizer-configuration '{ "customJWTAuthorizer": { "discoveryUrl": "https://cognito-idp.<region>.amazonaws.com/<user-pool-id>/.well-known/openid-configuration", "allowedClients": ["<cognito-app-client-id>"] } }'Set
authorizerType to CUSTOM_JWT ; changing it later means recreating the Gateway. Pin supportedVersions to 2025-11-25 or later — 3LO (the AUTHORIZATION_CODE grant type used throughout this post) does not work on earlier protocol versions. MCP server targets currently support 2026-07-28 , 2025-11-25 , 2025-06-18 , and 2025-03-26 . Once pinned, every client call must perform an explicit initialize handshake carrying that protocolVersion , and send the MCP-Protocol-Version header on subsequent calls, or it fails with:{"error": {"code": -32022, "message": "Unsupported protocol version: 2025-03-26", "data": {"supported": ["2025-11-25"], "requested": "2025-03-26"}}}Now that you have a Gateway created with inbound authentication setup, its time to add targets and setup outbound authentication for them. Choose method A for AWS Console based setup with REST API and built-in provider or method B for API/CLI based setup with custom provider and MCP server.
Method A: the built-in connector
Method A prerequisites
- Console access — this method's target-creation step is console-only. Read more about it at AWS's documentation
- Permission to create an OAuth 2.0 (3LO) app in the Atlassian Developer Console , if you use OAuth rather than a plain API key.

Step 1 — Register a classic OAuth 2.0 (3LO) app in Atlassian

Create an app in the Atlassian Developer Console and configure OAuth 2.0 (3LO) — Atlassian's term for the standard authorization code grant .
Authorization — callback URL. You'll get the exact value to add here from AWS in Step 2. It looks like:
https://bedrock-agentcore.<region>.amazonaws.com/identities/oauth2/callback/<provider-id> It must match exactly, or you'll see this error after already reaching Atlassian's login/consent screen:
"The app's callback URL is invalid. Contact the app developer to fix the redirect URL in the app's settings."
Permissions — scopes. Under Permissions, add the Jira API and select classic scopes:
Scope | Purpose |
|---|---|
read:jira-work | Read issues, projects, workflows |
write:jira-work | Create/edit issues |
read:jira-user | Resolve assignee/reporter/user info |
offline_access won't appear in this list — it's a standard OAuth scope for a refresh token, not a product permission, and applies automatically to any 3LO app. Include it in the credential provider's scopes list in Step 2. For Confluence, add the Confluence API instead, with scopes such as read:confluence-content.all , write:confluence-content , search:confluence .
Step 2 — Create the OAuth2 credential provider in AgentCore Identity
aws bedrock-agentcore-control create-oauth2-credential-provider \ --name AtlassianJira \ --credential-provider-vendor AtlassianOauth2 \ --oauth2-provider-config-input '{ "atlassianOauth2ProviderConfig": { "clientId": "<your-atlassian-client-id>", "clientSecret": "<your-atlassian-client-secret>" } }'
The
AtlassianOauth2 vendor authenticates against Atlassian's classic identity server ( auth.atlassian.com ), matching the classic REST API this method calls. The response includes a callbackUrl — copy it into the Atlassian app's Authorization settings from Step 1.Step 3 — Add the Jira target via the console
In the Gateway console, Add Target → built-in templates from integration providers → Jira. Attach the credential provider from Step 2, with
grantType: AUTHORIZATION_CODE and:{ "credentialProviderType": "OAUTH", "credentialProvider": { "oauthCredentialProvider": { "providerArn": "<credential-provider-arn>", "scopes": ["read:jira-work", "write:jira-work", "read:jira-user", "offline_access"], "customParameters": { "audience": "api.atlassian.com", "prompt": "consent" }, "grantType": "AUTHORIZATION_CODE", "defaultReturnUrl": "<a URL your users/admins should land on after consent>" } }}customParameters.audience: "api.atlassian.com" is required — Atlassian's classic authorization endpoint needs it to scope the resulting token to the right API. prompt: "consent" forces the consent screen even for a previously authorized app, which is useful while iterating on scopes; it can be dropped in production.
Step 4 — Complete the one-time admin consent
Target creation returns an
authorizationUrl and puts the target into CREATE_PENDING_AUTH . This link has a hard ~10-minute lifetime, enforced by AgentCore Identity's OAuth 2.0 authorization URL session binding — don't generate it until you're ready to open it immediately, and don't pre-fetch it programmatically (even one automated request consumes its single use). If it expires, delete the pending target and create a fresh one.Open the link, sign in, and grant consent; you'll be redirected through AWS's callback to your
defaultReturnUrl , and the target transitions to READY within a couple of minutes.This consent isn't permanent — with
offline_access in scope, AgentCore Identity automatically refreshes the underlying access token for as long as Atlassian's refresh token stays valid, with no action needed from you. If it's ever revoked or fully expires, an administrator repeats this step.Test Method A
<gateway-url> is the gatewayUrl field from create-gateway / get-gateway , used as-is — it already ends in /mcp ; appending /mcp again produces HTTP 400 .ACCESS_TOKEN=$(aws cognito-idp admin-initiate-auth \ --user-pool-id <user-pool-id> --client-id <cognito-app-client-id> \ --auth-flow ADMIN_USER_PASSWORD_AUTH \ --auth-parameters USERNAME=<username>,PASSWORD=<password> \ --query 'AuthenticationResult.AccessToken' --output text)
curl -s -X POST "<gateway-url>" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" -H "MCP-Protocol-Version: 2025-11-25" \ -d '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0"}}}'
curl -s -X POST "<gateway-url>" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" -H "MCP-Protocol-Version: 2025-11-25" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'tools/list returns tools such as getIssue , createIssue , editIssue , SearchIssues (JQL), addComment , listProjects , GetAllBoards , getAllSprints , and more. Tool calls work immediately after the one-time admin consent — no per-user step is required, since this method calls the classic REST API on the admin's authorization. An agent using this gateway can now answer prompts like:"Search my Jira projects for anything related to 'billing' and summarize the open issues."
"Move issue KAN-14 to the next sprint."
Method B: a custom credential provider with Dynamic Client Registration
Atlassian's two OAuth servers
Atlassian's Remote MCP Server (
mcp.atlassian.com ) authenticates through its own OAuth 2.0 authorization server, separate from the classic auth.atlassian.com identity server Method A uses: | Classic identity server (Method A) | MCP-native server (Method B) |
|---|---|---|
Issuer | auth.atlassian.com | mcp.atlassian.com |
Authorization endpoint | https://auth.atlassian.com/authorize | https://mcp.atlassian.com/v1/authorize |
Token endpoint | https://auth.atlassian.com/oauth/token | https://mcp.atlassian.com/v1/token |
Registration endpoint (DCR) | https://auth.atlassian.com/oidc/register | https://mcp.atlassian.com/v1/register |
A token from the classic server is accepted by the Remote MCP Server's
initialize and tools/list calls, but every tools/call against a real tool fails uniformly with "We are having trouble completing this action. Please try again shortly." , regardless of tool or arguments. Don't reuse Method A's credential provider here — it will appear to work until the first real tool invocation. An MCP client must register against the MCP-native server instead, which is what this method sets up.
Method B prerequisites
- Everything in the shared prerequisites above.
- No Atlassian Developer Console app — the client is registered dynamically, at setup time, via API calls you make yourself.
- A redirect endpoint Atlassian can reach over HTTPS after a user completes consent. This walkthrough deploys a minimal AWS Lambda function with a Function URL for that purpose; a
localhostaddress only works for local testing (Step 2), and any real, publicly reachable HTTPS endpoint your organization already runs is an equally valid choice.
What's one-time versus scriptable. Registering the OAuth client (Step 3) and allowlisting your domain (Step 4) are one-time administrative actions — the domain allowlist is an Atlassian organization setting with no API, and an Atlassian admin sets it once. Everything else — the IAM policy (Step 1), the callback endpoint (Step 2), and the Gateway target itself (Step 5) — is a plain AWS CLI/API call, and belongs in your infrastructure-as-code or CI/CD pipeline.
Step 1 — Grant the gateway execution role the permissions it needs
Target creation succeeds without these permissions; every tool invocation then fails at runtime with a 403
AccessDeniedException . Three do the actual work:-
GetWorkloadAccessTokenForJWTexchanges the inbound Cognito JWT for an AgentCore workload identity token — the step that lets the Gateway act on behalf of the specific calling user.
-
GetResourceOauth2TokenandCompleteResourceTokenAuthread and finalize the Atlassian OAuth grant in the token vault — the mechanics behind the per-user consent flow in Step 6.
Grant them on both the workload-identity and token-vault resources; AgentCore checks different actions against each depending on the internal call path:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AgentCoreWorkloadIdentityAccess", "Effect": "Allow", "Action": [ "bedrock-agentcore:GetWorkloadAccessToken", "bedrock-agentcore:GetWorkloadAccessTokenForJWT", "bedrock-agentcore:GetWorkloadAccessTokenForUserId", "bedrock-agentcore:GetResourceOauth2Token", "bedrock-agentcore:GetResourceApiKey", "bedrock-agentcore:CompleteResourceTokenAuth" ], "Resource": [ "arn:aws:bedrock-agentcore:<region>:<account-id>:workload-identity-directory/default", "arn:aws:bedrock-agentcore:<region>:<account-id>:workload-identity-directory/default/workload-identity/*" ] }, { "Sid": "AgentCoreTokenVaultAccess", "Effect": "Allow", "Action": [ "bedrock-agentcore:GetResourceOauth2Token", "bedrock-agentcore:GetResourceApiKey", "bedrock-agentcore:CompleteResourceTokenAuth" ], "Resource": [ "arn:aws:bedrock-agentcore:<region>:<account-id>:token-vault/default", "arn:aws:bedrock-agentcore:<region>:<account-id>:token-vault/default/*" ] }, { "Sid": "AgentCoreOAuthSecretAccess", "Effect": "Allow", "Action": "secretsmanager:GetSecretValue", "Resource": "arn:aws:secretsmanager:<region>:<account-id>:secret:bedrock-agentcore-identity!*" } ]}aws iam put-role-policy \ --role-name <gateway-execution-role> \ --policy-name AgentCoreOAuthWorkloadIdentityAccess \ --policy-document file://oauth-workload-identity-policy.jsonStep 2 — Set up a redirect endpoint
OAuth's authorization code flow requires a redirect URI: after a user consents, Atlassian sends their browser back to a URL you control, carrying the result. That URL must be a real, internet-reachable HTTPS endpoint — Atlassian's servers send the user's own browser there, independently of your laptop or any manual test session.
What it needs to do depends on how you use it. A plain acknowledgment page needs no server-side logic — a static page on Amazon S3, or any web page your organization already runs, is enough. Step 6's production consent callback, however, needs to take an action — calling
CompleteResourceTokenAuth — which requires running code, not just serving a file. A minimal Lambda function behind a Function URL is a low-maintenance way to do that: no server to patch, HTTPS by default.Deploying it requires
lambda:CreateFunction , lambda:CreateFunctionUrlConfig , lambda:AddPermission , and iam:CreateRole / iam:AttachRolePolicy for its own execution role:cat > /tmp/callback_handler.py <<'EOF'def handler(event, context): qs = event.get("queryStringParameters") or {} print("CALLBACK_RECEIVED:", qs) # visible in CloudWatch Logs return { "statusCode": 200, "headers": {"Content-Type": "text/html"}, "body": "<html><body>Received, you can close this tab.</body></html>" }EOFcd /tmp && zip callback_handler.zip callback_handler.py
aws iam create-role --role-name AtlassianCallbackLambdaRole \ --assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}'aws iam attach-role-policy --role-name AtlassianCallbackLambdaRole \ --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
aws lambda create-function \ --function-name AtlassianOAuthCallback \ --runtime python3.12 \ --handler callback_handler.handler \ --role arn:aws:iam::<account-id>:role/AtlassianCallbackLambdaRole \ --zip-file fileb:///tmp/callback_handler.zip
aws lambda create-function-url-config \ --function-name AtlassianOAuthCallback \ --auth-type NONE
aws lambda add-permission \ --function-name AtlassianOAuthCallback \ --statement-id AllowPublicFunctionUrl \ --action lambda:InvokeFunctionUrl \ --principal "*" \ --function-url-auth-type NONEThis returns a
FunctionUrl , such as https://<url-id>.lambda-url.<region>.on.aws/ — use it as the redirect URI wherever this post calls for one: once for the schema capture in Step 5, and as the production defaultReturnUrl in Step 6.The handler above only logs what it receives; retrieve captured values with
aws logs tail /aws/lambda/AtlassianOAuthCallback --since 10m . That's sufficient for Step 5, where an administrator copies a code value once, by hand. It is not sufficient for Step 6's production callback: extend the handler to call CompleteResourceTokenAuth directly from within the Lambda function — using the AWS SDK, and correlating the incoming session_id to the current user's application session (for example, via a signed state parameter or your own session store) — rather than requiring anyone to read logs and run a command by hand. AWS's reference callback server implementation shows this pattern in full.Step 3 — Register a client with Atlassian's MCP-native OAuth server via DCR
Create a placeholder credential provider to get AgentCore's callback URL:
aws bedrock-agentcore-control create-oauth2-credential-provider \ --name AtlassianMcpNative \ --credential-provider-vendor CustomOauth2 \ --oauth2-provider-config-input '{ "customOauth2ProviderConfig": { "oauthDiscovery": { "discoveryUrl": "https://mcp.atlassian.com/.well-known/oauth-authorization-server" }, "clientId": "placeholder", "clientSecret": "placeholder" } }'The
CustomOauth2 provider — unlike the preset AtlassianOauth2 provider available with AgentCore Gateway — accepts an arbitrary OAuth server's discovery document, which is what makes targeting mcp.atlassian.com possible. The response includes a callbackUrl :https://bedrock-agentcore.<region>.amazonaws.com/identities/oauth2/callback/<provider-id> Register a real client via DCR, using that callback URL as the redirect URI:
curl -s -X POST "https://mcp.atlassian.com/v1/register" \ -H "Content-Type: application/json" \ -d '{ "client_name": "MyAtlassianGateway", "client_uri": "https://bedrock-agentcore.<region>.amazonaws.com", "redirect_uris": ["<callbackUrl from previous step>"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "client_secret_post" }'This returns a
client_id and client_secret — no Developer Console app, no scopes pre-selected on Atlassian's side. Scopes for this method are requested dynamically at authorize time (Step 5). Set client_uri explicitly: it's what Atlassian's domain-allowlist mechanism (Step 4) associates your client with.Update the credential provider with the real client credentials:
aws bedrock-agentcore-control update-oauth2-credential-provider \ --name AtlassianMcpNative \ --credential-provider-vendor CustomOauth2 \ --oauth2-provider-config-input '{ "customOauth2ProviderConfig": { "oauthDiscovery": {"discoveryUrl": "https://mcp.atlassian.com/.well-known/oauth-authorization-server"}, "clientId": "<client_id>", "clientSecret": "<client_secret>" } }'{ "name": "AtlassianMcpNative", "credentialProviderVendor": "CustomOauth2", "credentialProviderArn": "arn:aws:bedrock-agentcore:<region>:<account-id>:token-vault/default/oauth2credentialprovider/AtlassianMcpNative", "callbackUrl": "https://bedrock-agentcore.<region>.amazonaws.com/identities/oauth2/callback/<provider-id>", "status": "READY"}Step 4 — Allowlist your domain in Atlassian's Rovo MCP server settings
Third-party clients connecting to Atlassian's Remote MCP Server must have their redirect domain explicitly trusted by an org admin; Atlassian's own first-party partners are trusted by default.
- Go to Atlassian Administration (
admin.atlassian.com) → your organization → Rovo → Rovo MCP server.
- Select Add domain, and enter:
https://bedrock-agentcore.<region>.amazonaws.com/**Note: replace<region>with your actual AWS region, e.g.us-east-1
The trailing
/** is not optional. Domain entries here are path-scoped patterns, not domain-wide matches — a bare domain (no wildcard) only matches the literal root path / . AgentCore's callback URL always includes a path, so without /** , every authorization attempt fails at Atlassian's consent screen with:"Your organization admin must authorize access from this redirect URL to this site."

Atlassian also supports an IP allowlist for the Rovo MCP server, configured independently of the domain allowlist — useful if your organization needs to restrict which network ranges can complete this authorization flow at all. A request blocked by the IP allowlist produces a distinct error about the connecting address rather than the redirect URL; the two controls don't interact.
Step 5 — Create the Gateway target, with a static tool schema
Why a static schema is required. AgentCore Gateway targets list tools in one of two modes.
DEFAULT mode indexes a target ahead of time: on CreateGatewayTarget , the Gateway calls tools/list , prompts/list , resources/list , and resources/templates/list , and builds a synchronized catalog — if the target doesn't implement one of those calls, indexing, and therefore target creation, fails outright. DYNAMIC mode skips this upfront indexing and forwards each request to the target as it's made, but it doesn't support the AUTHORIZATION_CODE grant type — the 3LO flow this method depends on — so it isn't an option here.That leaves
DEFAULT mode, and Atlassian's Remote MCP Server doesn't fully cooperate with its indexing step: it advertises {"logging":{},"tools":{"listChanged":true},"resources":{}} in initialize — no prompts capability, and an unimplemented resources capability despite advertising it. Calling prompts/list , resources/list , or resources/templates/list returns:{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}which
CreateGatewayTarget treats as a hard failure:Failed to connect and fetch tools from the provided MCP target server. Error - Method not found
The
mcpToolSchema field avoids this: supplying the tool schema statically — available only alongside AUTHORIZATION_CODE — disables indexing entirely, so none of the four calls happen during target creation.Capturing the tool schema once. Atlassian's DCR endpoint doesn't return a token that lets you later modify a client's registered redirect URIs, so the client from Step 3 — locked to AgentCore's callback — can't be reused for a different redirect URI. Register a second client for this specific task instead. An administrator runs this once, when first setting up the integration; it is not part of the ongoing deployment pipeline, and only needs repeating if Atlassian changes its tool set.
curl -s -X POST "https://mcp.atlassian.com/v1/register" \ -H "Content-Type: application/json" \ -d '{ "client_name": "Schema capture (administrative)", "redirect_uris": ["<Lambda Function URL from Step 2>"], "grant_types": ["authorization_code", "refresh_token"], "response_types": ["code"], "token_endpoint_auth_method": "client_secret_post" }'Authorize it once in a browser (
https://mcp.atlassian.com/v1/authorize?client_id=<schema-capture client_id>&redirect_uri=<Lambda Function URL, URL-encoded>&response_type=code&scope=read:jira-work+write:jira-work+read:jira-user+offline_access&state=<random> ), and retrieve the resulting code from aws logs tail /aws/lambda/AtlassianOAuthCallback --since 10m . Exchange it for a token — the token endpoint requires form encoding, not JSON:curl -s -X POST https://mcp.atlassian.com/v1/token \ -H "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "grant_type=authorization_code" \ --data-urlencode "code=<code>" \ --data-urlencode "redirect_uri=<Lambda Function URL from Step 2>" \ --data-urlencode "client_id=<schema-capture client_id>" \ --data-urlencode "client_secret=<schema-capture client_secret>"Then call
initialize and tools/list against https://mcp.atlassian.com/v1/mcp with that token. Reshape each tool into {name, description, inputSchema} , dropping MCP-only fields ( annotations , execution , $schema ), and wrap the list in a tools key — a bare array fails target creation with Invalid MCP ToolSchema. mcpToolSchema must be an object with 'tools' array :{ "tools": [ {"name": "atlassianUserInfo", "description": "Get current user info", "inputSchema": {"type": "object", "properties": {}}}, {"name": "getVisibleJiraProjects", "description": "Get projects", "inputSchema": {"type": "object", "properties": {"cloudId": {"type": "string"}}, "required": ["cloudId"]}} ]}Treat this schema as a versioned artifact in your repository, not something regenerated on every deploy.
Create the target:
// target-config.json{ "mcp": { "mcpServer": { "endpoint": "https://mcp.atlassian.com/v1/mcp", "mcpToolSchema": {"inlinePayload": "<the {\"tools\": [...]} JSON, as a string>"}, "listingMode": "DEFAULT" } }}// credential-config.json[ { "credentialProviderType": "OAUTH", "credentialProvider": { "oauthCredentialProvider": { "providerArn": "arn:aws:bedrock-agentcore:<region>:<account-id>:token-vault/default/oauth2credentialprovider/AtlassianMcpNative", "scopes": ["read:jira-work", "write:jira-work", "read:jira-user", "offline_access"], "grantType": "AUTHORIZATION_CODE", "defaultReturnUrl": "<the Lambda Function URL from Step 2>" } } }]aws bedrock-agentcore-control create-gateway-target \ --gateway-identifier <gateway-id> \ --name atlassian-mcp-native \ --target-configuration file://target-config.json \ --credential-provider-configurations file://credential-config.jsonTwo details worth noting:
- No
audienceparameter is needed. Atlassian's classic OAuth server requires an explicitcustomParameters.audiencevalue to scope tokens correctly; its MCP-native server doesn't — AgentCore Gateway attaches an OAuth 2.0 resource indicator (resource=https://mcp.atlassian.com/v1/mcp, per RFC 8707 ) to the authorization request automatically.
- Scopes work the same way regardless of listing mode. The
scopeslist means the same thing whether a target discovers tools dynamically or, as here, from a static schema — the OAuth scope requested at authorization time, unrelated to how the Gateway later learns what tools exist.
Since
mcpToolSchema skips discovery, the target reaches READY immediately — no admin consent at creation time. Consent happens lazily, the first time each distinct call invokes a tool (Step 6).Step 6 — Complete the per-user consent flow
defaultReturnUrl must point at the Lambda Function URL from Step 2, not an arbitrary page. Per AgentCore's OAuth 2.0 authorization URL session binding design, that endpoint's job is to verify the current user's session and call CompleteResourceTokenAuth to finalize the grant. Point it at a page that doesn't do this, and the browser redirect will appear to succeed while the token is never stored — every subsequent tool call re-triggers the same consent request indefinitely.The return URL must also be pre-registered on the Gateway's workload identity:
aws bedrock-agentcore-control update-workload-identity \ --name <gateway-id> \ --allowed-resource-oauth2-return-urls "<the Lambda Function URL from Step 2>"As described in Step 2, your production handler for this endpoint calls
CompleteResourceTokenAuth directly; the command below shows the same call in its manual form, for demonstration:aws bedrock-agentcore complete-resource-token-auth \ --session-uri "<captured session_id, URL-decoded>" \ --user-identifier "userToken=<the inbound Cognito JWT used to trigger the elicitation>"The flow end to end: a client calls a tool for a user who hasn't authorized yet; the Gateway returns a structured elicitation instead of an error —
{"jsonrpc":"2.0","id":1,"error":{"code":-32042,"message":"This request requires more information.","data":{"elicitations":[{"mode":"url","url":"https://bedrock-agentcore.<region>.amazonaws.com/identities/oauth2/authorize?request_uri=...","message":"Please login to this URL for authorization."}]}}}— the user opens that URL within ~10 minutes and completes Atlassian's consent screen; Atlassian redirects to AgentCore's fixed callback, which redirects again to your
defaultReturnUrl ; your backend calls CompleteResourceTokenAuth ; and the same tools/call now succeeds, returning real data.Test Method B
<gateway-url> is the gatewayUrl value returned by create-gateway / get-gateway , used as-is — it already includes the /mcp suffix.ACCESS_TOKEN=$(aws cognito-idp admin-initiate-auth \ --user-pool-id <user-pool-id> --client-id <cognito-app-client-id> \ --auth-flow ADMIN_USER_PASSWORD_AUTH \ --auth-parameters USERNAME=<username>,PASSWORD=<password> \ --query 'AuthenticationResult.AccessToken' --output text)
curl -s -X POST "<gateway-url>" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" -H "MCP-Protocol-Version: 2025-11-25" \ -d '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0"}}}'
curl -s -X POST "<gateway-url>" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" -H "MCP-Protocol-Version: 2025-11-25" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Conclusion
This post covered two ways to bring a third-party tool into a centrally managed AgentCore Gateway under OAuth 2.0 (3LO): a built-in connector backed by a classic, pre-registered credential provider, and a custom credential provider backed by a dynamically registered OAuth client. What generalizes beyond Jira is the pattern itself — how AgentCore Identity separates inbound authentication from outbound, how a credential provider mediates between a fixed app registration and a dynamically registered one, and how a REST-API-shaped connector differs from a direct MCP server connection to reach the same target. Applying this to a different tool follows the same steps; the specific setup required on the provider's side, and occasionally on the AWS side, will vary with what that provider supports.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article