Package Exports
- cursor-ia-consumption-tracker
- cursor-ia-consumption-tracker/server
Readme
cursor-ia-consumption-tracker
A simplified MCP (Model Context Protocol) server for tracking AI consumption data from Cursor IDE with platform integration and token logging.
Features
- 🚀 Simple Setup - Easy integration with Cursor IDE via MCP
- 📊 Consumption Tracking - Automatic token usage and query analysis
- 🔄 Platform Integration - Sends data to your tracking platform
- 🎯 Agent Detection - Supports multiple AI agents (Claude, GPT, etc.)
- 📝 Clean Logging - Structured JSON logs with essential metrics
- ⚡ Lightweight - Minimal dependencies and overhead
Installation
Global Installation (Recommended)
npm install -g cursor-ia-consumption-tracker
Local Installation
npm install cursor-ia-consumption-tracker
Setup with Cursor IDE
- Add to your Cursor MCP configuration (
~/.cursor/mcp.json
):
{
"mcpServers": {
"ia-consumption-tracker": {
"command": "node",
"args": ["node_modules/cursor-ia-consumption-tracker/auto-logger.js"],
"env": {
"PLATFORM_HOST": "https://your-platform.com",
"PLATFORM_ROUTE": "/api/track",
"CLIENT_ID": "your-client-id",
"PROJECT_NAME": "your-project-name",
"AGENT_NAME": "claude-4-sonnet"
}
}
}
}
- For global installation:
{
"mcpServers": {
"ia-consumption-tracker": {
"command": "ia-consumption-mcp",
"env": {
"PLATFORM_HOST": "https://your-platform.com",
"PLATFORM_ROUTE": "/api/track",
"CLIENT_ID": "your-client-id",
"PROJECT_NAME": "your-project-name",
"AGENT_NAME": "claude-4-sonnet"
}
}
}
}
Configuration
Environment Variables
Variable | Description | Required | Default |
---|---|---|---|
PLATFORM_HOST |
Your tracking platform URL | Yes | https://localhost:8069 |
PLATFORM_ROUTE |
API endpoint for tracking | Yes | /ia_tracker/track |
CLIENT_ID |
Your client identifier | Yes | cursor_default_client |
PROJECT_NAME |
Project name for tracking | Yes | cursor_mcp_logger |
AGENT_NAME |
AI agent name | No | cursor-agent |
Usage
Once configured, the MCP server provides one tool:
send_consumption
Automatically tracks and sends consumption data for each chat interaction.
Parameters:
user_query
(required): The user's question/requestresponse_length
(optional): Actual response character count
Example Response:
📊 CONSUMPTION SENT: auto_1758109135068
Agent: claude-4-sonnet
Query: "Hello world"
Tokens: 5 (3+2)
Platform: Sent to https://your-platform.com/api/track
Data Structure
The consumption data sent to your platform includes:
{
"cursor_data": {
"request_id": "auto_1758109135068",
"timestamp": "2024-01-20T10:30:00.000Z",
"session_id": "session_12345_1705748200",
"agent_name": "claude-4-sonnet",
"agent_info": {
"agent_name": "claude-4-sonnet",
"session_agent": "claude-4-sonnet"
},
"request_data": {
"type": "chat_completion",
"query_text": "Hello world",
"query_length": 11,
"word_count": 2,
"query_type": "general",
"complexity": "low",
"language": "english",
"has_code": false
},
"token_metrics": {
"input_tokens": 3,
"output_tokens": 2,
"total_tokens": 5,
"estimation_method": "input_ratio_2.5x"
},
"session_context": {
"total_interactions": 1,
"workspace": "/path/to/workspace",
"platform": "darwin"
}
}
}
Development
Local Development
# Clone the repository
git clone https://github.com/vunkers/ia-consumption-tracker.git
cd ia-consumption-tracker
# Install dependencies
npm install
# Start development server
npm run dev
Testing
npm test
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- 🐛 Issues: GitHub Issues
- 📖 Documentation: GitHub Wiki
Changelog
v1.0.0
- Initial release
- Simple consumption tracking
- Platform integration
- Agent detection support
- Cursor IDE integration
Made with ❤️ by Arkiphere Cloud LLC