openpanel-mcp-server
# openpanel-mcp-server
[](https://www.npmjs.com/package/openpanel-mcp-server)
[](https://opensource.org/licenses/MIT)
MCP server for [OpenPanel](https://openpanel.dev) — the open-source analytics platform. Enables LLMs to track events, manage user profiles, and query analytics data.
Works with **self-hosted** and **cloud** OpenPanel instances.
## Quick Start
### Claude Desktop
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"openpanel": {
"command": "npx",
"args": ["-y", "openpanel-mcp-server"],
"env": {
"OPENPANEL_CLIENT_ID": "your-client-id",
"OPENPANEL_CLIENT_SECRET": "your-client-secret",
"OPENPANEL_API_URL": "https://your-domain.com/api"
}
}
}
}
```
### Claude Code
```bash
claude mcp add openpanel \
-e OPENPANEL_CLIENT_ID=your-client-id \
-e OPENPANEL_CLIENT_SECRET=your-client-secret \
-e OPENPANEL_API_URL=https://your-domain.com/api \
-- npx -y openpanel-mcp-server
```
### Other MCP Clients
```bash
npx openpanel-mcp-server
```
## Configuration
| Environment Variable | Required | Default | Description |
|---------------------|----------|---------|-------------|
| `OPENPANEL_CLIENT_ID` | Yes | — | Client ID from your OpenPanel project |
| `OPENPANEL_CLIENT_SECRET` | Yes | — | Client secret from your OpenPanel project |
| `OPENPANEL_API_URL` | No | `https://api.openpanel.dev` | API URL (set for self-hosted instances) |
Get credentials from your OpenPanel dashboard: **Settings → Projects → Select project → Create client (Root type)**.
## Tools
### Write Operations
| Tool | Description |
|------|-------------|
| `openpanel_track_event` | Track a custom analytics event with properties |
| `openpanel_identify_profile` | Create or update a user profile |
| `openpanel_increment_property` | Increment a numeric profile property |
| `openpanel_decrement_property` | Decrement a numeric profile property |
| `openpanel_alias_profile` | Link two profile IDs (e.g. anonymous → authenticated) |
### Read Operations
| Tool | Description |
|------|-------------|
| `openpanel_get_events` | Query events with filters, date ranges, and pagination |
| `openpanel_get_chart` | Aggregated analytics: metrics, trends, breakdowns, comparisons |
| `openpanel_health_check` | Verify OpenPanel instance connectivity |
## Usage Examples
**Track events:**
> "Track a purchase event for user-123 with amount 99.99 and currency USD"
**Query analytics:**
> "Show me page views for the last 7 days broken down by country"
**Get raw events:**
> "Get the last 20 signup events from this month"
**Chart with filters:**
> "Compare screen_view counts this week vs last week, broken down by browser"
## Development
```bash
git clone https://github.com/ubeytd/open-panel-mcp.git
cd open-panel-mcp
npm install
npm test # 42 tests
npm run build # compile TypeScript
npm run dev # watch mode
```
## Architecture
```
src/
├── index.ts # Entry point (stdio transport)
├── constants.ts # Config constants
├── types.ts # TypeScript interfaces
├── schemas/index.ts # Zod input validation
├── services/api-client.ts # OpenPanel HTTP client
├── tools/register.ts # MCP tool definitions
└── __tests__/ # Unit tests
```
- **Transport**: stdio
- **Auth**: `openpanel-client-id` + `openpanel-client-secret` headers
- **API**: OpenPanel public REST API (`/track`, `/export/events`, `/export/charts`, `/healthcheck`)
- **Validation**: Zod schemas with descriptive errors
- **Zero deps**: Uses native `fetch` (Node 18+), no axios/node-fetch
## License
MIT
TDQS
Scored across 8 tools
The main potential overlap is openpanel_get_chart (aggregated metrics) versus openpanel_get_events (raw event log), but the descriptions clearly distinguish aggregation from row-level retrieval. The increment/decrement pair and identify/alias pair are distinct enough, though increment/decrement could plausibly be a single signed operation.
Every tool uses the openpanel_ prefix followed by a consistent snake_case verb_noun pattern (track_event, identify_profile, get_chart, health_check). No mixing of conventions or casing.
Eight tools is well within the ideal 3-15 range, and each maps to a concrete analytics lifecycle operation (ingest, identify, mutate properties, alias, query, health). Nothing feels padded.
The surface covers the core analytics loop: event ingestion, profile creation/update, property mutation, identity merging, and both aggregated and raw querying. Gaps exist — no get_profile/delete_profile, no event or profile deletion, and no schema/event-name discovery — but these are minor workarounds rather than blockers.