MCP Server & AI Assistant Connectors
SegOps ships an **MCP (Model Context Protocol) server** so you can drive your tenant from the AI clients you already use — **Claude Desktop**, **Claude.ai**, and **ChatGPT**. The server wraps the SegOps Admin API: list and inspect segments, create and recompute them, explore users, manage products and AI-visibility queries, and generate landing pages — all scoped to your tenant.
The assistant never chooses a tenant. The tenant is bound to your credential on the server side, so a connector can only ever touch its own tenant's data.
Tool surface#
| Tool | What it does |
|---|---|
list_segments / get_segment / create_segment / recompute_segment | Customer segments |
query_users / get_user_profile / get_user_events | User Explorer |
list_products / bulk_upsert_products / score_product_ai_readability | Product catalog |
list_ai_queries / run_query_simulation / get_visibility_dashboard | AI visibility |
list_pages / generate_landing_page / export_page | AI landing pages |
list_activations / trigger_activation_sync | Activations |
track_event | Publish a test event to the Explorer sandbox (not production) |
It also exposes read-only resources (segops://segments, …/products,
…/queries, …/visibility-dashboard) and five starter prompts (audit
segments, find visibility gaps, generate a landing page, review competitors,
diagnose ingestion).
Authentication & scopes#
Connectors authenticate one of two ways:
- MCP key (
mk_) — for Claude Desktop (stdio). Generate one under Settings → API keys → MCP (or via the Connectors page). MCP keys are least-privilege:mcp:read+mcp:writeby default, never destructive unless explicitly grantedmcp:admin. - OAuth 2.1 + PKCE — for Claude.ai and ChatGPT (hosted). You sign in to SegOps, pick a tenant, and approve access; the connector receives a short-lived, scoped access token (refreshed automatically).
Scope is enforced per request, by HTTP method: reads need mcp:read, writes
need mcp:write, and deletes need mcp:admin — independent of the client.
Claude Desktop (stdio)#
-
Connectors → Claude Desktop, click Generate MCP key (owners only).
-
Copy the generated config into
claude_desktop_config.json(Claude Desktop → Settings → Developer → Edit Config): -
Restart Claude Desktop and ask: “List my top 3 segments by member count.”
Requires uv. The server runs locally; only the
authenticated API calls leave your machine.
Claude.ai (hosted, OAuth)#
- Connectors → Claude.ai → Add to Claude.ai, or in Claude.ai add a custom
connector with the URL
https://mcp.segops.ai/<tenant>/sse. - Sign in to SegOps and approve. Done — no key to manage.
ChatGPT (Actions, OAuth)#
- In the GPT editor → Actions → Import from URL, use
https://api.segops.ai/api/mcp/openapi.json. - Set Authentication → OAuth: client id
chatgpt, scopemcp:read mcp:write, authorization URLhttps://app.segops.ai/oauth/authorize, token URLhttps://api.segops.ai/oauth/token. - ChatGPT shows a callback URL (
https://chatgpt.com/connector/oauth/<id>). Send it to your SegOps admin to add to thechatgptclient's redirect allowlist.
Observability & limits#
- Telemetry — every tool call is logged to a tenant-scoped audit trail
(
GET /api/mcp/tool-calls/): tool name, method/path, status, and duration. We log request shape, never request bodies. - Rate limit — 100 tool calls / minute / tenant by default
(
MCP_RATE_LIMIT_PER_MIN), separate from API-key limits; over-limit calls get429+Retry-After.
Threat model#
What a connected assistant can — and can't — do on your behalf:
- Tenant isolation. A credential is bound to one tenant. Tool calls are scoped to that tenant server-side; the assistant cannot name another tenant.
- Least privilege. MCP keys default to read+write and cannot delete
unless granted
mcp:admin. Scope is re-checked per request by HTTP method, so a read-only credential is read-only even if the assistant tries to mutate. - No secret exposure. Secret keys (
sk_) are never used by connectors. MCP keys are shown once; OAuth refresh tokens are stored as hashes (non-recoverable) and rotate on every use — a leaked-and-replayed refresh token is detected and the chain is revoked. Authorization codes are single-use and short-lived, and PKCE (S256) is required. - What the assistant sees. Anything the tools return — segment definitions,
user profiles/events, product data, visibility metrics. Treat a connected
assistant as having the same read/write reach as the MCP credential you issued.
Revoke a key (Settings → API keys) or an OAuth grant (
/oauth/revoke) to cut access immediately. - Prompt-injection awareness. Tool outputs may contain attacker-controlled
text (e.g. a user trait). The connector returns data faithfully; your assistant
decides what to do with it. Prefer read scopes for analysis workflows, and
reserve
mcp:write/mcp:adminfor trusted, owner-issued credentials. - Auditability. Every call is in the tool-call audit trail, so you can review exactly what an assistant did and when.
Self-hosting the server#
The server is the segops-mcp Python package (sdks/mcp/python). Stdio runs via
uvx segops-mcp; the hosted transport (SEGOPS_MCP_TRANSPORT=http) is deployed
to Cloud Run (deploy/docker/mcp.Dockerfile, cloudbuild.mcp.yaml) and verifies
OAuth access tokens with a shared SEGOPS_MCP_JWT_SECRET. See the package README
for all environment variables.