Segment MCP server for AI agents

Live

BEARER TOKEN

CUSTOMER DATA

Analytics

Segment gives your agent customer data operations in each user's Segment workspace: manage sources, destinations, and warehouses, build Engage audiences and computed traits, maintain tracking plans, and check delivery and usage.

  • Per-user credentials: each call uses the actual user's access token, never a shared bot.
  • Encrypted per-tenant vault: AES-256, resolved at request time, never in LLM context.
  • Scoped before every call: pre-call scope check, 90-day SIEM-exportable audit chain.
Segment
agent · Acme Q3
Run
Did any events from the iOS source fail to deliver yesterday?
S
segment_delivery_overview_failed_delivery_get
152ms
Data ops agent
212 events from the iOS source failed to deliver yesterday. Most of them failed in a 20 minute window after 14:00 UTC.
Sources: Segment Delivery Overview, 1 source
segment
212 events
18:29
Message Claude...

Tools your data ops agent reaches for on Segment, scoped per user.

CALL ANY TOOL
104 tools for customer data in Segment: manage sources, destinations, and warehouses, build audiences and computed traits, edit tracking plans and transformations, and check delivery, usage, and audit events.
segment_audience_create
Create audience
Create an Audience in an Engage Space from a query-language definition. Returns the created Audience with its id. Use segment_audience_create for a new Audience. Use segment_audience_update to change one. Requires Engage with the Audiences feature; get space_id from segment_spaces_list. Rate limit: 50 requests per minute.
Parameters
Name
Type
Required
Description
audience_type
string
Required
Kind of Audience: USERS (profiles), ACCOUNTS (B2B accounts) or LINKED (Linked Audiences built on warehouse entities). Example: USERS. One of: `USERS`, `ACCOUNTS`, `LINKED`.
name
string
Required
Name of the Audience. Example: Recent purchasers.
query
string
Required
Segment query-language (CQL) definition of who is in the Audience, for example event('Order Completed').count() >= 1. Example: event('Order Completed').count() >= 1.
space_id
string
Required
ID of the Engage (Unify) Space. Get it from segment_spaces_list. Example: spa_9aQ1Lj62S4bomZKLF4DPqW.
backfill_event_data_days
integer
Optional
Number of days of event data before creation to include when computing membership. Example: 30.
description
string
Optional
Description of the Audience. Example: Profiles with at least one order.
enabled
boolean
Optional
Whether Segment computes the Audience after creation. Example: true.
filter_by_external_ids
array
Optional
Only consider profiles that have at least one of these external identifier types, for example ["email", "user_id"]. Example: ["email", "user_id"].
include_historical_data
boolean
Optional
Whether events from before the Audience was created count towards membership. Example: true.
target_entity
string
Optional
LINKED audiences only: target entity relationship slug. Use profile to target profiles. Example: profile.
segment_audience_delete
Delete audience
segment_audience_get
Get audience
segment_audience_update
Update audience
segment_audiences_list
List audiences
segment_catalog_sources_list
List catalog sources
segment_computed_trait_get
Get computed trait
segment_delivery_overview_filtered_at_source_get
Get delivery overview filtered at source
segment_destination_filter_create
Create destination filter
segment_destination_filter_delete
Delete destination filter
segment_destination_filter_get
Get destination filter
segment_destination_filter_preview
Preview destination filter
segment_destination_subscriptions_list
List destination subscriptions
segment_destination_update
Update destination
segment_function_get
Get function
segment_labels_list
List labels
segment_reverse_etl_model_create
Create reverse etl model
segment_reverse_etl_sync_cancel
Cancel reverse etl sync
segment_reverse_etl_sync_trigger
Trigger reverse etl sync
segment_source_connected_destinations_list
List source connected destinations
segment_source_delete
Delete source
segment_source_get
Get source
segment_source_labels_add
Add source labels
segment_sources_list
List sources
segment_tracking_plan_rules_remove
Remove tracking plan rules
segment_tracking_plan_rules_update
Update tracking plan rules
segment_tracking_plan_sources_list
List tracking plan sources
segment_transformation_get
Get transformation
segment_usage_mtu_daily_get
Get usage mtu daily
segment_warehouse_connected_sources_list
List warehouse connected sources

For more tools, view docs.

Build your Agent
Same auth pattern across LangChain, OpenAI, Anthropic, and Google ADK.
Python · LlamaIndex
import { ScalekitClient } from "@scalekit-sdk/node";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

// Segment tools scoped to this user
const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["segment"], toolNames: [
    "segment_sources_list",
    "segment_delivery_overview_failed_delivery_get",
    "segment_destination_update"] },
  pageSize: 100,
});

const agent = createReactAgent({ llm, tools });
await agent.invoke({ messages: [{ role: "user", content: "Find failed deliveries from the iOS source yesterday" }] });
import OpenAI from "openai";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const openai = new OpenAI();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["segment"] }, pageSize: 100,
});

const res = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "Find failed deliveries from the iOS source yesterday" }],
  tools,
});

// Execute the tool call with the user's vaulted Segment access token
await sk.tools.executeTool(res.choices[0].message.tool_calls[0], "user_123");
import Anthropic from "@anthropic-ai/sdk";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const anthropic = new Anthropic();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["segment"] }, pageSize: 100,
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Find failed deliveries from the iOS source yesterday" }],
  tools,
});

// Tool call runs with the user's vaulted Segment access token
await sk.tools.executeTool(msg.content, "user_123");
import { Agent } from "@google/adk/agents";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["segment"] }, pageSize: 100,
});

const agent = new Agent({
  name: "data_ops_agent",
  model: "gemini-2.5-pro",
  instruction: "Segment tools scoped to this user",
  tools,
});

await agent.run("Find failed deliveries from the iOS source yesterday");
Try these prompts
Copy any prompt into your agent. Each maps directly to a Segment tool. Click to copy, paste into your agent, done.
Pipelines
Copy the prompt
Copied
List the destinations connected to the web app source.
Copy the prompt
Copied
Turn off the Legacy Webhooks destination.
Copy the prompt
Copied
Show recent sync runs for our warehouse.
Audiences and traits
Copy the prompt
Copied
List the audiences in our Engage space.
Copy the prompt
Copied
Create a computed trait that counts orders in the last 30 days.
Copy the prompt
Copied
Start a manual sync for the Churn Risk Reverse ETL mapping.
Governance and usage
Copy the prompt
Copied
Add an Order Completed rule to the Web tracking plan.
Copy the prompt
Copied
Show event volume for the workspace over the last 7 days.
Copy the prompt
Copied
List Audit Trail events from the last 24 hours.
SEE HOW AUTH WORKS
Each user connects their own Segment access token once, and Scalekit sends it with every call. Tokens stay vaulted, every call is scope checked, and every action is logged.
1
Authorize
Your user connects
Segment
once. We tie it to their identity and the meetings they approved — no shared bot account, no org-wide access
Who:
user ‘A’
when:
Once per user
access:
Limited to user
2
Store
Their
Segment
token lives in a vault scoped to them. User A's meetings are never reachable by an agent acting for user B, even on the same connection
vault:
encrypted
scope:
per-user
tokens:
auto-refreshed
3
Resolve
When your agent calls a
Segment
tool, we fetch the right token server-side. It never touches your agent, never appears in the LLM context, never shows up in your logs
speed:
~40ms
check:
before every call
seen by:
nobody
4
Audit
Every
Segment
tool call is logged — who triggered it, which meeting was fetched, what came back. 90 days of history, tied to the user who authorized it
history:
90 days
export:
SIEM-ready
logged:
every call
Test other agents
See the same per-user auth pattern across other analytics and marketing connectors.
GTM and RevOps Teams
CRM AI agent
Reads the Granola transcript after every call, extracts next steps and updates the HubSpot record, drafts the follow-up in Gmail, and confirms in Slack, all on the rep's own delegated OAuth.
GTM and RevOps Teams
Competitive intelligence briefing agent
Scans Gong calls for competitor mentions, matches each one to its Notion battlecard, and DMs every affected rep a single Slack digest per cycle. Every call runs as the PMM who owns the briefing, never a shared bot.
Test other agents
See the same per-user auth pattern across other analytics and marketing connectors.
GTM
CRM AI agent
Turn each Granola call transcript into a HubSpot record update, a drafted Gmail follow-up, and a Slack recap.
GTM
Competitive intelligence briefing agent
Scan Gong calls for competitor mentions, match each one to its Notion battlecard, and DM every affected rep a single Slack digest.
Why Scalekit
Secure your agent's access. Connectors ship in minutes
01.
Shared tokens break per-user analytics
A shared Segment access token looks fine in a demo. In production every source, destination, and audience change looks like one service account, and you cannot tell which user triggered it. Scalekit resolves the credential of the actual user who triggered the agent, never a shared bot.
// shared token
audit → bot_service_account

// scalekit
audit → user_abc ✓
02.
Authentication is not authorization
03.
Multi-tenancy is architectural
04.
Segment today. Ten connectors tomorrow.
“Our agents act across Salesforce, Gong, Google Drive, and more, on behalf of every customer. Scalekit behind the scenes meant we can keep adding tools without ever rebuilding how credentials or tool calling work.”
Venu Madhav Kattagoni
Head of Engineering / Von
FAQs
Frequently Asked Questions
Does the agent access Segment as the user or through a shared token?
As the user. Each user connects their own Segment access token once, and Scalekit sends it with every call. Audit logs attribute every source, destination, and audience change to that user, not a shared service account.
Where is the Segment access token stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. To rotate it, the user reconnects with a new access token. Revocation is a single dashboard action. Credentials never appear in prompts, logs, or LLM context.
Can I limit what the agent does in Segment?
Yes. Filter by tool name in listScopedTools to expose only what you want, for example delivery and usage read tools without segment_source_delete or segment_warehouse_delete, which delete permanently. Scalekit also enforces scope checks before every API call.
What happens when a user revokes Segment access?
The connection is invalidated on the next tool call. Subsequent requests for that user fail closed with a clear error. Other users in the tenant remain unaffected. The event is logged for audit.
Which Segment workspace does the agent act on?
The workspace the user's Segment Public API token belongs to. segment_workspace_get returns its id, name, slug, and region, and every source, destination, audience, and tracking plan tool works inside that workspace.
Start in your coding agent
Up and running in one command
Install the Scalekit skill in your editor of choice. Connector, auth, tools, prompt, all wired up
Claude Code REPL
/plugin marketplace add scalekit-inc/claude-code-authstack
/plugin install agentkit@scalekit-auth-stack
Cursor Code REPL
# ~/.cursor/mcp.json
{
""mcpServers"": {
""segment"": {
""url"": ""https://mcp.scalekit.com/segment"",
""headers"": { ""Authorization"": ""Bearer $SCALEKIT_TOKEN"" }
}
}
}
Codex Code REPL
# ~/.codex/config.toml
[mcp_servers.segment]
url = ""https://mcp.scalekit.com/segment""
auth_env = ""SCALEKIT_TOKEN""
Copilot Code REPL
# .vscode/mcp.json
{
""servers"": {
""segment"": {
""url"": ""https://mcp.scalekit.com/segment"",
""type"": ""http""
}
}
}