lcontext-mcp 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +227 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1084 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 lcontext
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# lcontext
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.npmjs.com/package/lcontext-mcp)
|
|
5
|
+
|
|
6
|
+
MCP (Model Context Protocol) server for [lcontext](https://lcontext.com) analytics. Provides comprehensive analytics context for Claude, including page metrics, visitor profiles, session data, and AI-generated insights.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Quick Install (Recommended)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
curl -fsSL https://lcontext.com/install.sh | bash
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This downloads a standalone binary - no Node.js required.
|
|
17
|
+
|
|
18
|
+
### Manual Download
|
|
19
|
+
|
|
20
|
+
Download the binary for your platform from the [latest release](https://github.com/evan-kyr/lcontext/releases/latest):
|
|
21
|
+
|
|
22
|
+
| Platform | Binary |
|
|
23
|
+
|----------|--------|
|
|
24
|
+
| macOS (Apple Silicon) | `lcontext-macos-arm64` |
|
|
25
|
+
| macOS (Intel) | `lcontext-macos-x64` |
|
|
26
|
+
| Linux (x64) | `lcontext-linux-x64` |
|
|
27
|
+
| Linux (ARM64) | `lcontext-linux-arm64` |
|
|
28
|
+
| Windows (x64) | `lcontext-windows-x64.exe` |
|
|
29
|
+
|
|
30
|
+
### Via npm
|
|
31
|
+
|
|
32
|
+
If you have Node.js installed:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g lcontext-mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### From Source
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/evan-kyr/lcontext.git
|
|
42
|
+
cd lcontext
|
|
43
|
+
npm install
|
|
44
|
+
npm run build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
### 1. Get Your API Key
|
|
50
|
+
|
|
51
|
+
Sign up at [lcontext.com](https://lcontext.com) and find your API key in **Settings > API Access**.
|
|
52
|
+
|
|
53
|
+
### 2. Configure Claude Code
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
claude mcp add lcontext -e LCONTEXT_API_KEY=your-api-key -- lcontext
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Configure Claude Desktop
|
|
60
|
+
|
|
61
|
+
Edit your Claude Desktop config file:
|
|
62
|
+
|
|
63
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
64
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
65
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"lcontext": {
|
|
71
|
+
"command": "lcontext",
|
|
72
|
+
"env": {
|
|
73
|
+
"LCONTEXT_API_KEY": "your-api-key-here"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then restart Claude.
|
|
81
|
+
|
|
82
|
+
## Available Tools
|
|
83
|
+
|
|
84
|
+
### `get_page_context`
|
|
85
|
+
|
|
86
|
+
Get comprehensive analytics context for a page including stats, visitor metrics, and all interactive elements with their engagement data.
|
|
87
|
+
|
|
88
|
+
**Parameters:**
|
|
89
|
+
- `path` (required): The page path (e.g., `/products`, `/checkout`)
|
|
90
|
+
- `startDate` (optional): Start date for stats (ISO format)
|
|
91
|
+
- `endDate` (optional): End date for stats (ISO format)
|
|
92
|
+
- `periodType` (optional): `day` or `week` (default: `day`)
|
|
93
|
+
|
|
94
|
+
**Example:**
|
|
95
|
+
```
|
|
96
|
+
Get the analytics context for the /checkout page for the last 7 days
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `list_pages`
|
|
100
|
+
|
|
101
|
+
List all tracked pages for your website.
|
|
102
|
+
|
|
103
|
+
**Parameters:**
|
|
104
|
+
- `limit` (optional): Maximum pages to return (default: 50, max: 200)
|
|
105
|
+
- `search` (optional): Filter by path (e.g., `/product`)
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
```
|
|
109
|
+
What pages are being tracked on my website?
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `get_element_context`
|
|
113
|
+
|
|
114
|
+
Get detailed analytics for a specific interactive element by its label or ID.
|
|
115
|
+
|
|
116
|
+
**Parameters:**
|
|
117
|
+
- `elementLabel` (optional): Element's label text or aria-label
|
|
118
|
+
- `elementId` (optional): Element's HTML ID
|
|
119
|
+
- `pagePath` (optional): Filter by page path
|
|
120
|
+
|
|
121
|
+
**Example:**
|
|
122
|
+
```
|
|
123
|
+
Show me analytics for the "Add to Cart" button
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `get_app_context`
|
|
127
|
+
|
|
128
|
+
Get application-wide analytics including total sessions, visitors, page views, engagement metrics, and AI-generated insights.
|
|
129
|
+
|
|
130
|
+
**Parameters:**
|
|
131
|
+
- `periodType` (optional): `day` or `week` (default: `day`)
|
|
132
|
+
- `limit` (optional): Number of periods to return (default: 7, max: 30)
|
|
133
|
+
|
|
134
|
+
**Example:**
|
|
135
|
+
```
|
|
136
|
+
Give me an overview of my app's analytics for the last week
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `get_visitors`
|
|
140
|
+
|
|
141
|
+
Get a list of visitors with AI-generated profiles, interests, engagement trends, and segment assignments.
|
|
142
|
+
|
|
143
|
+
**Parameters:**
|
|
144
|
+
- `limit` (optional): Maximum visitors to return (default: 20, max: 100)
|
|
145
|
+
- `offset` (optional): Offset for pagination
|
|
146
|
+
- `segmentId` (optional): Filter by segment ID
|
|
147
|
+
- `search` (optional): Search in visitor ID, title, summary, interests, goals, action, evidence
|
|
148
|
+
- `firstVisitAfter` (optional): Filter by first visit date (ISO format)
|
|
149
|
+
- `firstVisitBefore` (optional): Filter by first visit date (ISO format)
|
|
150
|
+
- `lastVisitAfter` (optional): Filter by last visit date (ISO format)
|
|
151
|
+
- `lastVisitBefore` (optional): Filter by last visit date (ISO format)
|
|
152
|
+
- `engagementTrend` (optional): `increasing`, `stable`, or `decreasing`
|
|
153
|
+
- `overallSentiment` (optional): `positive`, `negative`, `neutral`, or `mixed`
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
```
|
|
157
|
+
Show me visitors with increasing engagement trend
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `get_visitor_detail`
|
|
161
|
+
|
|
162
|
+
Get detailed profile and recent sessions for a specific visitor.
|
|
163
|
+
|
|
164
|
+
**Parameters:**
|
|
165
|
+
- `visitorId` (required): The visitor's unique identifier
|
|
166
|
+
|
|
167
|
+
**Example:**
|
|
168
|
+
```
|
|
169
|
+
Get the full profile for visitor abc123
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `get_sessions`
|
|
173
|
+
|
|
174
|
+
Get a list of user sessions with AI-generated summaries, titles, and sentiment analysis.
|
|
175
|
+
|
|
176
|
+
**Parameters:**
|
|
177
|
+
- `limit` (optional): Maximum sessions to return (default: 20, max: 100)
|
|
178
|
+
- `offset` (optional): Offset for pagination
|
|
179
|
+
- `visitorId` (optional): Filter by visitor ID
|
|
180
|
+
- `sentiment` (optional): `positive`, `negative`, or `neutral`
|
|
181
|
+
- `startDate` (optional): Start date for filtering (ISO format)
|
|
182
|
+
- `endDate` (optional): End date for filtering (ISO format)
|
|
183
|
+
- `search` (optional): Search in session title and description
|
|
184
|
+
- `minDuration` (optional): Minimum session duration in seconds
|
|
185
|
+
- `maxDuration` (optional): Maximum session duration in seconds
|
|
186
|
+
- `minEventsCount` (optional): Minimum number of events
|
|
187
|
+
- `maxEventsCount` (optional): Maximum number of events
|
|
188
|
+
|
|
189
|
+
**Example:**
|
|
190
|
+
```
|
|
191
|
+
Show me negative sentiment sessions from the last 24 hours
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### `get_session_detail`
|
|
195
|
+
|
|
196
|
+
Get detailed information about a specific session including full event data and visitor context.
|
|
197
|
+
|
|
198
|
+
**Parameters:**
|
|
199
|
+
- `sessionId` (required): The session's numeric ID
|
|
200
|
+
|
|
201
|
+
**Example:**
|
|
202
|
+
```
|
|
203
|
+
Show me the details of session 12345
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Updating
|
|
207
|
+
|
|
208
|
+
The binary includes a self-update command:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
lcontext --update
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Environment Variables
|
|
215
|
+
|
|
216
|
+
| Variable | Description | Required |
|
|
217
|
+
|----------|-------------|----------|
|
|
218
|
+
| `LCONTEXT_API_KEY` | Your lcontext API key | Yes |
|
|
219
|
+
| `LCONTEXT_API_URL` | API base URL (default: https://lcontext.com) | No |
|
|
220
|
+
|
|
221
|
+
## Contributing
|
|
222
|
+
|
|
223
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and build instructions.
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT - see [LICENSE](LICENSE) for details.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* lcontext MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Provides page and element analytics context for Claude Code.
|
|
6
|
+
* Requires authentication via LCONTEXT_API_KEY environment variable only.
|
|
7
|
+
*
|
|
8
|
+
* Tools:
|
|
9
|
+
* - get_page_context: Get page analytics, stats, and related elements for a given path and time range
|
|
10
|
+
* - list_pages: List all tracked pages for the authenticated website
|
|
11
|
+
* - get_element_context: Get detailed analytics for a specific element
|
|
12
|
+
* - get_app_context: Get application-wide analytics including sessions, visitors, and AI insights
|
|
13
|
+
* - get_visitors: Get visitors list with AI-generated profiles and segment assignments
|
|
14
|
+
* - get_visitor_detail: Get detailed profile and sessions for a specific visitor
|
|
15
|
+
* - get_sessions: Get sessions list with AI summaries and sentiment analysis
|
|
16
|
+
* - get_session_detail: Get detailed session info including events and visitor context
|
|
17
|
+
*/
|
|
18
|
+
export {};
|