Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ Two entry points:
## Commands

```bash
bun install # Install dependencies
bun run build # TypeScript compilation (tsc)
bun run dev # Run locally via STDIO
bun run test # Run all tests (vitest)
bun run test:watch # Watch mode
bun run test -- __tests__/tools/get-timeseries.test.ts # Single test file
bun run deploy # Deploy to Cloudflare Workers (includes Sentry sourcemaps)
pnpm install # Install dependencies
pnpm build # TypeScript compilation (tsc)
pnpm dev # Run locally via STDIO (tsx)
pnpm test # Run all tests (vitest)
pnpm test:watch # Watch mode
pnpm test __tests__/tools/get-timeseries.test.ts # Single test file
pnpm deploy # Deploy to Cloudflare Workers (includes Sentry sourcemaps)

# LLM evals (requires ANTHROPIC_API_KEY)
ANTHROPIC_API_KEY=sk-... bun run eval
ANTHROPIC_API_KEY=sk-... pnpm eval

# Test with MCP Inspector
PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector bun run src/index.ts
pnpm build && PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector node dist/index.js
```

## Architecture
Expand Down
17 changes: 9 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Thanks for your interest in contributing!
```bash
git clone https://github.com/getsentry/plausible-mcp.git
cd plausible-mcp
bun install
pnpm install
```

## Running Tests

```bash
bun run test # All tests
bun run test:watch # Watch mode
bun run test:coverage # With coverage report
pnpm test # All tests
pnpm test:watch # Watch mode
pnpm test:coverage # With coverage report
```

Tests use [Vitest](https://vitest.dev) with mocked `fetch` — no Plausible account needed to run them.
Expand All @@ -34,17 +34,18 @@ Tests use [Vitest](https://vitest.dev) with mocked `fetch` — no Plausible acco
Requires an Anthropic API key:

```bash
ANTHROPIC_API_KEY=sk-... bun run eval
ANTHROPIC_API_KEY=sk-... pnpm eval
```

## Testing the MCP Server Locally

```bash
PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector bun run src/index.ts
pnpm build
PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector node dist/index.js
```

## Pull Requests

- Make sure `bun run test` passes
- Make sure `bun run build` compiles cleanly
- Make sure `pnpm test` passes
- Make sure `pnpm build` compiles cleanly
- Keep PRs focused — one feature or fix per PR
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ If you prefer to run it locally:
```bash
git clone https://github.com/getsentry/plausible-mcp.git
cd plausible-mcp
bun install
pnpm install
pnpm build
```

Add to Claude Code:

```bash
claude mcp add plausible -e PLAUSIBLE_API_KEY=your-key -- bun run src/index.ts
claude mcp add plausible -e PLAUSIBLE_API_KEY=your-key -- node /path/to/plausible-mcp/dist/index.js
```

Or Claude Desktop (`claude_desktop_config.json`):
Expand All @@ -67,8 +68,8 @@ Or Claude Desktop (`claude_desktop_config.json`):
{
"mcpServers": {
"plausible": {
"command": "bun",
"args": ["run", "/path/to/plausible-mcp/src/index.ts"],
"command": "node",
"args": ["/path/to/plausible-mcp/dist/index.js"],
"env": {
"PLAUSIBLE_API_KEY": "your-key"
}
Expand All @@ -84,7 +85,7 @@ Deploy your own instance:
```bash
git clone https://github.com/getsentry/plausible-mcp.git
cd plausible-mcp
bun install
pnpm install
npx wrangler deploy
```

Expand Down Expand Up @@ -115,24 +116,25 @@ This server wraps the [Plausible Stats API v2](https://plausible.io/docs/stats-a
## Development

```bash
bun install
bun run build # TypeScript compilation
bun run test # Run 53 unit + integration tests
bun run test:watch # Watch mode
pnpm install
pnpm build # TypeScript compilation
pnpm test # Run unit + integration tests
pnpm test:watch # Watch mode
```

### Testing with MCP Inspector

```bash
PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector bun run src/index.ts
pnpm build
PLAUSIBLE_API_KEY=your-key npx @modelcontextprotocol/inspector node dist/index.js
```

### LLM Evals

Verifies Claude picks the right tool for natural language analytics questions:

```bash
ANTHROPIC_API_KEY=sk-... bun run eval
ANTHROPIC_API_KEY=sk-... pnpm eval
```

## Architecture
Expand Down
585 changes: 0 additions & 585 deletions bun.lock

This file was deleted.

4 changes: 2 additions & 2 deletions evals/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bun
#!/usr/bin/env tsx

import Anthropic from "@anthropic-ai/sdk";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
Expand All @@ -9,7 +9,7 @@ import { cases } from "./cases.js";
const apiKey = process.env.ANTHROPIC_API_KEY;
if (!apiKey) {
console.error("ANTHROPIC_API_KEY is required to run evals.");
console.error("Usage: ANTHROPIC_API_KEY=sk-... bun run eval");
console.error("Usage: ANTHROPIC_API_KEY=sk-... pnpm eval");
process.exit(1);
}

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
"plausible-mcp": "./dist/index.js"
},
"main": "./dist/index.js",
"packageManager": "pnpm@11.1.3",
"scripts": {
"build": "bun run tsc",
"dev": "bun run src/index.ts",
"start": "bun run dist/index.js",
"build": "tsc",
"dev": "tsx src/index.ts",
"start": "node dist/index.js",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"eval": "bun run evals/run.ts",
"eval": "tsx evals/run.ts",
"deploy": "SENTRY_RELEASE=$(node -p \"require('./package.json').version\") && npx wrangler deploy --outdir .sentry-build --var SENTRY_RELEASE:$SENTRY_RELEASE && npx sentry-cli releases new $SENTRY_RELEASE --org sentry-developer-experience --project plausible-mcp && npx sentry-cli sourcemaps upload --org sentry-developer-experience --project plausible-mcp --release $SENTRY_RELEASE .sentry-build && rm -rf .sentry-build"
},
"keywords": [
Expand All @@ -34,7 +35,8 @@
"devDependencies": {
"@anthropic-ai/sdk": "^0.39.0",
"@sentry/cli": "^2",
"@types/bun": "latest",
"@types/node": "^22.0.0",
"tsx": "^4.19.0",
"typescript": "^5.7.0",
"vitest": "^3.0.0"
}
Expand Down
Loading
Loading