GitHub - dolthub/dolt-mcp: The MCP server for Dolt (original) (raw)

Dolt MCP Server

A Model Context Protocol (MCP) server that provides AI assistants with direct access to Dolt databases. This server enables AI tools like Claude to interact with Dolt's version-controlled SQL databases, allowing for database operations, version control workflows, and data management tasks.

Overview

The Dolt MCP Server acts as a bridge between AI assistants and Dolt databases, exposing a comprehensive set of tools for:

Installation

Prerequisites

Building from Source

git clone https://github.com/dolthub/dolt-mcp cd dolt-mcp go build -o dolt-mcp-server ./mcp/cmd/dolt-mcp-server

Docker Installation

Pull the official Docker image:

docker pull dolthub/dolt-mcp:latest

Usage

The Dolt MCP Server can run in two modes and supports multiple deployment methods:

HTTP Server with Docker

docker run -d
--name dolt-mcp-server
-p 8080:8080
-e MCP_MODE=http
-e DOLT_HOST=your-dolt-host
-e DOLT_USER=root
-e DOLT_DATABASE=your_database
-e DOLT_PASSWORD=your_password
dolthub/dolt-mcp:latest

Stdio Server with Docker

docker run -it --rm
-e MCP_MODE=stdio
-e DOLT_HOST=your-dolt-host
-e DOLT_USER=root
-e DOLT_DATABASE=your_database
-e DOLT_PASSWORD=your_password
dolthub/dolt-mcp:latest

Native Binary Usage

The stdio server communicates over standard input/output, making it ideal for integration with AI assistants like Claude Desktop.

./dolt-mcp-server
--stdio
--dolt-host 0.0.0.0
--dolt-port 3306
--dolt-user root
--dolt-database mydb

Claude Desktop Configuration

Add this configuration to your Claude Desktop MCP settings:

{ "mcpServers": { "dolt-mcp": { "command": "/path/to/dolt-mcp-server", "args": [ "--stdio", "--dolt-host", "0.0.0.0", "--dolt-port", "3306", "--dolt-user", "root", "--dolt-database", "your_database_name" ], "env": { "DOLT_PASSWORD": "your_password_if_needed" } } } }

2. HTTP Server

The HTTP server exposes a REST API for MCP tool calls, useful for web applications and custom integrations.

./dolt-mcp-server
--http
--mcp-port 8080
--dolt-host 0.0.0.0
--dolt-port 3306
--dolt-user root
--dolt-database mydb

Configuration Options

Required Parameters

Optional Parameters

Environment Variables

Docker Environment Variables

When using Docker, you can configure the server using environment variables:

Required

Optional

Docker Compose Example

version: '3.8'

services: dolt-mcp-server: image: dolthub/dolt-mcp:latest ports: - "8080:8080" environment: - MCP_MODE=http - DOLT_HOST=dolt-server - DOLT_PORT=3306 - DOLT_USER=root - DOLT_DATABASE=myapp - DOLT_PASSWORD=secret depends_on: - dolt-server restart: unless-stopped

dolt-server: image: dolthub/dolt-sql-server:latest ports: - "3306:3306" volumes: - dolt_data:/var/lib/dolt environment: - DOLT_ROOT_PATH=/var/lib/dolt restart: unless-stopped

volumes: dolt_data:

Available Tools

The Dolt MCP Server provides 40+ tools organized by functionality:

Database Management

Table Operations

Data Operations

Branch Management

Version Control

Diff and Status

Merge Operations

Reset Operations

Remote Operations

Example Workflows

Basic Database Operations

Start the MCP server

./dolt-mcp-server --stdio --dolt-host localhost --dolt-user root --dolt-database testdb

Example AI interactions:

"Show me all tables in the database"

"Create a table called users with id, name, and email columns"

"Insert some sample data into the users table"

"Show me the current branch and recent commits"

Version Control Workflow

Example AI workflow:

"Create a new branch called 'feature-users'"

"Switch to the feature-users branch"

"Create a users table with appropriate schema"

"Stage and commit these changes"

"Switch back to main and merge the feature branch"

Data Analysis

Example AI interactions:

"Show me all data in the sales table"

"Calculate total revenue by month from the orders table"

"Show me what changed in the products table in the last week"

"Create a branch to experiment with data transformations"

Development

Running Tests

Integration Tests

The repository includes comprehensive integration tests that validate tool functionality against a real Dolt server instance.

Contributing

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

License

This project follows the same license as the main Dolt project.

Support

For issues and questions: