# Segment — how to use (mcp.ai)

Connect your Segment account and use 17 tools for analytics straight from your AI agent. Connect with your own API key. Twilio Segment is a customer data platform that helps businesses collect, clean, and control their customer data.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_segment?ms=1787291460000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `segment_add_labels_to_source`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/segment`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/segment/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/segment/add/labels/to/source` — Tool to add existing labels to a Source. Use when you have the source ID and want to tag it with metadata labels.
  - body: { labels: object[], sourceId: string }
- `POST https://api.mcp.ai/api/segment/alias` — Tool to alias a previous user ID to a new user ID. Use when merging anonymous and known identities.
  - body: { userId?: string, context?: object, timestamp?: string, previousId: string, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/batch` — Tool to send multiple analytics calls in a single batch request. Use when you want to reduce HTTP overhead by batching Identify/Track/Page/Screen/Group calls into one request.
  - body: { batch: object[], context?: object, writeKey?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/delete/source` — Tool to delete a Segment Source. Use when you need to permanently remove a Source by its ID after confirmation.
  - body: { sourceId: string }
- `POST https://api.mcp.ai/api/segment/get/daily/per/source/api/calls/usage` — Tool to fetch daily API call counts per source for a given period. Use when you need daily breakdown of API usage by source after determining the reporting period.
  - body: { period: string, pagination?: object }
- `POST https://api.mcp.ai/api/segment/get/destination` — Tool to retrieve a Destination by ID. Use when you need to fetch the full configuration of a Segment Destination instance by its unique identifier. Falls back US→EU public API and legacy app endpoint;
  - body: { destinationId: string }
- `POST https://api.mcp.ai/api/segment/group` — Tool to associate an identified user with a group via Segment HTTP Tracking API. Use when grouping users with traits.
  - body: { traits?: object, userId?: string, context?: object, groupId: string, writeKey?: string, timestamp?: string, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/identify` — Tool to identify a user and set/update traits via Segment HTTP Tracking API.
  - body: { traits?: object, userId?: string, context?: object, writeKey?: string, messageId?: string, timestamp?: string, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/import/historical/data` — Tool to import historical data in bulk with support for historical timestamps. Use when you need to backfill or import past events with their original timestamps into Segment.
  - body: { batch: object[], context?: object, integrations?: object }
- `POST https://api.mcp.ai/api/segment/list/connected/warehouses/from/source` — Tool to list warehouses connected to a Source. Use when you need to retrieve warehouses for a given source ID.
  - body: { sourceId: string, pagination: object }
- `POST https://api.mcp.ai/api/segment/list/delivery/metrics/summary/from/destination` — Get an event delivery metrics summary from a Destination. Primary attempt uses Segment Public API; fallback to legacy app host if needed. On HTML fallback responses, returns a minimal valid envelope t
  - body: { endTime?: string, sourceId: string, startTime?: string, granularity?: string, destinationId: string }
- `POST https://api.mcp.ai/api/segment/list/schema/settings/in/source` — Retrieve schema configuration settings for a Source.
  - body: { sourceId: string }
- `POST https://api.mcp.ai/api/segment/page` — Tool to record a page view via Segment HTTP Tracking API. Use when sending page views with optional page name and properties.
  - body: { name?: string, userId?: string, context?: object, writeKey?: string, messageId?: string, timestamp?: string, properties?: object, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/remove/source/write/key` — Tool to remove a write key from a Source. Use when you need to revoke an existing write key for security or rotation.
  - body: { sourceId: string, writeKey: string }
- `POST https://api.mcp.ai/api/segment/screen` — Tool to record a mobile app screen view. Use when tracking screen views in a mobile app via Segment HTTP Tracking API.
  - body: { name?: string, userId?: string, context?: object, writeKey?: string, timestamp?: string, properties?: object, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/track` — Tool to record a custom user event via Segment HTTP Tracking API. Use when sending events to Segment with valid identity.
  - body: { event: string, userId?: string, context?: object, writeKey?: string, timestamp?: string, properties?: object, anonymousId?: string, integrations?: object }
- `POST https://api.mcp.ai/api/segment/update/source` — Tool to update a Source's metadata and settings. Use when you need to modify an existing Source after confirming its ID.
  - body: { name?: string, slug?: string, enabled?: boolean, settings?: object, sourceId: string }

## Example prompts
- "What can I do in Segment?"
- "Show me a summary of my Segment account"

## More
- Page: https://mcp.ai/segment
- Agent spec (llms.txt): https://mcp.ai/segment/llms.txt
- Postman collection: https://mcp.ai/segment/postman.json
