analytics
Segment MCP Integration for OpenAI Agents SDK
Connect Segment to OpenAI Agents SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.
Connect Segment to OpenAI Agents SDK
Attach KosmoKrator integration tools to OpenAI Agents SDK workflows through a local MCP gateway.
Start the KosmoKrator MCP gateway locally and point the OpenAI Agents SDK MCP tool at that process or wrapper. The gateway is local, scoped to this integration, and starts with
--write=deny so OpenAI Agents can inspect read-capable tools without receiving write access by default.
Segment MCP Config for OpenAI Agents SDK
Use headless JSON commands for CI-style execution and MCP for agent tool discovery.
{
"mcpServers": {
"kosmokrator-segment": {
"type": "stdio",
"command": "kosmo",
"args": [
"mcp:serve",
"--integration=segment",
"--write=deny"
]
}
}
} Run the Gateway Manually
kosmokrator mcp:serve --integration=segment --write=deny Why Use KosmoKrator Here
Expose only Segment instead of a broad multi-service tool list.
Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.
Start read-only, then opt into ask or allow for trusted workspaces.
Segment Tools Visible to OpenAI Agents
OpenAI Agents sees stable MCP tool names generated from the Segment integration catalog.
| MCP tool | Source function | Type | Description |
|---|---|---|---|
integration__segment__segment_identify | segment.segment_identify | Write | 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. |
integration__segment__segment_track | segment.segment_track | Write | Track a custom event for a user in Segment. Records actions your users perform along with optional properties describing the action. |
integration__segment__segment_page | segment.segment_page | Write | Record a page view in Segment. Tracks when a user views a page, along with optional properties about the page. |
integration__segment__segment_group | segment.segment_group | Write | Associate a user with a group (organization, company, account) in Segment. Lets you record group membership along with optional group traits. |
integration__segment__segment_get_workspace | segment.segment_get_workspace | Read | Get details of a Segment workspace by its slug. Requires an API token to be configured. |
integration__segment__segment_list_sources | segment.segment_list_sources | Read | List all sources in a Segment workspace. Requires an API token to be configured. |
integration__segment__segment_get_source | segment.segment_get_source | Read | Get details of a specific Segment source by ID. Requires an API token to be configured. |
integration__segment__segment_get_current_user | segment.segment_get_current_user | Read | Get the currently authenticated Segment user. Useful for verifying API token credentials are correct. |