aws/agent-toolkit-for-aws/agents-connect

Claude Code and agent skill by aws/agent-toolkit-for-aws

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when connecting your agent to external APIs, tools, or services via Gateway, or restricting tool access with Cedar policies. Handles gateway setup, target types, outbound auth (OAuth, API key, IAM), credentials, and Cedar policy authoring. Triggers on: "connect to API", "add gateway", "connect to MCP server", "Lambda tools", "OpenAPI", "gateway target", "Cedar policy", "restrict tools", "policy engine", "gateway auth error", "store API key", "outbound credential", "env var API key", "API key None after deploy", "credential not available after deploy", "should this be a gateway target", "give my agent tools", "add tools to agent". Not for inbound auth (who can call your agent) — use agents-harden. Not for debugging agent behavior — use agents-debug. Not for VPC networking errors (agent can't reach APIs due to VPC) — use agents-build. Not for creating or hosting a new MCP server project — use agents-get-started.

Install

npx vskill@latest install aws/agent-toolkit-for-aws/agents-connect

SKILL.md

The same SKILL.md was published earlier as aws/agent-toolkit-for-aws/agents-connect.

connect

Give your AgentCore agent access to external APIs, tools, and services via the AgentCore Gateway — and control what it can access with Cedar policies.

When to use

  • You want your agent to call an external API or MCP server
  • You want to expose Lambda functions as agent tools
  • You have an OpenAPI spec you want to turn into agent tools
  • Your agent needs credentials to call an external service
  • You want to restrict which tools your agent can call (Cedar policies)
  • You want role-based or amount-based access control on tool calls
  • A gateway connection, tool call, or policy authorization is failing

For adding Cedar policies to control tool access, load `references/policy.md`.

Input

$ARGUMENTS is optional:

/connect # interactive — asks what you're connecting to
/connect mcp # MCP server setup
/connect lambda # Lambda function as tools
/connect openapi # OpenAPI schema as tools
/connect credential # Add a credential for outbound auth

Process

Step 0: Verify CLI version

Run agentcore --version. This skill requires v0.9.0 or later. If the version is older, tell the developer to run agentcore update before proceeding.

Step 1: Read the project

Read agentcore/agentcore.json to understand:

  • What framework the project uses
  • What gateways and targets are already configured (in the agentCoreGateways array)

If no project context: Ask what they're trying to connect to and proceed with the appropriate pattern.

Step 2: Identify what they're connecting to

Ask (or infer from $ARGUMENTS):

"What are you connecting your agent to?
1. An external MCP server (e.g., a third-party tool provider)
2. A Lambda function you've written
3. An API with an OpenAPI spec
4. An AWS API Gateway REST API
5. An external service with no OpenAPI spec, MCP server, or Lambda in front of it — and you can't add one"

Options 1–4 front the service as a Gateway target. This is the default path: the gateway handles outbound auth via its credential providers (so the agent code never sees the secret), the tool becomes discoverable over MCP, and policy engines can authorize or deny calls at the edge. Pick the target type that matches the service.

Option 5 is Path D — register a credential and call the API directly from agent code. This is the fallback when fronting isn't practical; the skill walks through when it's appropriate and when it isn't.


Default: prefer a Gateway target over direct API calls in code

Before jumping into paths, set expectations. Most "my agent needs to call X" requests land on a Gateway target — not on httpx inside the entrypoint.

Why Gateway is the default:

  • Credential injection at the edge. Gateway's credential providers (OAuth, API key, IAM) attach auth to the outbound request. The agent code calls session.call_tool(...) — it never touches the secret. Agent code that does client = openai.OpenAI(api_key=...) is one leaked prompt / log line / traceback away from exfiltrating the key.
  • Discoverable tool catalog. Tools are listed by the MCP server; the framework (Strands, LangGraph, etc.) binds them automatically. Adding a tool is an agentcore add gateway-target + redeploy, not a code change.
  • Policy enforcement. Cedar policies can authorize or deny tool calls per principal, per tool, per argument value. This is impossible when tool calls are buried in httpx.post(...) inside agent code.
  • Semantic search. Once the catalog has 20+ tools, x_amz_bedrock_agentcore_search selects the relevant ones per turn.

When a direct API call in agent code is the right answer:

SituationWhy Gateway isn't rightWhat to do
Streaming/bidirectional protocol (SSE with live output, WebSockets, WebRTC, long-polling)Gateway's MCP transport doesn't front those yetDirect call, Path D
Latency hot path where the MCP hop is measurable and the trade-off is acceptedExtra network hopDirect call, Path D, with measurement to back the decision
Vendor proprietary protocol / binary SDKNo HTTP surface for Gateway to frontUse the vendor SDK directly, Path D for any secrets
Calling another agent via A2AA2A is HTTP-by-design and has its own auth model`agents-build/references/multi-agent.md`, not a Gateway target
AWS service SDK (S3, DynamoDB, SQS, etc.) the runtime already has IAM forNo auth value in fronting — adds hopsDirect boto3 call with the runtime's execution role

For every other case, recommend a Gateway target. If the developer insists on a direct call, ask which of the five situations above applies. If none, steer them back to a Gateway target.

Triage heuristic:

  • Service has an MCP server → Path A
  • Service is a Lambda function you control → Path B
  • Service has an OpenAPI spec (or you can generate one — FastAPI, ASP.NET, Spring, etc. generate OpenAPI automatically) → Path C
  • Service is already fronted by API Gateway → Path C (--type api-gateway)
  • None of the above and you can't add one → Path D

What Gateway is — and what it isn't

Before choosing a target type, get the mental model right. Most Gateway confusion comes from having it flipped.

Gateway hosts tools for your agent to call. The direction is:

Your agent ───→ Gateway ───→ Lambda function / OpenAPI API / MCP server / Smithy model
(agent calls tool)

The agent is the client. The Gateway fronts a catalog of tools. Each tool is a Gateway target (Lambda, OpenAPI, MCP server, API Gateway, Smithy).

Gateway is not an inbound reverse proxy for your agent. If you're building an app that needs to invoke your agent, the app does not go through a Gateway. The direction is:

Your app ───→ AgentCore Runtime (direct invoke_agent_runtime call)

The app signs the invocation with IAM SigV4 or presents a JWT. See `agents-build/references/integrate.md` for the app-side patterns.

When you're confused about which direction you need

Ask: who is calling whom?

  • "My agent needs to look up weather data" → agent is calling a tool → Gateway target (this skill, Paths A/B/C)
  • "My FastAPI app needs to call my agent" → app is calling the agent → direct invocation (not Gateway; use `agents-build/references/integrate.md`)
  • "My agent needs to fetch data from my FastAPI app" → agent is calling the app as a tool → Gateway target with the app exposed as an OpenAPI or REST target (Path C with your FastAPI's /openapi.json)

If you catch yourself configuring a Gateway target whose endpoint is bedrock-agentcore.<region>.amazonaws.com or pointing at your own runtime's URL, stop — you have the flow inverted.

What target type fits your tool
What the tool isTarget typeNotes
MCP server (third-party or your own)mcp-serverMost common for MCP tool catalogs
AWS Lambda function you wrotelambda-function-arnUses IAM auth automatically
HTTP API with an OpenAPI specopen-api-schemaFastAPI's built-in /openapi.json works
AWS API Gateway REST APIapi-gatewayFor APIs already fronted by API Gateway
AWS service with a Smithy modelsmithy-modelDirect AWS service integration

Your tool doesn't naturally have an OpenAPI spec and isn't an MCP server or Lambda? Either wrap it in a Lambda (simplest), generate an OpenAPI spec for it (FastAPI does this automatically), or front it with API Gateway.


Step 3: Navigate the auth matrix

This is the most common source of errors. The auth options depend on the target type, and the CLI exposes only a subset of what the API/SDK support.

What you're connecting toCLI --typeOutbound auth via CLIAdditional options via API/SDK
External MCP servermcp-servernone, oauth (2LO only)OAuth 3LO (AUTHORIZATION_CODE); IAM (SigV4)
Lambda functionlambda-function-arnnone (default — direct invoke via gateway role), oauth (2LO) for OAuth-protected downstreamsOAuth 3LO
OpenAPI specopen-api-schemaoauth (2LO), api-key (required — no none)OAuth 3LO
AWS API Gatewayapi-gatewaynone, api-keyIAM (GATEWAY_IAM_ROLE)
Smithy modelsmithy-modeloauth (2LO)IAM; OAuth 3LO

Two OAuth grant types, not one. The CLI's --outbound-auth oauth only configures 2-legged OAuth (client credentials / M2M). If the service requires 3-legged OAuth (AUTHORIZATION_CODE grant, user-delegated access), there is no CLI flag — you must configure the target via boto3 / the AWS SDK. See the CreateGatewayTarget docs for the OAuthCredentialProvider with grantType: AUTHORIZATION_CODE and defaultReturnUrl. 3LO applies to MCP, Lambda, OpenAPI, and Smithy targets. Call this out up front — developers who need 3LO will otherwise burn a round-trip trying CLI flags that don't exist.

IAM (SigV4) for MCP servers is configured via the AWS SDK/API (CreateGatewayTarget with GATEWAY_IAM_ROLE credential provider + iamCredentialProvider.service), not the CLI. It requires the MCP server to be hosted behind an AWS service that natively verifies SigV4: AgentCore Runtime, AgentCore Gateway, Amazon API Gateway, or Lambda Function URLs. ALB or direct EC2 endpoints do not verify SigV4 — use OAuth there instead. (MCP server target auth strategies)

API key auth for MCP server targets is not supported at the API level — not just a CLI gap. The MCP server targets docs list only "No authorization, OAuth, and IAM" as supported authorization strategies for MCP targets. If the MCP server uses an API key (a common pattern for third-party MCP providers), handle it in agent code via Path D.

Auth options change. If the matrix above doesn't match what the CLI accepts, check the current CLI help (agentcore add gateway-target --help) and the AWS docs — auth support per target type evolves across releases. If the awsknowledge MCP server is available, search for "AgentCore CreateGatewayTarget" to get the current API parameters.

CLI vs. API for gateway auth: The CLI covers none, oauth (2LO), and api-key. For IAM (SigV4) and 3-legged OAuth, use boto3 directly — the examples are in the Path A section below. The general pattern: create the gateway and target via CLI, deploy, then apply the advanced auth config via boto3 if the CLI doesn't support it.

Tell the developer which auth option applies to their target type before generating any commands.

When your gateway has many tools, let the model search for them

Once a gateway has more than a handful of tools — roughly 20+ — passing every tool definition to the model on every turn wastes tokens and degrades accuracy. The model does better when it sees only the tools relevant to the current request.

AgentCore Gateway has a built-in semantic search tool for exactly this. Your agent calls a single MCP tool named x_amz_bedrock_agentcore_search with a natural-language query, and the gateway returns the most relevant tools from its catalog. The agent then invokes the returned tools normally.

If a developer is considering building their own tool-selection layer with Bedrock Knowledge Bases, a vector store, or custom embeddings — stop them. The gateway already does this, evaluated against curated relevance criteria, with no infrastructure to manage.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2,206
Repository forks
214
7-day trend score
38

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/aws/agent-toolkit-for-aws/agents-connect/badge)](https://verified-skill.com/skills/aws/agent-toolkit-for-aws/agents-connect)

Something wrong with this skill or its page? Tell us.