Interactive terminal chat powered by the Cursor SDK and Composio. The agent streams replies in real time and logs tool calls as Composio executes integrations on your behalf.
index.ts # CLI entry point — readline chat loop + streaming output
runtime.ts # Composio session, MCP config, agent cache
- Node.js 18+
- Cursor API key
- Composio project API key from Settings → API Keys (not a Connect/MCP consumer key)
Copy .env.example to .env and set:
| Variable | Required | Description |
|---|---|---|
CURSOR_API_KEY |
Yes | Cursor SDK API key |
COMPOSIO_API_KEY |
Yes | Composio project API key. Keys starting with ck_ are rejected |
COMPOSIO_USER_ID |
No | Composio user id for the session. Defaults to user_123 |
npm installCreate .env from the example and fill in your keys:
# Windows
copy .env.example .env
# macOS / Linux
cp .env.example .envnpx ts-node index.tsOn startup you should see something like:
Setting up Composio session...
Ready (user: user_123, session: <session-id>, tools: <count>).
Type a message, or 'exit' to quit.
you >
- Type a message at
you >and press Enter. - The agent streams its reply after
agent >. - Tool activity is printed as
[tool: <name>] <args>while running and[tool: <name>] donewhen finished. - Type
exitorquitto end the session.
Let's break it down:
- We start by loading dependencies and reading environment variables from
.env. - For a sanity check, we validate
CURSOR_API_KEYandCOMPOSIO_API_KEY, and reject Composio consumer keys (ck_…). - Next, we create a Composio session for
COMPOSIO_USER_ID(defaultuser_123), then spin up a Cursor agent oncomposer-2with the Composio MCP server for tools. - We cache the agent per session so the same runtime is reused for the whole chat.
- Using readline, we run an interactive loop: read input → send to the agent → stream assistant text and tool status → repeat until
exitorquit. - On shutdown, we close readline, dispose of all agents, and exit with any errors logged to stderr.