Sla direct naar inhoud
Implementation

Clay API and CLI for Claude Code: Build from Your Terminal

By Mike van BeaumondAI Engineer · company brain & automationpublished on

7 min read
Clay API and CLI for Claude Code: Build from Your Terminal
Quick Take: The Clay Agent Plugin gives Claude Code, Cursor, and Codex direct access to Clay data, Functions, and Workflows via a CLI and MCP server. Install in Claude Code with two commands, authenticate with a Clay API key. No more tab-switching.

Spoiler: If you use Clay for lead generation or data enrichment, until today, you probably opened the UI every five seconds to check, adjust, or trigger something. Clay has just launched an Agent Plugin for Claude Code, Cursor, and and Codex. That era is over.

You can now search Clay data, run Functions, and manage Workflows directly from your terminal or AI coding environment. No manual intervention at each step. Clay becomes a tool your agent calls, not a UI you operate yourself.

Direct answer: Install the plugin in Claude Code via /plugin marketplace add clay-run/agent-plugins and /plugin install clay@clay-plugins. Create a Clay API key under Settings, Account. Run the setup skill. Done. From that moment on, Claude Code can search Clay data, run Functions, and trigger Workflows without touching the Clay UI.

What exactly is the Clay Agent Plugin?

Clay launched two things simultaneously: a CLI (command-line interface) that allows you to control Clay from your terminal, and an Agent Plugin that makes that CLI available as a tool in Claude Code, Cursor, and Codex.

The plugin lives in an open GitHub repository (github.com/clay-run/agent-plugins) and comes with a .claude-plugin, a .cursor-plugin, and an .agents folder for Codex. The installation steps vary slightly per agent environment, but the result is the same: Clay as a callable tool in your AI workflow.

Quick Take: The plugin works via a combination of a CLI binary and an MCP server. Claude Code automatically gets the clay-CLI on its PATH. Cursor and Codex require an additional setup step, which is also automated via an included setup skill.

In my experience, this is one of the most direct connections between a data layer (Clay) and an AI coding environment to date. Clay is already strong in retrieving and enriching lead data. Now, Claude Code genuinely uses that data in automation workflows, without human intervention.

How to install the Clay Agent Plugin in Claude Code?

Step 1: Add plugin from the marketplace

Open Claude Code and execute these two commands:

code
/plugin marketplace add clay-run/agent-plugins
/plugin install clay@clay-plugins

Step 2: Create Clay API key

In Clay, go to Settings, then Account. Create a new API key. The workspace is automatically determined from the key; you don't need to set a separate workspace ID.

Step 3: Run setup skill

Ask Claude Code to run the included setup skill. This will save your API key and verify the connection:

Run the Clay setup skill and connect to my API key: [YOUR KEY]

Claude Code automatically installs the clay-CLI on the agent's PATH. You can verify if everything is working:

clay whoami

An exit code 0 with your username and workspace means the connection is working. An exit code 3 means the key is missing or invalid.

And how do you install it in Cursor?

For Cursor teams with a Team or Enterprise subscription: go to Settings, click Plugins, then Add Marketplace, then Import from Repo, and enter the repository URL.

For local installation, clone the repository and copy the clay folder to your Cursor plugin folder:

code
git clone https://github.com/clay-run/agent-plugins.git
cp -R agent-plugins/clay ~/.cursor/plugins/local/clay

Then set your API key as an environment variable:

code
export CLAY_API_KEY="your-api-key"

What can you do with Clay from Claude Code?

Search Clay data

Ask Claude Code to find companies or contacts in Clay based on filters. That data comes directly back into the agent context, ready for processing in the next step of your workflow.

Run Functions

Clay Functions are the operations you've built in Clay for data enrichment, scoring, or transformations. You now trigger them from Claude Code and process the output directly, without returning to the Clay UI.

Create and trigger Workflows

Build new Clay workflows, edit existing ones, and trigger them programmatically. Clay thus becomes usable as a step in a larger automation chain, controlled by Claude Code.

Quick Take: The combination of Clay as a data layer and Claude Code as an orchestration layer is powerful for RevOps teams who want to automate their lead pipeline. Clay retrieves and enriches the data, Claude Code decides what happens next.

Which use cases work for SMEs and scale-ups?

Automatic lead enrichment in your CI/CD pipeline

Trigger a new prospect import after each production deploy, so your sales team always works with enriched, up-to-date data. With the Clay CLI as a step in your pipeline, this is possible without manual intervention.

Trigger workflow based on GitHub events

Combine Clay with GitHub Actions. Every time a customer creates an issue, a Clay workflow is triggered that enriches the customer with recent company information and sends it to your CRM. All via code, nothing manual.

Monitor data quality from Claude Code

Let Claude Code periodically retrieve Clay data, check quality for missing fields or outdated information, and automatically trigger an enrichment function for records that don't meet standards. A data quality workflow without a separate tool.

RevOps without a dedicated developer

For SME teams without a RevOps engineer: with Claude Code as the orchestration layer and Clay as the data layer, you can build workflows that previously required a full-time developer. In my experience at vanbeaumond.nl this is precisely the gap most teams are trying to close.

What can't the Clay Agent Plugin do YET?

Let's be honest: the plugin has just launched and is in open beta. That means rough edges.

No automatic PATH in Cursor and Codex

Cursor and Codex do not automatically add the clay-CLI to the agent's PATH. The setup skill automates this, but a manual route requires an extra step. Documented in the README, not zero-friction.

No OAuth flow

The plugin requires a Clay API key that you create and manage yourself. There is no OAuth like with some other MCP integrations. Keep the key safe; never store it in public repositories.

As good as your Clay setup

The functionality is only as powerful as your Clay setup. If your Workflows and Functions in Clay are not thoughtfully structured, you won't get good output via the CLI either. The plugin is a bridge, not a replacement for good Clay architecture.

My take: Clay moves from UI to API-first

Bottom line: the launch of the Clay Agent Plugin is a signal about the direction Clay is moving in. From a visual lead gen platform to a data layer that you programmatically control from your own workflows and AI agents. That's a bigger step than the feature itself suggests.

For RevOps teams already using Claude Code, or wanting to learn it, this is a concrete reason to bring those two worlds together. Clay provides the data. Claude Code provides the logic. Together they build workflows that were not possible separately.

Pro tip: start small. Trigger one existing Clay workflow from Claude Code and examine the output. If that works, build from there. Don't try to set up an entire automation pipeline all at once.


Want to know where AI pays off most for your team? Read about a company brain.

Want to discuss Claude Code and Clay in your RevOps workflow?

Schedule a no-obligation meeting: https://calendly.com/mike-vanbeaumond/ai-business-meeting-30-min

Learn to use Claude Code professionally for your team:

Schedule a call

Sound familiar? Let's talk.

In 30 minutes we look together at which team your brain starts with. No obligation.

Frequently asked questions

For Cursor teams with a Team or Enterprise subscription: go to Settings, click Plugins, then Add Marketplace, then Import from Repo, and enter the repository URL.

Yes. The API key you need is available in all Clay plans. Which functions you can call via the CLI depends on your Clay subscription, just like in the UI.

Yes. Claude Code calls multiple MCP servers and plugins simultaneously. You can combine Clay with Firecrawl (web scraping), a cloud database, or GitHub (code), and Claude Code orchestrates the collaboration. Setting up connectors is covered in [how to set up Claude connectors](/en/blog/how-to-set-up

Yes. The repository is on github.com/clay-run/agent-plugins and is public. You can view, fork, and adapt the plugin for your own use case.

No, not officially. The plugin is explicitly available for Claude Code, Cursor, and Codex. For VS Code with Copilot, there is no official plugin format, but the `clay`-CLI does work as a standalone tool in a terminal workflow alongside your editor.

Little if you already have Claude Code and Clay. The plugin itself is free and open source. You only pay for your existing Clay subscription and the use of Claude Code. The setup itself takes less than ten minutes.