Connect Cowork (Claude Desktop 3P) to the AgentCore Gateway's MCP tools.
Cowork (3P mode, Bedrock inference)
↓ Streamable HTTP + Bearer JWT (via managedMcpServers)
AgentCore Gateway (CUSTOM_JWT authorizer)
↓ Lambda invoke
web-search, wikipedia, arxiv, finance, weather, google-maps, google-search, tavily
Authentication is handled by agentcore-token.sh (headersHelper), which reads
Cognito tokens from ~/.cowork-sidecar/tokens.json and auto-refreshes on expiry.
| Mode | What it does | Status |
|---|---|---|
| 1 — Connector only | managedMcpServers in configLibrary. 23 tools under Connectors. |
Working |
| 2 — Plugin only | org-plugin with .mcp.json + skills. No managedMcpServers. |
Not yet working (headersHelper not executed from plugin context) |
- Infrastructure deployed with
enable_cowork = true - A Cognito user account (same pool as the chat app)
managedMcpServers requires inferenceProvider to be set. Without it, MCP
servers from configLibrary are silently ignored.
- Download Claude Desktop: https://claude.com/download
- Get a Bedrock API key: AWS Console → Bedrock → API keys →
Create long-term API key. Note the key value and region (e.g.
us-west-2). IAM policy must includebedrock:CallWithBearerToken. - Enable Developer Mode: Claude Desktop → Help → Troubleshooting → Enable Developer Mode.
- Open 3P configuration: Menu bar → Developer → Configure third-party inference.
- Configure Bedrock (Connection tab):
- Inference provider:
bedrock - Region: your Bedrock region
- Bearer token: paste your Bedrock API key
- Inference provider:
- Click "Apply locally". The app restarts.
This writes inferenceProvider, inferenceBedrockRegion, and
inferenceBedrockBearerToken to ~/Library/Application Support/Claude-3p/configLibrary/<id>.json.
setup.sh later adds managedMcpServers to the same profile.
# 1. Deploy with Cowork enabled
cd infra/environments/dev
terraform apply -var enable_cowork=true
# 2. Run setup (reads Terraform outputs, opens browser for login, writes config)
cd cowork
./setup.sh # Select mode 1 (connector) or 2 (plugin)
# 3. Restart Cowork (Cmd+Q, reopen)| Token | Lifetime | Renewal |
|---|---|---|
| access_token | 8 hours | Auto-refreshed by agentcore-token.sh (headersHelper) on each connection |
| refresh_token | 30 days | Re-run ./setup.sh --force-login |
| File | Purpose |
|---|---|
setup.sh |
One-shot setup: Terraform output, Cognito login, config + plugin install |
agentcore-token.sh |
headersHelper script: token refresh + JSON header output |
config.env.example |
Template for ~/.cowork-sidecar/config.env |
skills/*.md |
Skill definitions for org-plugin (8 skills) |
~/.cowork-sidecar/
├── config.env # Cognito credentials (chmod 600)
└── tokens.json # access_token + refresh_token (chmod 600)
/usr/local/bin/
└── agentcore-token.sh # headersHelper (installed by setup.sh)
~/Library/Application Support/Claude-3p/
├── configLibrary/*.json # managedMcpServers (mode 1)
└── claude_desktop_config.json
/Library/Application Support/Claude/org-plugins/
└── agentcore-gateway/ # Plugin (mode 2)
~/Library/Logs/Claude-3p/main.log # App startup, plugin loading, MCP connection
View via Cowork Developer Settings > View Logs, or tail -f ~/Library/Logs/Claude-3p/main.log.
- org-plugin
.mcp.jsondoes not execute headersHelper. The script is never invoked; the app falls back to OAuth which fails. Absolute paths and${CLAUDE_PLUGIN_ROOT}both confirmed non-functional. This blocks plugin-only mode (mode 2). Mcp-Protocol-Versionheader must not be included in headersHelper output. Cowork sends it automatically; duplicating causes"Unsupported MCP protocol version: 2025-11-25, 2025-11-25".managedMcpServersrequiresinferenceProviderin configLibrary. Without a configured inference provider,managedMcpServersis silently ignored.toolPolicyonly works inmanagedMcpServers, not inmcpServersor.mcp.json. All tools show "Needs approval (set by admin)" inmcpServersentries.mcpServersstreamable-httptype is rejected by config validation. Onlycommand(stdio) type works inmcpServers.
| Symptom | Cause | Fix |
|---|---|---|
| No connector after restart | configLibrary missing managedMcpServers |
Run ./setup.sh (mode 1) |
| "Connection to server failed" | Mcp-Protocol-Version header duplicated |
Ensure agentcore-token.sh outputs only Authorization header |
| "Missing Bearer token" | headersHelper not executed (plugin mode) | Use mode 1 (connector) instead |
| Tools appear but calls fail | JWT expired mid-session | Restart Cowork (headersHelper re-fetches on startup) |
| Plugin not visible | Plugin cache stale | Run ./setup.sh (clears caches automatically) |
| "Server disconnected" | Token file missing or bridge script not found | Run ./setup.sh again |
| OAuth poisoning | Failed headersHelper cached OAuth state in keychain | Run ./setup.sh (clears OAuth caches) |
