Cursor Integration
Cursor is an AI-powered code editor. The LangGuard integration captures agent activity, traces, and telemetry from your Cursor IDE.
Overview
The Cursor integration enables LangGuard to:
- Capture agent activity and session lifecycle
- Monitor tool usage and shell command execution
- Track MCP calls (Model Context Protocol)
- Monitor file operations performed by the AI agent
- Comprehensive tracing via OpenTelemetry hooks
GitHub Plugin
The Cursor integration is available as an open-source plugin on GitHub. Install the plugin to capture agent activity, traces, and telemetry from your Cursor IDE.
Repository: github.com/LangGuard-AI/cursor-otel-hook
Features
- OpenTelemetry hook for comprehensive tracing
- Captures agent activity and session lifecycle
- Tool usage and shell command monitoring
- MCP (Model Context Protocol) call tracking
- File operation monitoring
Installation & Setup
Follow these steps to integrate Cursor with LangGuard observability.
Step 1: Clone the Plugin
Clone the repository directly into your project root:
git clone https://github.com/LangGuard-AI/cursor-otel-hook
Step 2: Install Dependencies
Navigate to the hooks directory and install required packages:
cd .cursor/hooks && npm install
Step 3: Configure Environment
Create a .env file in your project root with your LangGuard credentials as specified in the repository's README.
Refer to the README.md for full configuration options and troubleshooting.
What Gets Captured
Agent Sessions
Each Cursor agent session is tracked:
| Event | Description |
|---|---|
| Session start | When the agent is activated |
| Session end | When the agent completes or is stopped |
| Context switches | When the agent changes focus |
Tool Usage
All tool invocations are monitored:
- File reads and writes
- Shell command execution
- Code search and navigation
- External API calls
MCP Calls
Model Context Protocol interactions are tracked:
- Server connections
- Tool invocations
- Resource access
- Protocol errors
Troubleshooting
Plugin Not Loading
- Verify the
.cursor/hooksdirectory exists - Check that dependencies are installed (
npm install) - Restart Cursor IDE
No Traces Appearing
- Verify
.envcredentials are correct - Check network connectivity to LangGuard
- Review plugin logs in Cursor's developer console
Missing Events
- Ensure the plugin version is up to date
- Check for any filtering in your configuration
- Verify the agent is using supported features
Next Steps
- Integrations Overview - See all available integrations
- Policies - Apply governance rules to agent traces