Stripe MCP agent
Connect an Agno agent to Stripe's hosted MCP server.
Connect to Stripe's hosted MCP server using a restricted API key as a bearer token. This example reads customers from a Stripe sandbox. Create a sandbox restricted key with the permissions needed for the request.
Prerequisites
Create and activate a Python virtual environment, then configure the same terminal:
uv pip install -U "agno[mcp,openai]"
export STRIPE_API_KEY="your_sandbox_restricted_key"
export OPENAI_API_KEY="your_openai_api_key"Code
import asyncio
import os
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.mcp import MCPTools
async def main():
async with MCPTools(
url="https://mcp.stripe.com",
transport="streamable-http",
headers={"Authorization": f"Bearer {os.environ['STRIPE_API_KEY']}"},
) as stripe:
agent = Agent(
name="Stripe Agent",
model=OpenAIResponses(id="gpt-5.4-mini"),
tools=[stripe],
instructions=[
"Use Stripe tools to answer the user's request.",
"For this example, only read data; do not create or modify objects.",
],
markdown=True,
)
await agent.aprint_response("List up to five customers in this sandbox.", stream=True)
if __name__ == "__main__":
asyncio.run(main())Save the code as stripe_agent.py, then run:
python stripe_agent.pyThe restricted key controls account permissions; an instruction in the agent prompt does not enforce those permissions. To extend the example to create products, prices, or payment links, grant the corresponding sandbox permissions and provide an explicit write request. See Stripe MCP for its current tools and authentication options.