AI Setu Docs
Integrations

MCP

The AI Setu MCP server — install, auth, the full tool list, and an end-to-end agent flow.

@ai-setu/mcp is a Model Context Protocol server that exposes the AI Setu control plane as tools — Claude Code, Cursor, or any other MCP-aware agent can onboard a user, mint keys, check balance, and configure BYOK provider credentials conversationally, with no SDK code. It wraps @ai-setu/admin; it does not run inference — for chat or embeddings, an agent calls @ai-setu/client directly.

Install

No install needed — an MCP client launches it on demand:

npx -y @ai-setu/mcp

Or install the ai-setu-mcp binary globally with npm i -g @ai-setu/mcp.

Configure your MCP client

Add it to your MCP client's server config (for Claude Code: ~/.claude.json, or a project-local .claude.json):

{
  "mcpServers": {
    "ai-setu": {
      "command": "npx",
      "args": ["-y", "@ai-setu/mcp"],
      "env": {
        "AI_SETU_PAT": "tt_pat_...",
        "AI_SETU_TENANT_ID": "00000000-0000-0000-0000-000000000001",
      },
    },
  },
}

Auth

  • AI_SETU_PAT — a Personal Access Token (shape tt_pat_…), required for every tool except the always-available ones below. Mint one at https://app.aisetu.ai/settings/profile, or obtain one from the server's own OTP onboarding tools with no PAT set at all (see the walkthrough below).
  • AI_SETU_TENANT_ID — recommended. Falls back for the tenant-scoped tools (get_credit_balance, get_usage_projection, request_topup_link) when they're called without an explicit tenant_id.
  • AI_SETU_API_BASE_URL — optional. Overrides the control-plane host for self-hosted or staging deployments; defaults to production https://api.aisetu.ai.
  • AI_SETU_PROVISIONING_KEY — optional, high-privilege. A tt_prov_… key that registers the provision_tenant tool (agent-native tenant onboarding). A PAT alone cannot provision tenants.

Run the setup_status tool any time to see which of these are set on the running server — it's the first thing to check if another tool errors with a missing-env message.

Tools

The server registers only the tools its configured credentials support: the setup_status and OTP tools always register; the PAT-scoped tools register when AI_SETU_PAT (or a provisioning key) is present; provision_tenant registers only when AI_SETU_PROVISIONING_KEY is set.

Always available

ToolPurpose
setup_statusReports which env vars are set and what's still needed for full functionality.

Auth — no PAT required

ToolPurpose
start_otpEmails a 6-digit code to begin the OTP flow. Works for both new and existing users.
verify_otpExchanges email + code for a session token and the caller's list of existing orgs.
use_orgContinues with an org the user already belongs to; returns its workspace plus a fresh PAT.
create_orgCreates a new org; returns { orgId, workspaceId, apiKey, pat, topUpUrl }.
get_sso_urlReturns a Google or Microsoft OAuth URL for a user who prefers SSO over OTP.

Requires AI_SETU_PAT

ToolPurpose
get_credit_balanceCurrent credit balance, with a top-up hint when it's low.
get_usage_projectionSpend projection: average/day, month-to-date, projected month-end.
list_workspacesEvery workspace the calling PAT can see.
create_workspaceCreates a new workspace (dev / staging / prod separation).
list_api_keysActive API keys for a workspace (secrets not included).
create_api_keyMints a new workspace API key. Secret shown once.
rotate_api_keyRevokes and remints a key with a fresh secret. Shown once.
revoke_api_keyPermanently revokes an API key.
set_provider_credentialAdds or updates a BYOK Connection (provider credential + routing slug).
list_provider_credentialsLists configured BYOK credentials (secrets never returned — only a hint).
test_provider_credentialSynthetic probe of a stored credential against its upstream.
remove_provider_credentialPermanently revokes a BYOK credential.
request_topup_linkMints a Stripe-hosted checkout link for adding credit (human completes payment).

Requires AI_SETU_PROVISIONING_KEY

ToolPurpose
provision_tenantAtomically creates a new org + workspace + inference key under the provisioning key's parent tenant.

BYOK Connections over MCP

set_provider_credential covers openai, anthropic, gemini, bedrock, bedrock-mantle, and vertex (Azure and other OpenAI-compatible endpoints use provider openai plus a base_url). Every secret field has an *_env twin — e.g. api_key_env names an env var the MCP server process reads the value from — so the raw key never has to travel through the tool-call arguments an MCP client may log or persist. Target the resulting Connection per inference request with model: "@<slug>/<model>".

End-to-end: onboard a brand-new user from chat

This is the flow that needs no pre-existing credentials at all — the agent can run every step itself:

  1. Ask the user for their email, then call start_otp.
  2. The user reads the 6-digit code from their inbox and pastes it back.
  3. Call verify_otp with { email, otp } — it returns a sessionToken and existingOrgs.
  4. Branch on existingOrgs.length:
    • 0 → ask for an org name, call create_org.
    • 1 → confirm with the user, then call use_org.
    • more → let the user pick, then use_org (or create_org for a new one).
  5. create_org / use_org return { apiKey?, pat, tenantId, workspaceId, topUpUrl }. Save apiKey as AI_SETU_API_KEY in the user's project (for @ai-setu/client), save pat as AI_SETU_PAT in the MCP server config and restart the server, and set AI_SETU_TENANT_ID to tenantId.
  6. Tell the user to visit topUpUrl to add credit — new orgs start at $0 balance, so the first inference call will fail with an insufficient-credits error until they do.

From there the agent can list workspaces, mint additional API keys, configure a BYOK Connection so the user's own provider key serves their traffic, and check balance/usage — all from the same conversation, without ever leaving chat for the dashboard.

Why a separate package from @ai-setu/admin

@ai-setu/admin is the direct TypeScript SDK for scripts, CI, and app code. @ai-setu/mcp wraps that same SDK and adds tool descriptions written for an LLM to pick the right one and explain it to a human — the two share no state. Use the MCP server for multi-step, conversational work; use the SDK directly from a deployed app.

On this page