Skip to main content
Glama
README.md
# mcp-dovetail

MCP server that connects [Claude Desktop](https://claude.ai/download) to [Dovetail](https://dovetail.com) — your user research platform. Query projects, insights, data, highlights, notes, and tags directly from Claude.

---

## Features

- **12 MCP tools** covering the full Dovetail read API
- Advanced filtering by date range, title, project, published status, and tags
- Markdown export for insights and data items — ready for Claude to read directly
- Read-only access by default — no write operations
- In-memory caching to reduce redundant API calls
- Automatic retries with exponential back-off on rate limits and server errors
- Structured logging to stderr (never to stdout, which is reserved for MCP protocol)
- API tokens are never logged

---

## Available Tools

### Projects

| Tool | Description |
|---|---|
| `dovetail_list_projects` | List all projects. Supports pagination, title filtering, and sorting |
| `dovetail_get_project` | Get a project by ID, optionally including its insights |

### Insights

| Tool | Description |
|---|---|
| `dovetail_list_personal_insights` | List insights scoped to a specific user's projects |
| `dovetail_get_insight_content` | Get the full content of an insight in markdown format |

### Data (notes & transcripts)

| Tool | Description |
|---|---|
| `dovetail_list_data` | List data items (notes, transcripts). Supports pagination, date range, title, and project filters |
| `dovetail_get_data` | Get a specific data item by ID |
| `dovetail_get_data_content` | Get the full content of a data item in markdown format |

### Highlights & Tags

| Tool | Description |
|---|---|
| `dovetail_get_highlights` | Get highlights, filtered by project or note |
| `dovetail_list_tags` | List all workspace tags with highlight counts |

### Search & Discovery

| Tool | Description |
|---|---|
| `dovetail_search` | Search across insights and data items by text query, project, and tags |
| `dovetail_get_item` | Get a single item by ID — resolves across insights, data, and notes |
| `dovetail_export_summary` | Export a full project summary: insights, data, highlights, and tag statistics |

### Filtering & Sorting

Most listing tools support a common set of parameters:

```
page:
  start_cursor   Cursor from a previous response (pagination)
  limit          Items per page, 1–100

filter:
  created_at:
    gt / gte     After this date (exclusive / inclusive)
    lt / lte     Before this date (exclusive / inclusive)
  project_id     Single ID or array of IDs
  title:
    contains     Substring match
    equal_to     Exact match
  published      Boolean (insights only)

sort              "property:direction" or array, e.g. "created_at:desc"
```

---

## Prerequisites

### 1. Node.js 22 or higher

Check your current version:

```bash
node --version
```

If you need to install or upgrade Node.js, use the [official installer](https://nodejs.org) or a version manager like [nvm](https://github.com/nvm-sh/nvm):

```bash
# With nvm
nvm install 22
nvm use 22
```

### 2. Claude Desktop

Download and install [Claude Desktop](https://claude.ai/download) for macOS or Windows.

### 3. Dovetail Personal API token

1. Log in to [Dovetail](https://dovetail.com)
2. Go to **Settings → Account**
3. Scroll to **Personal API keys**
4. Click **Generate new key** and copy the token — you will only see it once

---

## Installation

### Step 1 — Clone the repository

```bash
git clone https://github.com/your-org/mcp-dovetail.git
cd mcp-dovetail
```

### Step 2 — Install dependencies

```bash
npm install
```

### Step 3 — Configure your API token

The token is passed to the server via environment variables. There are two ways depending on the context:

**For Claude Desktop (recommended):** set the token directly in the Claude Desktop config file (see Step 5). No `.env` file needed.

**For local development only** (running the server manually, debugging):

```bash
cp .env.example .env
```

Open `.env` and set your token:

```env
DOVETAIL_API_TOKEN=your_dovetail_token_here
```

> `.env` is git-ignored and only loaded when running the server locally. When Claude Desktop launches the server it injects the token directly — `.env` is ignored.

### Step 4 — Build

```bash
npm run build
```

The compiled server will be output to `dist/index.js`.

### Step 5 — Connect to Claude Desktop

Open (or create) the Claude Desktop configuration file:

- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

Add the following block, replacing the path with the absolute path to your project:

```json
{
  "mcpServers": {
    "dovetail": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-dovetail/dist/index.js"],
      "env": {
        "DOVETAIL_API_TOKEN": "your_dovetail_token_here"
      }
    }
  }
}
```

To get the absolute path of your project:

```bash
pwd
# Example output: /Users/yourname/projects/mcp-dovetail
# → args would be: ["/Users/yourname/projects/mcp-dovetail/dist/index.js"]
```

### Step 6 — Restart Claude Desktop

Quit and reopen Claude Desktop. A hammer icon (🔨) in the interface confirms the MCP server is connected and active.

---

## Verify it works

Once connected, try asking Claude:

> "List my Dovetail projects"
> "Search Dovetail for insights about onboarding"
> "Show me the highlights from project X"
> "Get the full content of insight Y in markdown"
> "List all data items in project X created after 2024-01-01"
> "Show me all insights published by user Z"

---

## Configuration

### Environment Variables

| Variable | Required | Description |
|---|---|---|
| `DOVETAIL_API_TOKEN` | Yes | Dovetail Personal API token |
| `LOG_LEVEL` | No | `debug` \| `info` \| `warn` \| `error` (default: `info`) |

When running via Claude Desktop the token is injected through the `env` block in the config — no `.env` file is needed. The `.env` file is only a convenience for running the server locally during development.

---

## Development

```bash
# Type-check only
npm run typecheck

# Watch mode (rebuilds on save)
npm run dev

# Run tests
npm test

# Run tests with coverage
npm test -- --coverage
```

---

## Project Structure

```
src/
├── index.ts                    # MCP server entry point (registers all 12 tools)
├── logger.ts                   # Structured JSON logger to stderr
├── auth/
│   └── token.ts                # API token management
├── cache/
│   └── cache.ts                # TTL in-memory cache
├── dovetailClient/
│   ├── client.ts               # Dovetail REST API client (retries, timeouts, bracket-notation query builder)
│   └── types.ts                # TypeScript types for all Dovetail resources
├── normalizers/
│   ├── project.ts              # Project response normalizer
│   ├── insight.ts              # Insight response normalizer
│   ├── highlight.ts            # Highlight response normalizer
│   ├── data.ts                 # Data item response normalizer
│   └── tag.ts                  # Tag response normalizer
├── tools/
│   ├── shared.ts               # Shared Zod schemas (page, filter, sort)
│   ├── listProjects.ts         # dovetail_list_projects
│   ├── getProject.ts           # dovetail_get_project
│   ├── search.ts               # dovetail_search
│   ├── getItem.ts              # dovetail_get_item
│   ├── listTags.ts             # dovetail_list_tags
│   ├── getHighlights.ts        # dovetail_get_highlights
│   ├── exportSummary.ts        # dovetail_export_summary
│   ├── listData.ts             # dovetail_list_data
│   ├── getData.ts              # dovetail_get_data
│   ├── getInsightContent.ts    # dovetail_get_insight_content
│   ├── getDataContent.ts       # dovetail_get_data_content
│   └── listPersonalInsights.ts # dovetail_list_personal_insights
└── tests/
    ├── normalizers.test.ts
    ├── cache.test.ts
    └── token.test.ts
```

---

## Security

- **Read-only** — the server never writes to Dovetail
- **Token isolation** — the API token is only used to build the `Authorization` header; it is never logged or included in responses
- **Input validation** — all tool inputs are validated with Zod schemas before reaching the API
- **Rate limit handling** — automatic exponential back-off on 429 responses
- **No token in config files** — use environment variables or Claude Desktop's `env` block

---

## License

Apache 2.0