Server
easy-db-lab includes a server mode that provides AI assistant integration via MCP (Model Context Protocol), REST status endpoints, and live metrics streaming. This enables Claude to directly interact with your clusters, and provides programmatic access to cluster status.
The server exposes tools for all supported databases — Cassandra, ClickHouse, OpenSearch, and Spark — as well as cluster lifecycle management and observability.
Starting the Server
To start the server, run:
easy-db-lab server
By default, the server picks an available port. To specify a port:
easy-db-lab server --port 8888
The server automatically generates a .mcp.json configuration file in the current directory with the connection details.
Adding to Claude Code
Once the server is running, start Claude Code from the same directory:
claude
Claude Code automatically detects and uses the .mcp.json file generated by the server.
Available Tools
The server exposes commands annotated with @McpCommand as MCP tools to Claude. Tool names use underscores and are derived from the command's package namespace.
Cluster Lifecycle
| Tool Name | Description |
|---|---|
init | Initialize a directory for easy-db-lab |
up | Provision AWS infrastructure |
cassandra_down | Shut down AWS infrastructure |
clean | Clean up generated files |
status | Display full environment status |
hosts | List all hosts in the cluster |
ip | Get IP address for a host by alias |
Cassandra Management
| Tool Name | Description |
|---|---|
cassandra_use | Select a Cassandra version |
cassandra_list | List available Cassandra versions |
cassandra_start | Start Cassandra on all nodes |
cassandra_restart | Restart Cassandra on all nodes |
cassandra_update_config | Apply configuration patch to nodes |
Cassandra Stress Testing
| Tool Name | Description |
|---|---|
cassandra_stress_start | Start a stress job on K8s |
cassandra_stress_stop | Stop and delete stress jobs |
cassandra_stress_status | Check status of stress jobs |
cassandra_stress_logs | View logs from stress jobs |
cassandra_stress_list | List available workloads |
cassandra_stress_fields | List available field generators |
cassandra_stress_info | Show workload information |
ClickHouse
| Tool Name | Description |
|---|---|
clickhouse_start | Deploy ClickHouse cluster to K8s |
clickhouse_stop | Remove ClickHouse cluster |
clickhouse_status | Check ClickHouse cluster status |
OpenSearch
| Tool Name | Description |
|---|---|
opensearch_start | Create AWS OpenSearch domain |
opensearch_stop | Delete OpenSearch domain |
opensearch_status | Check OpenSearch domain status |
Spark
| Tool Name | Description |
|---|---|
spark_submit | Submit Spark job to EMR cluster |
spark_status | Check status of a Spark job |
spark_jobs | List recent Spark jobs |
spark_logs | Download EMR logs from S3 |
Kubernetes
| Tool Name | Description |
|---|---|
k8_apply | Apply observability stack to K8s |
Utilities
| Tool Name | Description |
|---|---|
prune_amis | Prune older private AMIs |
Tool Naming Convention
MCP tool names are derived from the command's package location:
- Top-level commands:
status,hosts,ip,clean,init,up - Cassandra commands:
cassandra_prefix (e.g.,cassandra_start,cassandra_use) - Nested commands:
cassandra_stress_prefix (e.g.,cassandra_stress_start) - Hyphens become underscores:
update-config→cassandra_update_config
Benefits of Server Integration
| Benefit | Description |
|---|---|
| Direct Control | Claude executes easy-db-lab commands directly without manual intervention |
| Context Awareness | Claude maintains context about your cluster state and configuration |
| Automation | Complex multi-step operations can be automated through Claude |
| Intelligent Assistance | Claude can analyze logs, metrics, and provide optimization recommendations |
Example Workflow
-
Start the server in one terminal:
easy-db-lab server -
In another terminal, start Claude Code from the same directory:
claudeClaude Code automatically detects the
.mcp.jsonfile generated by the server. -
Ask Claude to help manage your cluster:
- "Initialize a new 5-node cluster with i4i.xlarge instances"
- "Check the status of all nodes"
- "Select Cassandra version 5.0 and start it"
- "Start a KeyValue stress test for 1 hour"
- "Deploy ClickHouse and check its status"
- "Create an OpenSearch domain and monitor its progress"
- "Submit a Spark job to the EMR cluster"
Live Metrics Streaming
When Redis is configured via the EASY_DB_LAB_REDIS_URL environment variable, the server publishes live cluster metrics to the Redis pub/sub channel every 5 seconds. Metrics are queried from VictoriaMetrics using the same PromQL expressions as the Grafana dashboards.
Enabling
export EASY_DB_LAB_REDIS_URL=redis://localhost:6379/easydblab-events
easy-db-lab server
Metrics events are published to the same channel as command events. Consumers filter by the event.type field.
Event Types
Only metrics for running services are published. If the cluster is running ClickHouse instead of Cassandra, no Cassandra metrics events are emitted.
Metrics.System
Published every 5 seconds with per-node CPU, memory, disk I/O, and filesystem metrics:
{
"timestamp": "2026-03-08T14:22:05.123Z",
"commandName": "server",
"event": {
"type": "Metrics.System",
"nodes": {
"db-0": {
"cpuUsagePct": 34.2,
"memoryUsedBytes": 17179869184,
"diskReadBytesPerSec": 52428800.0,
"diskWriteBytesPerSec": 104857600.0,
"filesystemUsedPct": 45.2
},
"db-1": {
"cpuUsagePct": 28.7,
"memoryUsedBytes": 16106127360,
"diskReadBytesPerSec": 41943040.0,
"diskWriteBytesPerSec": 83886080.0,
"filesystemUsedPct": 42.8
}
}
}
}
Metrics.Cassandra
Published every 5 seconds when the cluster is running Cassandra:
{
"timestamp": "2026-03-08T14:22:05.187Z",
"commandName": "server",
"event": {
"type": "Metrics.Cassandra",
"readP99Ms": 1.247,
"writeP99Ms": 0.832,
"readOpsPerSec": 15234.5,
"writeOpsPerSec": 12087.3,
"compactionPending": 3,
"compactionCompletedPerSec": 1.5,
"compactionBytesWrittenPerSec": 52428800.0
}
}
Field Reference
System — per node:
| Field | Type | Description |
|---|---|---|
cpuUsagePct | double | CPU usage percentage (0-100) |
memoryUsedBytes | long | Memory used in bytes |
diskReadBytesPerSec | double | Disk read throughput (bytes/sec) |
diskWriteBytesPerSec | double | Disk write throughput (bytes/sec) |
filesystemUsedPct | double | Filesystem usage percentage (0-100) |
Cassandra — cluster-wide:
| Field | Type | Description |
|---|---|---|
readP99Ms | double | Read latency p99 in milliseconds |
writeP99Ms | double | Write latency p99 in milliseconds |
readOpsPerSec | double | Read operations per second |
writeOpsPerSec | double | Write operations per second |
compactionPending | long | Number of pending compactions |
compactionCompletedPerSec | double | Compactions completed per second |
compactionBytesWrittenPerSec | double | Compaction write throughput (bytes/sec) |
Notes
- The server requires Docker to be installed
- Your AWS profile must be configured (
easy-db-lab setup-profile) - The server runs in the foreground and logs to stdout
- Use Ctrl+C to stop the server