| Crates.io | aimdb-mcp |
| lib.rs | aimdb-mcp |
| version | 0.4.0 |
| created_at | 2025-11-06 22:44:07.061917+00 |
| updated_at | 2025-12-25 21:01:33.663599+00 |
| description | Model Context Protocol (MCP) server for AimDB - enables LLM-powered introspection |
| homepage | https://aimdb.dev |
| repository | https://github.com/aimdb-dev/aimdb |
| max_upload_size | |
| id | 1920849 |
| size | 214,766 |
Model Context Protocol (MCP) server for AimDB - enables LLM-powered introspection and debugging.
aimdb-mcp provides an MCP server implementation that enables Large Language Models (like Claude, GPT-4, etc.) to interact with running AimDB instances for introspection, debugging, and monitoring.
Key Features:
┌──────────────────────────────┐
│ LLM Host (VS Code/Claude) │
│ - Natural language queries │
│ - Tool invocations │
└──────────────┬───────────────┘
│ stdio (JSON-RPC 2.0)
▼
┌──────────────────────────────┐
│ aimdb-mcp Server │
│ - Protocol translation │
│ - Tool implementations │
│ - Schema inference │
└──────────────┬───────────────┘
│ aimdb-client
▼
┌──────────────────────────────┐
│ AimDB Instances │
│ (Unix domain sockets) │
└──────────────────────────────┘
Build from source:
cd /aimdb
cargo build --release -p aimdb-mcp
Binary will be at target/release/aimdb-mcp.
Add .vscode/mcp.json to your workspace:
{
"servers": {
"aimdb": {
"type": "stdio",
"command": "/path/to/aimdb-mcp",
"args": [],
"env": {
"RUST_LOG": "info"
}
}
}
}
Note: VS Code will automatically detect and load MCP servers from .vscode/mcp.json.
Add to claude_desktop_config.json:
{
"mcpServers": {
"aimdb": {
"command": "/path/to/aimdb-mcp",
"args": []
}
}
}
Start the example server:
cd /aimdb/examples/remote-access-demo
cargo run
This creates an instance at /tmp/aimdb-demo.sock with sample records.
🎬 Demo video coming soon - showing natural language queries via GitHub Copilot
Find all running AimDB instances:
Query: "What AimDB instances are running?"
Result: Lists socket paths, versions, and record counts
Get detailed information about a specific instance:
Query: "Show me details about /tmp/aimdb-demo.sock"
Result: Server version, protocol, permissions, capabilities
List all records in an instance:
Query: "What records are in the demo instance?"
Result: Record names, types, buffer configs, producer/consumer counts
Get current value of a record:
Query: "What's the current temperature?"
Result: JSON value of server::Temperature record
Set value of a writable record:
Query: "Set the config log_level to debug"
Action: Updates server::Config record
Infer JSON schema from record values:
Query: "What's the schema of the Temperature record?"
Result: JSON Schema with types, required fields, and example
Subscribe to live record updates:
Query: "Subscribe to temperature for 50 samples"
Action: Creates subscription, auto-saves updates to JSONL file
Stop an active subscription:
Query: "Stop subscription sub-abc123"
Action: Unsubscribes and stops data collection
Show active subscriptions:
Query: "What subscriptions are active?"
Result: Subscription IDs, records, sample counts, file paths
Get directory where subscription data is saved:
Query: "Where is subscription data saved?"
Result: Path to notification directory
The MCP server can infer JSON schemas from record values:
// Record value
{
"celsius": 23.5,
"sensor_id": "sensor-001",
"timestamp": 1730379296
}
// Inferred schema
{
"type": "object",
"properties": {
"celsius": { "type": "number" },
"sensor_id": { "type": "string" },
"timestamp": { "type": "integer" }
},
"required": ["celsius", "sensor_id", "timestamp"]
}
Limitations:
Subscription data saved as JSONL (one JSON object per line):
{"timestamp":"2025-11-06T10:30:45.123Z","sequence_number":1,"value":{"celsius":23.5,"sensor_id":"sensor-001"}}
{"timestamp":"2025-11-06T10:30:47.456Z","sequence_number":2,"value":{"celsius":23.6,"sensor_id":"sensor-001"}}
{"timestamp":"2025-11-06T10:30:49.789Z","sequence_number":3,"value":{"celsius":23.7,"sensor_id":"sensor-001"}}
IMPORTANT: Always ask user for sample limit before subscribing.
Suggested limits:
Default: ~/.local/share/aimdb-mcp/notifications/
Files named: {subscription_id}.jsonl
MCP server provides 5 resources:
aimdb://instancesList of all discovered instances
aimdb://instance/{socket_path}Details about specific instance
aimdb://records/{socket_path}All records in an instance
aimdb://record/{socket_path}/{record_name}Specific record value
aimdb://schema/{socket_path}/{record_name}Inferred schema for record
MCP server provides 3 helper prompts:
aimdb-quickstartIntroduction and common usage patterns
notification-directoryInformation about subscription data storage
subscription-helpGuide to subscriptions and data analysis
Client → Server: initialize request
Client ← Server: initialize response
Client → Server: tools/list request
Client ← Server: tool definitions
Client → Server: tools/call (discover_instances)
Client ← Server: tool result
Client → Server: resources/read (aimdb://instances)
Client ← Server: resource content
User: "Check the health of all AimDB instances"
LLM:
1. discover_instances() → finds instances
2. For each: get_instance_info() → checks status
3. Reports: healthy/unhealthy with details
User: "What data is available in the demo instance?"
LLM:
1. list_records(/tmp/aimdb-demo.sock) → gets record list
2. For interesting records: get_record() → shows values
3. query_schema() → explains structure
4. Summarizes available data types
User: "Monitor temperature for 100 samples and analyze"
LLM:
1. subscribe_record(server::Temperature, 100)
2. Waits for completion
3. Reads JSONL file
4. Analyzes: min, max, avg, trends, anomalies
5. Generates report
User: "Set the log level to debug"
LLM:
1. list_records() → finds writable config record
2. get_record(server::Config) → sees current value
3. set_record(server::Config, {"log_level": "debug", ...})
4. Confirms change
The MCP server provides clear error messages:
Error: Connection failed: /tmp/aimdb.sock
Reason: No such file or directory
Hint: Check if AimDB instance is running
Error: Permission denied
Record 'server::Temperature' is not writable
Hint: Only records without producers can be set
cargo build -p aimdb-mcp
# Unit tests
cargo test -p aimdb-mcp
# Integration test (requires running instance)
cargo run --example remote-access-demo # Terminal 1
cargo test -p aimdb-mcp --test integration # Terminal 2
Enable debug logging:
RUST_LOG=debug aimdb-mcp
Logs go to stderr, keeping stdio clean for MCP protocol.
tools.rs:pub fn my_new_tool() -> Tool {
Tool {
name: "my_tool".to_string(),
description: "Does something useful".to_string(),
input_schema: json!({ /* ... */ }),
}
}
server.rs:"my_tool" => {
let result = handle_my_tool(params).await?;
// Return result
}
list_tools().ps aux | grep aimdb-mcp
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | aimdb-mcp
ls /tmp/*.sock /var/run/aimdb/*.sock
stat /tmp/aimdb-demo.sock
ls -la ~/.local/share/aimdb-mcp/notifications/
df -h ~/.local/share/
docs/design/008-M3-remote-access.mddocs/design/011-M4-schema-query.mdSee LICENSE file.