Skip to main content

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.

tip

Refer to the README.md for full configuration options and troubleshooting.

What Gets Captured​

Agent Sessions​

Each Cursor agent session is tracked:

EventDescription
Session startWhen the agent is activated
Session endWhen the agent completes or is stopped
Context switchesWhen 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​

  1. Verify the .cursor/hooks directory exists
  2. Check that dependencies are installed (npm install)
  3. Restart Cursor IDE

No Traces Appearing​

  1. Verify .env credentials are correct
  2. Check network connectivity to LangGuard
  3. Review plugin logs in Cursor's developer console

Missing Events​

  1. Ensure the plugin version is up to date
  2. Check for any filtering in your configuration
  3. Verify the agent is using supported features

Next Steps​