Get the FREE Ultimate OpenClaw Setup Guide →

agentlens

Open-source observability and audit trail platform for AI agents. MCP-native, tamper-evident event logging, real-time dashboard.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio agentkitai-agentlens npx @agentlensai/mcp \
  --env AGENTLENS_API_KEY="als_your_key_here" \
  --env AGENTLENS_API_URL="http://localhost:3400"

How to use

AgentLens provides an MCP-native server that exposes observability, auditing, and analytics capabilities for AI agents via the MCP protocol. You can run the MCP server and connect Claude Desktop, Cursor, or any MCP client to capture tool calls, sessions, events, and related analytics directly into AgentLens. Once connected, you’ll gain access to 12 MCP tools across core observability, intelligence & analytics, and operations, enabling real-time monitoring, session replay, cost tracking, health scoring, alerting, and benchmarking. The included MCP integration block shows a ready-to-use configuration block you can drop into your MCP client to connect to the local or remote AgentLens server.

When using the MCP server, you can leverage: (1) tool capture for tool invocations and session events, (2) queryable analytics to inspect LLM calls, prompts, costs, and latency, and (3) replay and alerting features to investigate and optimize agent behavior. This MCP server is designed to work alongside other AgentLens components (Python SDK, OpenClaw plugin, and the Python/TypeScript SDKs) to give you end-to-end observability across your agent stack.

To get started, configure your MCP client to point to the AgentLens MCP server, supply the necessary API URL and key if you’re protecting access, and begin sending your MCP tool calls and sessions. You’ll be able to browse sessions, view LLM analytics, monitor costs, and trigger alerts based on your defined rules.

How to install

Prerequisites:

  • Node.js and npm (for npx usage) or Docker for containerized runs
  • Internet access to fetch the MCP package when using npx

Option A: Quick start with npx (no local installation)

  1. Ensure Node.js and npm are installed on your machine.
  2. Run the MCP server via npx: npx @agentlensai/mcp
  3. If needed, specify a host/port via environment variables or defaults will apply.

Option B: Run via Docker (recommended for production setups)

  1. Install Docker and Docker Compose.
  2. Clone the repository or pull a prebuilt image (see your deployment docs).
  3. Configure environment variables in your docker-compose or environment file, including AGENTLENS_API_URL and AGENTLENS_API_KEY if your setup requires authentication.
  4. Start the container and expose the MCP port as configured in your setup.

Option C: Node.js server with npm package (alternative approach)

  1. Install locally: npm install -g @agentlensai/server
  2. Start the server: npx @agentlensai/server
  3. Access the server UI at http://localhost:3400 (default) and adjust environment variables as needed.

Additional notes

Tips and common considerations:

  • The MCP integration block for agentlens uses the nonce default name agentlens; adjust the key in your MCP client config if you rename the server instance.
  • Environment variables AGENTLENS_API_URL and AGENTLENS_API_KEY are required for secure access to the AgentLens API from MCP clients in production.
  • In Docker/production, consider enabling TLS and Stripe/auth features as described in the Quick Start for a hardened deployment.
  • The MCP server ships with 12 tools; refer to the full MCP tool reference to understand each tool’s capabilities and how to invoke them from your MCP client.
  • If you run locally without a UI, you can still push events and sessions to the server and query analytics via the API or embedded dashboard.
  • Ensure the MCP client is configured to use the correct base URL for the AgentLens API (e.g., http://localhost:3400) and that network access is allowed between the MCP client and AgentLens server.

Related MCP Servers

Sponsor this space

Reach thousands of developers