analytics
Segment MCP, CLI, and Lua Integration for AI Agents
Segment integration docs for AI agents: MCP gateway setup, Segment CLI commands, Lua API reference, credentials, and function schemas.
8 functions 4 read 4 write API token auth
Segment for agents
Credentials can be configured manually in web or CLI hosts.
Use this integration from Lua code mode, the headless integrations CLI, or the KosmoKrator MCP gateway. The same package metadata powers all three surfaces.
Machine-Readable Metadata
- integration_slug
segment- route_slug
segment- package
segment- auth_strategy
api_tokenAPI token- cli_setup_supported
true- cli_runtime_supported
true- mcp_gateway_supported
true- lua_supported
true- supports_multi_account
true
Quick Links
Lua APIAgent-facing namespace and function reference. Segment CLIHeadless setup and direct function calls. Segment MCPMCP gateway setup for external clients. Submit feedbackReport missing tools, auth problems, wrong docs, or runtime issues. ContributeAdd tools or improve metadata in the integrations repo.
Segment MCP Client Matrix
Use these pages when a specific agent client or framework needs copy-pasteable MCP setup for Segment.
Claude Code Segment MCP setup for Claude Code. Cursor Segment MCP setup for Cursor. Codex Segment MCP setup for Codex. OpenAI Agents Segment MCP setup for OpenAI Agents SDK. Claude Agent SDK Segment MCP setup for Claude Agent SDK. Vercel AI SDK Segment MCP setup for Vercel AI SDK. LangChain Segment MCP setup for LangChain. LangGraph Segment MCP setup for LangGraph. CrewAI Segment MCP setup for CrewAI. MCP clients Segment MCP setup for Generic MCP Clients.
Segment CLI Matrix
Use these pages for direct Segment CLI workflows in scripts, CI, cron, and agent wrappers.
CI Segment CLI for CI. Cron Jobs Segment CLI for cron jobs. Shell Scripts Segment CLI for shell scripts. Headless Automation Segment CLI for headless automation. Coding Agents Segment CLI for coding agents.
Function Catalog
| Function | Type | Parameters | Description |
|---|---|---|---|
segment.segment_identify | Write write | 2 | Identify a user in Segment with their traits. Links metadata about a user (name, email, plan, etc.) to a known userId so all their events can be attributed correctly. |
segment.segment_track | Write write | 3 | Track a custom event for a user in Segment. Records actions your users perform along with optional properties describing the action. |
segment.segment_page | Write write | 3 | Record a page view in Segment. Tracks when a user views a page, along with optional properties about the page. |
segment.segment_group | Write write | 3 | Associate a user with a group (organization, company, account) in Segment. Lets you record group membership along with optional group traits. |
segment.segment_get_workspace | Read read | 1 | Get details of a Segment workspace by its slug. Requires an API token to be configured. |
segment.segment_list_sources | Read read | 1 | List all sources in a Segment workspace. Requires an API token to be configured. |
segment.segment_get_source | Read read | 2 | Get details of a specific Segment source by ID. Requires an API token to be configured. |
segment.segment_get_current_user | Read read | 0 | Get the currently authenticated Segment user. Useful for verifying API token credentials are correct. |