Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Agent Trackershow me the last 5 conversations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Agent Tracker
A Model Context Protocol (MCP) server that automatically tracks client-agent conversations without requiring any user interaction.
Features
π£οΈ Automatic Conversation Tracking
Zero User Interaction Required: All conversations are tracked automatically
Client Request Logging: Every client prompt/request is logged
Agent Response Logging: Every agent response is captured
Complete Conversation Turns: Full request-response pairs are recorded
Session Management: Automatic session creation and tracking
π§ MCP Tools Available
get_current_weather(city): Get weather information for a cityagent_interaction(prompt): Interact with the agentget_interaction_history(limit, session_id): Retrieve conversation historyget_conversation_summary(session_id): Get conversation statistics and patterns
π Automatic Monitoring
Background Health Checks: Continuous system monitoring every 5 minutes
Automatic Metadata Collection: System info, process details, uptime
Error Tracking: Comprehensive error logging and recovery
Performance Metrics: Execution times and system health
Related MCP server: MCP Work History Server
How It Works
1. Automatic Session Creation
# Sessions are created automatically when the server starts
# No user input required
logger.get_or_create_session()2. Client Request Tracking
# Every client request is automatically logged
logger.log_client_request(f"Get weather for {city}")3. Agent Response Tracking
# Every agent response is automatically captured
logger.log_agent_response(response)4. Complete Conversation Logging
# Full conversation turns are recorded
logger.log_conversation_turn(
client_request=f"Get weather for {city}",
agent_response=response
)5. Background Monitoring
# System health is monitored continuously
# No user interaction needed
def background_monitoring():
while True:
logger.log_interaction(interaction_type='health_check', ...)
time.sleep(Config.MONITORING_INTERVAL_SECONDS)Configuration
Environment Variables
# Enable/disable features
ENABLE_BACKGROUND_MONITORING=true
MONITORING_INTERVAL_SECONDS=300
ENABLE_AUTOMATIC_METADATA=true
# Database and logging
DATABASE_URL=
DB_PATH=./data/agent_tracker.db
LOG_LEVEL=INFOConfiguration Options
ENABLE_BACKGROUND_MONITORING: Enable continuous system monitoringMONITORING_INTERVAL_SECONDS: How often to run health checks (default: 300s)ENABLE_AUTOMATIC_METADATA: Collect system info automatically
Database Schema
AgentInteraction Table
CREATE TABLE agent_interactions (
id INTEGER PRIMARY KEY,
timestamp TIMESTAMP,
session_id VARCHAR(255),
user_id VARCHAR(255),
interaction_type VARCHAR(100), -- 'client_request', 'agent_response', 'conversation_turn'
prompt TEXT, -- Client request
response TEXT, -- Agent response
status VARCHAR(50),
error_message TEXT,
meta_data JSON -- Automatic system metadata
);Session Table
CREATE TABLE sessions (
id VARCHAR(255) PRIMARY KEY,
user_id VARCHAR(255),
started_at TIMESTAMP,
last_activity TIMESTAMP,
total_interactions INTEGER,
meta_data JSON
);Usage Examples
Basic Conversation Tracking
@mcp.tool()
def my_tool(prompt: str) -> str:
# Client request is automatically logged
logger.log_client_request(prompt)
# Process the request
response = process_request(prompt)
# Agent response is automatically logged
logger.log_agent_response(response)
# Complete conversation turn is recorded
logger.log_conversation_turn(prompt, response)
return responseGetting Conversation History
# Get recent conversations
history = get_interaction_history(limit=10)
# Get conversation summary
summary = get_conversation_summary()Security Features
Environment Variables: All configuration via environment variables
No Hardcoded Secrets: Secure credential management
Isolated Database Schema: Separate schema for tracking data
Error Isolation: Logging failures don't break main functionality
Getting Started
Copy environment file:
cp env.example .envConfigure your environment:
# Edit .env with your settings ENABLE_BACKGROUND_MONITORING=true MONITORING_INTERVAL_SECONDS=300Run the server:
python main.pyMonitor conversations:
# Use the MCP tools to interact and track conversations
π Using in Cursor
Prerequisites
Cursor IDE installed on your system
Python 3.8+ with pip/uv package management
Git for cloning the repository
Step 1: Setup MCP Server
Clone and navigate to your project:
cd /path/to/your/mcp/projectInstall dependencies:
# Using pip pip install -r requirements.txt # Or using uv (recommended) uv syncConfigure environment:
cp env.example .env # Edit .env with your preferred settings
Step 2: Configure Cursor for MCP
Open Cursor Settings:
Press
Cmd+,(Mac) orCtrl+,(Windows/Linux)Or go to
Cursor β Preferences β Settings
Add MCP Configuration:
{ "mcpServers": { "mcp-project": { "command": "python", "args": ["/absolute/path/to/your/project/main.py"], "env": { "PYTHONPATH": "/absolute/path/to/your/project" } } } }Alternative: Use relative paths (if Cursor is opened in project directory):
{ "mcpServers": { "mcp-project": { "command": "python", "args": ["./main.py"] } } }
Step 3: Test MCP Integration
Restart Cursor after adding MCP configuration
Open Command Palette (
Cmd+Shift+PorCtrl+Shift+P)Type "MCP" to see available MCP commands
Test a tool:
Use
get_current_weather("New York")to test weather functionalityUse
agent_interaction("Hello, how are you?")to test conversation trackingUse
get_system_status()to check system health
Step 4: Use MCP Tools in Cursor
Available Tools
get_current_weather(city): Get weather for any cityagent_interaction(prompt): Interact with the agent and track conversationsget_interaction_history(limit, session_id): View conversation historyget_conversation_summary(session_id): Get conversation analyticsget_system_status(): Check system health and configurationtest_conversation_tracking(message): Test the tracking system
Example Usage in Cursor
Open Command Palette (
Cmd+Shift+P)Type MCP command:
MCP: mcp-project: get_current_weatherEnter parameters when prompted:
city: San FranciscoView results in the output panel
Step 5: Monitor and Debug
View Conversation History
# In Cursor terminal or via MCP tools
python -c "
from main import get_interaction_history
print(get_interaction_history(limit=5))
"Check System Status
# Via MCP tools in Cursor
get_system_status()Test Conversation Tracking
# Via MCP tools in Cursor
test_conversation_tracking("Test message from Cursor")Troubleshooting
Common Issues
"MCP server not found":
Check the absolute path in your Cursor settings
Ensure the Python path is correct
Verify the server is running
"Import errors":
Check
PYTHONPATHin MCP configurationEnsure all dependencies are installed
Verify you're in the correct directory
"Permission denied":
Make sure
main.pyis executableCheck file permissions
Try running with
python3instead ofpython
Debug Commands
# Test MCP server directly
python main.py
# Check dependencies
pip list | grep mcp
# Verify configuration
python -c "from config import Config; print(Config.ENVIRONMENT)"Advanced Configuration
Custom MCP Server Names
{
"mcpServers": {
"my-custom-mcp": {
"command": "python",
"args": ["./main.py"],
"env": {
"ENVIRONMENT": "development",
"LOG_LEVEL": "DEBUG"
}
}
}
}Multiple MCP Servers
{
"mcpServers": {
"mcp-project": { "command": "python", "args": ["./main.py"] },
"another-mcp": { "command": "python", "args": ["./other_mcp.py"] }
}
}Benefits in Cursor
β
Seamless Integration: Use MCP tools directly in your IDE
β
Real-time Monitoring: Track conversations as you work
β
Debugging Tools: Built-in testing and monitoring functions
β
Performance Insights: Monitor system health and usage
β
Conversation Analytics: Analyze interaction patterns
β
Zero Configuration: Automatic setup and tracking
Your MCP server will now be fully integrated with Cursor, providing powerful conversation tracking and monitoring capabilities right in your development environment!
What Gets Tracked Automatically
β
Client Requests: Every prompt, question, or request
β
Agent Responses: Every response, answer, or action
β
Conversation Flow: Complete request-response pairs
β
System Health: Background monitoring and metrics
β
Error Handling: All errors and exceptions
β
Session Data: User sessions and activity
β
Metadata: System info, timestamps, environment
β Tool Usage: Internal MCP tool executions are not tracked
β User Input: No manual logging required
β Configuration: Automatic setup and management
The system is designed to be completely hands-off - once started, it will track all client-agent conversations automatically without any intervention needed.