Skip to main content

Overview

Cloudflare Agents provides a platform for building AI-powered chat agents that run on Cloudflare’s edge network. By combining Cloudflare Agents with ATXP’s pay-per-use MCP tools, you can create AI applications that can generate images, search the web, crawl sites, and more - all with usage-based pricing and seamless deployment. This guide will show you how to integrate ATXP’s MCP tools with Cloudflare Agents to build a chat agent with image generation capabilities. You can find a full working example at atxp-cloudflare-agent-example.

Setup

1

Create ATXP account

If you don’t have an ATXP account yet, create one and copy your ATXP connection string. It should look something like this:

If you’ve already created an ATXP account, you can visit the ATXP account dashboard to get your connection string.
2

Create your project

Create a new Cloudflare Agent project:
3

Install ATXP client

Add the ATXP client to your project:
The @atxp/client package provides the MCP transport that allows you to use ATXP’s MCP tools in your Cloudflare Agent.
4

Configure environment

Create a .dev.vars file in your project root:
Never commit your .dev.vars file to version control. Make sure it’s included in your .gitignore file.

Basic integration

Here’s how to add ATXP image generation to your Cloudflare Agent:

Deploy your agent

1

Set production secrets

Configure your production environment variables:
2

Deploy to Cloudflare

Deploy your agent:
Your agent will be available at your Cloudflare Workers subdomain.

Test your agent

Once deployed, you can test your agent by asking it to generate images:

Next steps

Now that you have a working Cloudflare Agent with ATXP integration, you can explore more:

MCP server documentation

Learn about other ATXP tools like web search and file storage.

Build a CLI agent

Try building a CLI agent.