A session is the central primitive in Composio. It binds a user ID to a runtime context that contains tool access, authentication state, an MCP endpoint, and execution logs. Every tool call, connected account lookup, and workbench operation runs inside this scoped context — keeping one user’s data cleanly isolated from another’s.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ComposioHQ/composio/llms.txt
Use this file to discover all available pages before exploring further.
Creating a session
Pass your user ID tocomposio.create() to open a new session. Every call returns a fresh session ID. Use the same session ID across turns of a conversation to preserve tool and workbench state.
- Tab Title
- Tab Title
composio.use() instead of create():
- Tab Title
- Tab Title
Getting tools from a session
Callsession.tools() to retrieve provider-wrapped tools ready to pass into your AI framework. By default, this returns the session’s meta tools (COMPOSIO_SEARCH_TOOLS, COMPOSIO_MANAGE_CONNECTIONS, etc.) plus any preloaded tools you configured.
- Tab Title
- Tab Title
- Tab Title
- Tab Title
Session MCP endpoint
Every session exposes a remote MCP server. Any MCP-compatible client — Claude Desktop, Cursor, or your own MCP client — can connect to it using the session URL and your API key as the auth header.- Tab Title
- Tab Title
mcp_url and mcp_headers to any MCP client — both url and native tools point at the same session context, so tool calls, auth, and workbench state are shared regardless of which access method you use.
See MCP guide for provider-specific setup instructions (Claude Desktop, Cursor, Vercel AI SDK, etc.).
Generating a connect link from a session
Usesession.authorize() when you want to authenticate a user to a toolkit programmatically — for example, during onboarding or from a settings page.
- Tab Title
- Tab Title
User IDs
User IDs are arbitrary strings you define. Composio stores connected accounts and tool-execution history under this ID, so consistent, unique IDs are essential.| Practice | Recommendation |
|---|---|
| Recommended | Database UUID or primary key (user.id) |
| Acceptable | Unique username (user.username) |
| Avoid | Email addresses — they can change and may be reassigned |
| Never in production | "default" — routes all users to the same connected accounts |
connectedAccounts:
- Tab Title
- Tab Title
Session vs. direct access
Sessions and the directcomposio.tools.get() method serve different needs:
Session (composio.create()) | Direct (composio.tools.get()) | |
|---|---|---|
| Scope | Scoped to a single user ID | Any user ID you pass per call |
| Meta tools | Included by default | Not included |
| MCP endpoint | Provided via session.mcp | Not available |
| Workbench | Included by default | Not available |
| Auth flow | Managed by COMPOSIO_MANAGE_CONNECTIONS | Manual via connectedAccounts.link() |
| Best for | Agentic chat and multi-turn conversations | Direct tool execution, scripting, batch jobs |
composio.tools.get() when you want to call a specific tool directly without the session overhead.
Authentication
Auth configs, Connect Links, and OAuth token management
Connected Accounts
Listing, creating, and managing per-user credentials
Tools & Toolkits
Discovering, filtering, and executing tools directly
MCP Guide
Connecting MCP clients to a Composio session