{
  "markdown": "# Lcontext\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://img.shields.io/npm/v/lcontext-mcp.svg)](https://www.npmjs.com/package/lcontext-mcp)\n\nThe product analytics agent for your AI coding tools. Lcontext studies how users navigate your product, where they engage, hesitate, and drop off, and delivers behavioral context via MCP.\n\n**Works with:** Claude Code, Claude Desktop, Cursor, Windsurf, Cline, and any MCP-compatible AI coding tool.\n\n## Quick Setup\n\nThe fastest way to get started -- sign up, configure your agent, and get your tracking script in one command:\n\n```bash\nnpx lcontext-mcp@latest setup\n```\n\nOr using the standalone installer (no Node required):\n\n```bash\ncurl -fsSL https://lcontext.com/api/cli/install | bash\n```\n\nBoth will open your browser to sign up (or log in), configure your coding agent, and print the tracking script to add to your app.\n\n### Manual Setup\n\nIf you prefer to set things up manually:\n\n1. Create a free account at [lcontext.com](https://lcontext.com)\n2. Add the tracking script to your app (find your tag in the dashboard):\n\n```html\n<script src=\"https://lcontext.com/it.js?iTag=YOUR_SITE_TAG\" defer></script>\n```\n\n3. Connect your coding agent (see below)\n\n<details>\n<summary><b>What the tracker collects</b></summary>\n\n- **Page views** - URL, title, referrer\n- **Clicks** - Buttons, links, interactive elements (label text only, no personal data)\n- **Form submissions** - Form metadata (no field values captured)\n- **Scroll depth** - How far users scroll (25% increments)\n- **Device metadata** - Screen size, browser language, viewport\n\n**Privacy-focused:** No passwords, input values, or personal information collected. ~4KB minified.\n\n</details>\n\n<details>\n<summary><b>Advanced: Link to your user IDs</b></summary>\n\nAssociate the anonymous visitor with your application's user ID:\n\n```javascript\nlcontext('setProfileId', 'user-123');\n```\n\nTrack custom events:\n\n```javascript\nlcontext('trackEvent', 'purchase', { productId: 'abc', amount: 99.99 });\n```\n\n</details>\n\n### Agent Configuration\n\n<details open>\n<summary><b>Claude Code / Claude Desktop</b></summary>\n\n```bash\nclaude mcp add lcontext -s user -e LCONTEXT_API_KEY=your-api-key -- npx -y lcontext-mcp@latest\n```\n\nThen restart Claude.\n\n</details>\n\n<details>\n<summary><b>Cursor</b></summary>\n\n**Option 1: One-Click Install**\n\n[Install Lcontext in Cursor](https://cursor.com/install-mcp?name=lcontext&config=eyJjb21tYW5kIjoibGNvbnRleHQiLCJlbnYiOnsiTENPTlRFWFRfQVBJX0tFWSI6InlvdXItYXBpLWtleS1oZXJlIn19)\n\nAfter clicking, replace `your-api-key-here` with your actual API key in Cursor settings.\n\n**Option 2: Manual Setup**\n\nFirst, install the binary:\n```bash\ncurl -fsSL https://lcontext.com/api/cli/install | bash\n```\n\nThen open Cursor Settings (`Cmd/Ctrl + Shift + J`), and add the server:\n\n```json\n{\n  \"lcontext\": {\n    \"command\": \"lcontext\",\n    \"env\": {\n      \"LCONTEXT_API_KEY\": \"your-api-key-here\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Windsurf</b></summary>\n\nFirst, install the binary:\n```bash\ncurl -fsSL https://lcontext.com/api/cli/install | bash\n```\n\nThen open Windsurf and navigate to **Cascade > Configure > MCP Servers** (or click the hammer icon), then click \"Add Server\" and select \"Add custom server\". Add this configuration:\n\n```json\n{\n  \"lcontext\": {\n    \"command\": \"lcontext\",\n    \"env\": {\n      \"LCONTEXT_API_KEY\": \"your-api-key-here\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Cline (VS Code Extension)</b></summary>\n\nFirst, install the binary:\n```bash\ncurl -fsSL https://lcontext.com/api/cli/install | bash\n```\n\nThen in VS Code with Cline installed:\n1. Open Cline settings (click gear icon in Cline panel)\n2. Navigate to **MCP Servers** section\n3. Add a new server:\n\n```json\n{\n  \"lcontext\": {\n    \"command\": \"lcontext\",\n    \"env\": {\n      \"LCONTEXT_API_KEY\": \"your-api-key-here\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Other MCP-Compatible Tools</b></summary>\n\nFirst, install the binary:\n```bash\ncurl -fsSL https://lcontext.com/api/cli/install | bash\n```\n\nLcontext works with any tool that supports the Model Context Protocol. The general configuration pattern is:\n\n- **Command:** `lcontext`\n- **Environment Variable:** `LCONTEXT_API_KEY=your-api-key-here`\n\nRefer to your tool's documentation for MCP server configuration.\n\n</details>\n\n## Alternative Installation Methods\n\nThe install script used above (`curl -fsSL https://lcontext.com/api/cli/install | bash`) is the recommended approach. If you need an alternative:\n\n<details>\n<summary><b>Manual Download</b></summary>\n\nDownload the binary for your platform from the [latest release](https://github.com/Lcontext/Lcontext/releases/latest):\n\n| Platform | Binary |\n|----------|--------|\n| macOS (Apple Silicon) | `lcontext-macos-arm64` |\n| macOS (Intel) | `lcontext-macos-x64` |\n| Linux (x64) | `lcontext-linux-x64` |\n| Linux (ARM64) | `lcontext-linux-arm64` |\n| Windows (x64) | `lcontext-windows-x64.exe` |\n\n</details>\n\n<details>\n<summary><b>Via npm</b></summary>\n\nIf you have Node.js installed:\n\n```bash\nnpm install -g lcontext-mcp\n```\n\n</details>\n\n<details>\n<summary><b>From Source</b></summary>\n\n```bash\ngit clone https://github.com/lcontext/lcontext.git\ncd lcontext\nnpm install\nnpm run build\n```\n\n</details>\n\n## Available Tools\n\n### `get_page_context`\n\nGet comprehensive analytics context for a page including stats, visitor metrics, Web Vitals (LCP, FCP, FID, CLS), and all interactive elements with their engagement data.\n\n**Parameters:**\n- `path` (required): The page path (e.g., `/products`, `/checkout`)\n- `startDate` (optional): Start date for stats (ISO format)\n- `endDate` (optional): End date for stats (ISO format)\n- `periodType` (optional): `day` or `week` (default: `day`)\n\n**Example:**\n```\nGet the analytics context for the /checkout page for the last 7 days\n```\n\n### `list_pages`\n\nList all tracked pages for your app.\n\n**Parameters:**\n- `limit` (optional): Maximum pages to return (default: 50, max: 200)\n- `search` (optional): Filter by path (e.g., `/product`)\n\n**Example:**\n```\nWhat pages are being tracked on my app?\n```\n\n### `get_element_context`\n\nGet detailed analytics for a specific interactive element by its label or ID.\n\n**Parameters:**\n- `elementLabel` (optional): Element's label text or aria-label\n- `elementId` (optional): Element's HTML ID\n- `pagePath` (optional): Filter by page path\n\n**Example:**\n```\nShow me analytics for the \"Add to Cart\" button\n```\n\n### `get_app_context`\n\nGet application-wide analytics including sessions, visitors, page views, engagement metrics, device breakdown (mobile/tablet/desktop), top browsers, top OS, Web Vitals (LCP, FCP, FID, CLS), and AI-generated insights.\n\n**Parameters:**\n- `periodType` (optional): `day` or `week` (default: `day`)\n- `limit` (optional): Number of periods to return (default: 7, max: 30)\n\n**Example:**\n```\nGive me an overview of my app's behavioral analytics for the last week\n```\n\n### `get_visitors`\n\nGet a list of visitors with AI-generated profiles, interests, engagement trends, segment assignments, device info (type, browser, OS), and location (city, region, country).\n\n**Parameters:**\n- `limit` (optional): Maximum visitors to return (default: 20, max: 100)\n- `offset` (optional): Offset for pagination\n- `segmentId` (optional): Filter by segment ID\n- `search` (optional): Search in visitor ID, title, summary, interests, goals, action, evidence\n- `firstVisitAfter` (optional): Filter by first visit date (ISO format)\n- `firstVisitBefore` (optional): Filter by first visit date (ISO format)\n- `lastVisitAfter` (optional): Filter by last visit date (ISO format)\n- `lastVisitBefore` (optional): Filter by last visit date (ISO format)\n- `engagementTrend` (optional): `increasing`, `stable`, or `decreasing`\n- `overallSentiment` (optional): `positive`, `negative`, `neutral`, or `mixed`\n\n**Example:**\n```\nShow me visitors with increasing engagement trend\n```\n\n### `get_visitor_detail`\n\nGet detailed profile and recent sessions for a specific visitor, including device info (type, browser, OS) and location.\n\n**Parameters:**\n- `visitorId` (required): The visitor's unique identifier\n\n**Example:**\n```\nGet the full profile for visitor abc123\n```\n\n### `get_sessions`\n\nGet a list of user sessions with AI-generated summaries, titles, sentiment analysis, and device type.\n\n**Parameters:**\n- `limit` (optional): Maximum sessions to return (default: 20, max: 100)\n- `offset` (optional): Offset for pagination\n- `visitorId` (optional): Filter by visitor ID\n- `sentiment` (optional): `positive`, `negative`, or `neutral`\n- `startDate` (optional): Start date for filtering (ISO format)\n- `endDate` (optional): End date for filtering (ISO format)\n- `search` (optional): Search in session title and description\n- `minDuration` (optional): Minimum session duration in seconds\n- `maxDuration` (optional): Maximum session duration in seconds\n- `minEventsCount` (optional): Minimum number of events\n- `maxEventsCount` (optional): Maximum number of events\n- `pagePath` (optional): Filter sessions that visited a specific page path\n\n**Example:**\n```\nShow me negative sentiment sessions from the last 24 hours\n```\n\n### `get_session_detail`\n\nGet detailed information about a specific session including full event timeline, visitor context, device type, and location (city, region, country).\n\n**Parameters:**\n- `sessionId` (required): The session's numeric ID\n\n**Example:**\n```\nShow me the details of session 12345\n```\n\n### `get_user_flows`\n\nGet automatically detected user journey patterns showing how users navigate through the application. Each flow represents a common page sequence with engagement metrics and drop-off points.\n\n**Parameters:**\n- `limit` (optional): Maximum flows to return (default: 10, max: 50)\n- `category` (optional): Filter by category: `conversion`, `exploration`, `onboarding`, `support`, `engagement`, `other`\n- `minSessions` (optional): Minimum session count for a flow to be included\n- `periodType` (optional): `day` for daily flows, `week` for weekly aggregated flows\n\n**Example:**\n```\nShow me the most common user journeys on my app\n```\n\n### `get_analysis`\n\nGet a pre-computed daily or weekly analysis report. Contains problem areas, funnel health, session findings, and prioritized recommendations — all referencing specific page paths, element IDs, and session IDs you can investigate with other tools.\n\n**Parameters:**\n- `periodType` (optional): `day` for daily report (default), `week` for weekly report\n- `date` (optional): ISO date string for the period start (e.g., `2026-02-23`). Defaults to most recent completed analysis.\n\n**Example:**\n```\nGet the latest daily analysis for my app\n```\n\n## Prompts\n\n### `analytics-guide`\n\nA comprehensive guide for analyzing user behavior data with Lcontext tools. Includes step-by-step analysis workflows, decision trees for common scenarios (e.g., \"this page isn't converting\", \"performance feels slow\"), and a reference table connecting analytics findings to code investigations.\n\nAI agents can request this prompt to get expert-level guidance on how to use the tools effectively.\n\n## Updating\n\nThe binary includes a self-update command:\n\n```bash\nlcontext --update\n```\n\n## Environment Variables\n\n| Variable | Description | Required |\n|----------|-------------|----------|\n| `LCONTEXT_API_KEY` | Your Lcontext API key | Yes |\n| `LCONTEXT_API_URL` | API base URL (default: https://lcontext.com) | No |\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and build instructions.\n\n## License\n\nMIT - see [LICENSE](LICENSE) for details.\n",
  "bytes": 11591,
  "sha": "a7b50370221dc99a66a5d390af54a4334e8c3471f4933a6dc71ecf8d62fc9cdd",
  "repo_slug": "lcontext/lcontext",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_lcontext_lcontext_lcontext_a6ba6ff7/readme"
}