GitHub - kurrent-io/mcp-server: This MCP Server allows users to explore data in KurrentDB by reading, writing or creating projections. (original) (raw)

KurrentDB MCP Server

This is a simple MCP server to help you explore data and prototype projections faster on top of KurrentDB.

Installation

KurrentDB Setup

You need to enable --run-projections=all and --start-standard-projections on KurrentDB The $streams stream is used to look for available streams.

MCP Client Setup (Claude or VS Code)

{ "servers": { "KurrentDB": { "type": "stdio", "command": "uv", "args": [ "--directory", "path to mcp-server folder", "run", "server.py" ], "env": { "KURRENTDB_CONNECTION_STRING": "insert kurrentdb connection here" } } } }

This configuration file should work in Claude Desktop (https://modelcontextprotocol.io/quickstart/user) and VS Code (.vscode/mcp.json).

MCP Client Setup (Cursor or Windsurf)

{ "mcpServers": { "kurrentdb": { "command": "python", "args": ["path to mcp-server folder\server.py"], "env": { "KURRENTDB_CONNECTION_STRING": "insert kurrentdb connection here" } } } }

This configuration file should work in Cursor (.cursor\mcp.json) and Windsurf (.codeium\windsurf\mcp_config.json).

Overview

This MCP server is designed to make stream data available to the MCP client. It provides a simple interface for querying and retrieving stream data. It can also create, test and debug projections.

Access control is done using the KurrentDB connection string provided at configuration time as an environment variable.

Components

Tools

The servers exposes 8 tool calls:

  1. read_stream
  2. list_streams
  3. build_projection
  4. create_projection
  5. update_projection
  6. test_projection
  7. write_events_to_stream
  8. get_projections_status

Configuration

Usage Documentation

Available Tools

1. Stream Operations

read_stream

Reads events from a specific stream in KurrentDB.

Parameters:

Sample Prompts:

Example Usage:

Tool: read_stream
Parameters:
- stream: "orders"
- backwards: true
- limit: 5

write_events_to_stream

Writes new events to a stream in KurrentDB.

Parameters:

Sample Prompts:

Example Usage:

Tool: write_events_to_stream
Parameters:
- stream: "orders"
- data: {"orderId": "ORD-001", "customerId": 123, "amount": 99.99}
- event_type: "OrderCreated"
- metadata: {"timestamp": "2025-05-19T10:00:00Z", "source": "web"}

list_streams

Lists all available streams in the KurrentDB database.

Parameters:

Sample Prompts:

Example Usage:

Tool: list_streams
Parameters:
- limit: 20
- read_backwards: true

2. Projection Operations

Projections in KurrentDB are computed views that process events from streams to create queryable data structures.

build_projection

Uses AI assistance to build a projection based on your requirements.

Parameters:

Sample Prompts:

Example Usage:

Tool: build_projection
Parameters:
- user_prompt: "Create a projection that aggregates order totals by day and calculates running totals"

create_projection

Creates a projection in KurrentDB using provided code.

Parameters:

Sample Prompts:

Note: Client normally always asks the user for confirmation before creating a projection.

update_projection

Updates an existing projection with new code.

Parameters:

Sample Prompts:

get_projections_status

Retrieves status and statistics for a specific projection.

Parameters:

Sample Prompts:

test_projection

Writes test events to a projection to verify its functionality. Verification is done by reading the streams emitted or the state of the projection.

Sample Prompts:

Parameters:

Sample Prompts:

Sample Events

Modern LLMs can generate sample events for various use cases on their given enough information.

Order Event

{ "data": { "orderId": "ORD-12345", "customerId": "CUST-789", "items": [ {"productId": "PROD-001", "quantity": 2, "price": 29.99} ], "total": 59.98 }, "event_type": "OrderCreated", "metadata": { "timestamp": "2025-05-19T14:30:00Z", "source": "ecommerce-api", "correlationId": "corr-123" } }

User Activity Event

{ "data": { "userId": "USER-456", "action": "page_view", "page": "/products/electronics", "sessionId": "sess-789" }, "event_type": "UserActivity", "metadata": { "timestamp": "2025-05-19T14:35:00Z", "userAgent": "Mozilla/5.0...", "ipAddress": "192.168.1.100" } }