Skip to main content

Clay

Give agents tools to find and research people and companies and run workflows in Clay through Mastra Connect. Clay serves these tools from a hosted Model Context Protocol (MCP) server. Your application never stores Clay credentials.

Connect
Direct link to Connect

Before you start, complete the Connect setup to install @mastra/connect and configure your platform project.

Connect an account
Direct link to Connect an account

Run this command from the directory that contains your .env file:

mastra connect add clay-mcp

The CLI guides you through Clay's authorization and waits until the connection is active.

Add tools to an agent
Direct link to Add tools to an agent

Pass tools() to the agent and select the clay-mcp provider:

src/mastra/agents/clay-mcp-agent.ts
import { Agent } from '@mastra/core/agent'
import { tools } from '@mastra/connect'

export const clayMcpAgent = new Agent({
id: 'clay-mcp-agent',
name: 'Clay agent',
instructions: 'You help people find and research people and companies and run workflows in Clay.',
model: 'openai/gpt-6-luna',
tools: tools({ providers: ['clay-mcp'] }),
})

Mastra discovers Clay's tools from its MCP server when the agent runs. The available tools depend on the server and the connected account, not on your @mastra/connect version. Tool keys start with clay-mcp_.

To see which tools Clay provides, read the MCP in Clay documentation. To require approval before a call runs, see MCP providers in the tools() reference.

On this page