- ›
An MCP session is a short-lived credential that lets an agent runtime call Naïve's governed tools over SSE— scoped to one tenant user. - ›
Your server mints it with sessions.create; the runtime receives mcp.url + Authorization bearer— never your workspace key. - ›Default TTL is 15 minutes; maximum 24 hours (per published docs).
- ›
Tools exposed over the session are filtered by the tenant user's Account Kit— same policy as in-process agentTools(). - ›
Revoke the session and the MCP client is rejected immediately— no key rotation required. - ›Use sessions for Python, edge, and desktop runtimes; keep nv_sk_live on your trusted backend.
The Model Context Protocol (MCP) lets agent runtimes discover and call tools over a standard wire format. Naïve's MCP session is the credential layer on top: a short-lived, per-user token that exposes governed tools without handing out your workspace API key.
This is the definitional post. For the full architecture narrative, read delegated, revocable MCP sessions for AI agents.
What you get when you mint a session
Your server (trusted) Untrusted runtime
───────────────────── ───────────────────
sessions.create({ ttlMs }) → mcp.url + Bearer nv_sess_…
for one tenant user MCP client connects via SSE
discovers kit-filtered tools
The session binds to exactly one tenant user. The Account Kit on that user decides which tools appear in the MCP catalog.
Minting a session (TypeScript)
import { Naive } from "@usenaive-sdk/server";
const naive = new Naive({ apiKey: process.env.NAIVE_API_KEY! });
const client = naive.forUser(tenantUserId);
const session = await client.session({ ttlMs: 15 * 60 * 1000 });
// Hand to the runtime — never log the bearer in plaintext
console.log(session.mcp.url);
console.log(session.mcp.headers.Authorization);Python and other stacks mint the same object over REST against POST /v1/users/:user_id/sessions — see the integration guides.
Session lifecycle
| Event | What happens |
|---|---|
| Create | New bearer + SSE endpoint; tools filtered by Account Kit |
| Call | Each tool invocation hits the governance gateway (caps, approvals, audit) |
| Expire | Connection rejected after TTL (default 15 min, max 24h per published docs) |
| Revoke | Immediate invalidation — see how to revoke access instantly |
MCP session vs workspace key
Never embed nv_sk_live in a desktop config, edge worker, or customer-deployed agent. Mint a session per user per run instead. The workspace key stays in your VPC; the runtime gets a credential that dies on its own.
Where to go next
- Build a bring-your-own-agent platform — end-to-end MCP tutorial
- Naïve inside your agent framework — when to pick MCP vs in-process tools
- Sessions docs — TTL, headers, revocation API
What is an MCP session?+
How is an MCP session different from an API key?+
How long does an MCP session last?+
What tools does an MCP session expose?+
Can I revoke an MCP session before it expires?+
When should I use an MCP session vs agentTools()?+
Building the agent-native backend.
Per-user MCP sessions give AI agents delegated, revocable access — short-lived, kit-scoped credentials instead of your workspace key. Here's the pattern.
How to revoke an AI agent's access instantly: suspend the agent profile or revoke an MCP session so the governance gateway denies all further tool calls.
An AI agent identity is the governed record an agent acts as — tenant user, Account Kit, resources, and audit trail — not the model or the API key alone.
Build a bring-your-own-agent platform on Naïve: mint each customer a short-lived, revocable MCP session that's scoped and filtered by their Account Kit.