Skip to main content
Glama
README.md
# @heptabase/mcp

A Model Context Protocol (MCP) service for interacting with Heptabase backup data. This service allows AI assistants like Claude to search, retrieve, analyze, and export Heptabase whiteboards and cards.

## Features

- šŸ” Search whiteboards and cards
- šŸ“ Automatic backup file management
- šŸ“„ Export to multiple formats (Markdown, JSON, Mermaid)
- šŸ”— Analyze card relationships
- šŸ“Š Generate whiteboard summaries
- ⚔ Smart caching for performance

## Quick Start

### Installation and Setup

1. **Clone and install:**
   ```bash
   git clone <repository-url>
   cd heptabase-mcp
   npm install
   ```

2. **Configure using environment variables:**
   ```bash
   cp .env.example .env
   # Edit .env with your actual paths
   ```

3. **Build the project:**
   ```bash
   npm run build
   ```

4. **Test locally (optional):**
   ```bash
   npm start
   ```

### Using with Claude Desktop

Configure Claude Desktop to use your local build:

**Edit your Claude Desktop config file:**
- **macOS**: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

**Add this configuration:**
```json
{
  "mcpServers": {
    "heptabase": {
      "command": "/path/to/node",
      "args": ["/path/to/your/heptabase-mcp/dist/index.js"],
      "env": {
        "HEPTABASE_BACKUP_PATH": "/path/to/your/heptabase/backups",
        "HEPTABASE_AUTO_EXTRACT": "true",
        "HEPTABASE_WATCH_DIRECTORY": "true"
      }
    }
  }
}
```

**Important:** 
- Replace `/path/to/node` with your Node.js path (find with `which node`)
- Replace `/path/to/your/heptabase-mcp` with your actual project path
- Set `HEPTABASE_BACKUP_PATH` to your Heptabase backup directory

See [QUICK_START.md](./QUICK_START.md) for detailed setup instructions.

### Configuration

This project uses a privacy-safe configuration system:

- **Example files** (safe for git): `claude-config-example.json`, `.env.example`
- **Personal files** (gitignored): `claude-config-*personal*.json`, `.env`

See [CONFIG.md](./CONFIG.md) for detailed configuration instructions.

### Basic Usage

```typescript
// Configure backup path
await mcpClient.callTool({
  name: "configureBackupPath",
  parameters: {
    path: "/path/to/your/heptabase/backups"
  }
});

// List available backups
const backups = await mcpClient.callTool({
  name: "listBackups"
});

// Search for whiteboards
const whiteboards = await mcpClient.callTool({
  name: "searchWhiteboards",
  parameters: {
    query: "Project Planning"
  }
});

// Get full whiteboard content
const whiteboard = await mcpClient.callTool({
  name: "getWhiteboard",
  parameters: {
    whiteboardId: "your-whiteboard-id",
    includeCards: true,
    includeConnections: true
  }
});

// Export to markdown
const markdown = await mcpClient.callTool({
  name: "exportWhiteboard",
  parameters: {
    whiteboardId: "your-whiteboard-id",
    format: "markdown"
  }
});
```

## Available Tools

### Backup Management
- `configureBackupPath` - Set backup directory
- `listBackups` - List available backups
- `loadBackup` - Load a specific backup

### Search Operations
- `searchWhiteboards` - Search whiteboards by name or content
- `searchCards` - Search cards across all whiteboards

### Data Retrieval
- `getWhiteboard` - Get complete whiteboard data
- `getCard` - Get card content in multiple formats
- `getCardContent` - Get card content as resource (bypasses size limits)
- `getCardsByArea` - Find cards by position on whiteboard

### Export Functions
- `exportWhiteboard` - Export to Markdown, JSON, HTML formats
- `summarizeWhiteboard` - Generate AI-powered summaries

### Analysis Tools
- `analyzeGraph` - Analyze card relationships and connections
- `compareBackups` - Compare different backup versions

### Debug Tools
- `debugInfo` - Get system status and diagnostics

## Development

### Project Structure

```
heptabase-mcp/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts              # Main entry point
│   ā”œā”€ā”€ server.ts             # MCP server implementation
│   ā”œā”€ā”€ services/             # Core business logic
│   │   ā”œā”€ā”€ BackupManager.ts  # Backup file management
│   │   └── HeptabaseDataService.ts # Data querying
│   ā”œā”€ā”€ tools/                # MCP tool implementations
│   ā”œā”€ā”€ types/                # TypeScript definitions
│   └── utils/                # Helper functions
ā”œā”€ā”€ tests/                    # Test suites
ā”œā”€ā”€ docs/                     # Documentation
└── config files              # Configuration templates
```

### Testing

```bash
# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run with coverage
npm run test:coverage

# Run integration tests
npm run test:integration
```

### Building

```bash
# Build for production
npm run build

# Development mode with auto-reload
npm run dev

# Type checking only
npm run type-check
```

## Documentation

- [šŸ“š Complete Specification](./SPECIFICATION.md) - Detailed API and architecture
- [šŸš€ Quick Start Guide](./QUICK_START.md) - Get up and running fast
- [āš™ļø Configuration Guide](./CONFIG.md) - Safe configuration practices
- [šŸ“– Claude Desktop Setup](./claude-desktop-setup.md) - Local development setup

## Privacy & Security

This project follows privacy-by-design principles:

- āœ… Personal paths are never committed to git
- āœ… Backup data stays local on your machine
- āœ… Configuration templates use safe placeholders
- āœ… Gitignore protects sensitive files

## Requirements

- **Node.js** 18+ 
- **Heptabase** with backup exports enabled
- **Claude Desktop** (for MCP integration)

## Troubleshooting

### Common Issues

- **"No backups found"** - Check your `HEPTABASE_BACKUP_PATH` points to the correct directory
- **"Command not found"** - Ensure Node.js is installed and paths are correct
- **Claude doesn't see tools** - Restart Claude Desktop completely after config changes
- **Build errors** - Run `npm install` and `npm run build` before using

### Debug Mode

Use the `debugInfo` tool to check system status:
```typescript
await mcpClient.callTool({ name: "debugInfo" });
```

## Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request

See [SPECIFICATION.md](./SPECIFICATION.md) for architecture details.

## License

MIT License - see [LICENSE](./LICENSE) file for details.

## Support

- šŸ› **Bug reports**: [GitHub Issues](https://github.com/yourusername/heptabase-mcp/issues)
- šŸ’¬ **Questions**: [GitHub Discussions](https://github.com/yourusername/heptabase-mcp/discussions)
- šŸ“§ **Security issues**: Please report privately

---

Made with ā¤ļø for the Heptabase community

TDQS

D1.6/5.0

Scored across 14 tools

Disambiguation3/5

The tools cover distinct domains like cards, whiteboards, and backups, but some overlap exists within domains. For example, getCard and getCardContent could be confused for retrieving card information, and searchCards/getCardsByArea might have unclear boundaries for finding cards. However, the domains themselves are well-separated, preventing major misselection.

Naming Consistency2/5

Naming is inconsistent with mixed conventions: camelCase (e.g., analyzeGraph, debugInfo) and snake_case (e.g., get_card_content, list_backups) are both used, and verb styles vary (e.g., 'configure' vs. 'load' vs. 'get'). This lack of a predictable pattern makes the set harder to navigate and less coherent.

Tool Count4/5

With 14 tools, the count is reasonable for a note-taking or knowledge management server like Heptabase, covering cards, whiteboards, backups, and analysis. It's slightly on the higher side but well-scoped, as each tool appears to serve a distinct function without obvious bloat.

Completeness3/5

The server shows notable gaps in coverage. For cards and whiteboards, there are read/search tools but no create, update, or delete operations, which are essential for a full CRUD lifecycle. Backup tools are more complete, but the core domain lacks write capabilities, potentially causing agent failures in workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues