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/mcpOr 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 (shapett_pat_…), required for every tool except the always-available ones below. Mint one athttps://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 explicittenant_id.AI_SETU_API_BASE_URL— optional. Overrides the control-plane host for self-hosted or staging deployments; defaults to productionhttps://api.aisetu.ai.AI_SETU_PROVISIONING_KEY— optional, high-privilege. Att_prov_…key that registers theprovision_tenanttool (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
| Tool | Purpose |
|---|---|
setup_status | Reports which env vars are set and what's still needed for full functionality. |
Auth — no PAT required
| Tool | Purpose |
|---|---|
start_otp | Emails a 6-digit code to begin the OTP flow. Works for both new and existing users. |
verify_otp | Exchanges email + code for a session token and the caller's list of existing orgs. |
use_org | Continues with an org the user already belongs to; returns its workspace plus a fresh PAT. |
create_org | Creates a new org; returns { orgId, workspaceId, apiKey, pat, topUpUrl }. |
get_sso_url | Returns a Google or Microsoft OAuth URL for a user who prefers SSO over OTP. |
Requires AI_SETU_PAT
| Tool | Purpose |
|---|---|
get_credit_balance | Current credit balance, with a top-up hint when it's low. |
get_usage_projection | Spend projection: average/day, month-to-date, projected month-end. |
list_workspaces | Every workspace the calling PAT can see. |
create_workspace | Creates a new workspace (dev / staging / prod separation). |
list_api_keys | Active API keys for a workspace (secrets not included). |
create_api_key | Mints a new workspace API key. Secret shown once. |
rotate_api_key | Revokes and remints a key with a fresh secret. Shown once. |
revoke_api_key | Permanently revokes an API key. |
set_provider_credential | Adds or updates a BYOK Connection (provider credential + routing slug). |
list_provider_credentials | Lists configured BYOK credentials (secrets never returned — only a hint). |
test_provider_credential | Synthetic probe of a stored credential against its upstream. |
remove_provider_credential | Permanently revokes a BYOK credential. |
request_topup_link | Mints a Stripe-hosted checkout link for adding credit (human completes payment). |
Requires AI_SETU_PROVISIONING_KEY
| Tool | Purpose |
|---|---|
provision_tenant | Atomically 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:
- Ask the user for their email, then call
start_otp. - The user reads the 6-digit code from their inbox and pastes it back.
- Call
verify_otpwith{ email, otp }— it returns asessionTokenandexistingOrgs. - Branch on
existingOrgs.length:0→ ask for an org name, callcreate_org.1→ confirm with the user, then calluse_org.- more → let the user pick, then
use_org(orcreate_orgfor a new one).
create_org/use_orgreturn{ apiKey?, pat, tenantId, workspaceId, topUpUrl }. SaveapiKeyasAI_SETU_API_KEYin the user's project (for@ai-setu/client), savepatasAI_SETU_PATin the MCP server config and restart the server, and setAI_SETU_TENANT_IDtotenantId.- Tell the user to visit
topUpUrlto 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.