Skip to content

DevloperHS/cursor_agents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cursor + Composio CLI Agent

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.

Project layout

index.ts              # CLI entry point — readline chat loop + streaming output
runtime.ts   # Composio session, MCP config, agent cache

Prerequisites

Environment variables

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

Setup

npm install

Create .env from the example and fill in your keys:

# Windows
copy .env.example .env

# macOS / Linux
cp .env.example .env

Run

npx ts-node index.ts

On 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>] done when finished.
  • Type exit or quit to end the session.

How it works

Let's break it down:

  • We start by loading dependencies and reading environment variables from .env.
  • For a sanity check, we validate CURSOR_API_KEY and COMPOSIO_API_KEY, and reject Composio consumer keys (ck_…).
  • Next, we create a Composio session for COMPOSIO_USER_ID (default user_123), then spin up a Cursor agent on composer-2 with 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 exit or quit.
  • On shutdown, we close readline, dispose of all agents, and exit with any errors logged to stderr.

About

Practical Reference for implementing Cusor Agents SDK with hosted mcp servers across different agent runtimes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors