View a markdown version of this page

Coinbase Bazaar über Gateway AgentCore - Amazon Grundgestein AgentCore

Coinbase Bazaar über Gateway AgentCore

AgentCore Mit Gateway können Sie eine Verbindung zu kostenpflichtigen MCP-Servern und API-Endpunkten herstellen. Sie können den Coinbase x402 Bazaar MCP-Server als Ziel in einem Gateway hinzufügen, um mehr als 10.000 bestehende kostenpflichtige MCP-Tools zu entdecken, die x402-Mikrotransaktionen unterstützen.

  • Server-URL — https://api.cdp.coinbase.com/platform/v2/x402/discovery/mcp

  • Ausgehende Authentifizierungstypen werden akzeptiert — Keine Autorisierung (Standard)

Fügen Sie den Coinbase x402 Bazaar MCP-Server zu einem Gateway hinzu

Beispiel
Console
  1. Navigieren Sie zum Abschnitt Target.

  2. (Optional) Ändern Sie den generierten Zielnamen.

  3. (Optional) Geben Sie eine Target-Beschreibung ein.

  4. Wählen Sie als Zieltyp die Option Integrationen aus.

  5. Wählen Sie Coinbase x402 Bazaar aus.

  6. Überspringen Sie die Konfigurationen für die ausgehende Authentifizierung. „Keine Autorisierung“ ist die einzige unterstützte Option und ist standardmäßig ausgewählt.

AgentCore CLI
agentcore add gateway-target \ --name CoinbaseTarget \ --type mcp-server \ --endpoint https://api.cdp.coinbase.com/platform/v2/x402/discovery/mcp \ --gateway MyGateway agentcore deploy
AWS SDK
import boto3 agentcore_client = boto3.client('bedrock-agentcore-control') target = agentcore_client.create_gateway_target( gatewayIdentifier="your-gateway-id", name="Coinbasex402BazaarTarget", description="Coinbase x402 Bazaar MCP server for paid API discovery", targetConfiguration={ "mcp": { "mcpServer": { "endpoint": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/mcp" } } } )
Strands SDK

Verwenden Sie das Coinbase x402 Bazaar Gateway Target mit Ihrem Agenten:

from strands import Agent from strands.models import BedrockModel from strands.tools.mcp.mcp_client import MCPClient from mcp.client.streamable_http import streamablehttp_client from bedrock_agentcore.payments.integrations.config import AgentCorePaymentsPluginConfig from bedrock_agentcore.payments.integrations.strands.plugin import AgentCorePaymentsPlugin GATEWAY_URL = "https://<your-gateway-id>.gateway.bedrock-agentcore.<region>.amazonaws.com/mcp" ACCESS_TOKEN = "<your-inbound-auth-token>" mcp_client = MCPClient( lambda: streamablehttp_client(GATEWAY_URL, headers={"Authorization": f"Bearer {ACCESS_TOKEN}"}) ) # Configure the Payment plugin config = AgentCorePaymentsPluginConfig( payment_manager_arn="arn:aws:bedrock-agentcore:us-west-2:123456789012:payment-manager/pm-abc123", user_id="test-user-123", payment_instrument_id="payment-instrument-XJU4RSQP9VO0ler", payment_session_id="payment-session-xuzrnUCd7RT725G", region="us-west-2", ) # Create the plugin plugin = AgentCorePaymentsPlugin(config=config) with mcp_client: tools = mcp_client.list_tools_sync() agent = Agent( model=BedrockModel(inference_profile_id="us.anthropic.claude-sonnet-4-20250514-v1:0", streaming=True), tools=tools, plugins=[plugin], # enables automatic payments ) response = agent("Search for available x402 paid APIs related to weather data") print(response)
LangGraph

Verwenden Sie das Coinbase x402 Bazaar Gateway Target mit Ihrem Agenten: LangGraph

import asyncio from langchain.agents import create_agent from langchain_openai import ChatOpenAI from langchain_mcp_adapters.client import MultiServerMCPClient from bedrock_agentcore.payments.integrations.langgraph import ( AgentCorePaymentsConfig, AgentCorePaymentsMiddleware, ) GATEWAY_URL = "https://<your-gateway-id>.gateway.bedrock-agentcore.<region>.amazonaws.com/mcp" ACCESS_TOKEN = "<your-inbound-auth-token>" async def main(): client = MultiServerMCPClient({ "bazaar": { "transport": "streamable_http", "url": GATEWAY_URL, "headers": {"Authorization": f"Bearer {ACCESS_TOKEN}"}, } }) mcp_tools = await client.get_tools() config = AgentCorePaymentsConfig( payment_manager_arn="arn:aws:bedrock-agentcore:us-west-2:123456789012:payment-manager/pm-abc123", user_id="test-user-123", payment_instrument_id="payment-instrument-XJU4RSQP9VO0ler", region="us-west-2", auto_session=True, ) payments = AgentCorePaymentsMiddleware(config) agent = create_agent( model=ChatOpenAI(model="gpt-4o-mini"), tools=mcp_tools, middleware=[payments], ) result = await agent.ainvoke( {"messages": [{"role": "user", "content": "Search for available x402 paid APIs related to weather data"}]} ) print(result["messages"][-1].content) asyncio.run(main())

Sobald das Bazaar-Ziel konfiguriert ist, können Ihre Agenten kostenpflichtige x402-Endpunkte über das Gateway erkennen und anrufen. Wenn ein Endpunkt HTTP 402 zurückgibt, wickelt AgentCore Payments den Zahlungsfluss automatisch ab, sofern Sie in Ihrem Agenten ein Zahlungs-Plugin (Strands) oder eine Middleware () konfiguriert haben. LangGraph Weitere Informationen finden Sie unter Framework-Integrationen.

Informationen zur Einrichtung des für die Zahlungsabwicklung erforderlichen Zahlungsmanagers und Konnektors finden Sie unter Zahlungsmanager und Konnektor erstellen.