SuperAPIAI Directory

aimdb-dev/aimdb

github.com · Other AI tools

aimdb-mcp is the Model Context Protocol (MCP) server implementation for AimDB, enabling large language models such as Claude and GPT-4 to interact with running AimDB instances through natural language for introspection, debugging, and monitoring. It supports automatic discovery of running AimDB servers, reports the schema name and version declared for each record, provides 13 tools covering introspection, record operations, dependency graphs, and metrics/performance analysis, and can be used with GitHub Copilot in VS Code. It is read-only by default; write-type tools must be explicitly enabled via --allow-writes; --public mode exposes only 3 read-only tools.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

aimdb-mcp is the MCP (Model Context Protocol) server implementation for AimDB, with the goal of enabling large language models (such as Claude, GPT-4, etc.) to interact with running AimDB instances for introspection, debugging, and monitoring. AimDB itself is an asynchronous in-memory database with typed data contracts and schema migration, covering scenarios from microcontrollers to the cloud.

Main Capabilities

  • LLM-driven: Issue queries to AimDB instances in natural language.
  • Automatic discovery: Automatically find running AimDB servers.
  • Record contracts: Report the schema name and version declared for each record.
  • Rich toolset: 13 tools in total, covering introspection, record operations, dependency graphs, and metrics/performance analysis.
  • VS Code integration: Can be used with GitHub Copilot.

Tool List

Of the 13 tools, the three tools that modify a running instance (set_record、reset_stage_profiling、reset_buffer_metrics) are provided only under --allow-writes , so 10 tools are exposed by default; under --public mode only discover_instances、list_records and get_record。

  1. discover_instances: Find all running AimDB instances.
  2. get_instance_info: Get detailed information about a specific instance.
  3. list_records: List all records in an instance.
  4. get_record: Get the current value of a record.
  5. set_record: Set the value of a writable record (requires --allow-writes)。
  6. drain_record: Drain all values accumulated since the last drain (destructive bulk read).
  7. graph_nodes: List all nodes in the dependency graph.
  8. graph_edges: List directed edges (data flows) between records.
  9. graph_topo_order: Show the topological (generation/initialization) order of records.
  10. get_stage_profiling: Show automatic per-stage timing, i.e., the time taken by each .source() / .tap() / .link() callback (wall-clock time, including .await / I/O / sleep), and mark the slowest stage; requires the target instance to be built with the profiling feature.
  11. reset_stage_profiling: Reset the stage profiling counters for all records on the target instance (requires --allow-writes, instance write permission, and the profiling feature).
  12. get_buffer_metrics: Return the buffer introspection counters for matching records (produced_count / consumed_count / dropped_count / occupancy); requires the target instance to be built with the metrics feature.
  13. reset_buffer_metrics: Reset the buffer introspection counters for all records on the target instance (requires --allow-writes, instance write permission, and the metrics feature).

Usage

Build from source:

cargo build -p aimdb-mcp --release

The binary is located at target/release/aimdb-mcp.

VS Code configuration: Add .vscode/mcp.jsonto the workspace, and VS Code will automatically detect and load the MCP servers in it.

Claude Desktop configuration: Add to claude_desktop_config.json.

Selecting a target instance: Every tool that communicates with an instance accepts an optional endpoint parameter (scheme:// URL, transport selected at runtime). When omitted, resolution follows this order: tool-explicit endpoint parameter → startup flag --connect <ENDPOINT> → environment variable AIMDB_CONNECT. A single instance can be pinned at startup so the LLM does not need to pass a path. In --public mode, the endpoint supplied by the client is stripped, and the tool falls back to the server-pinned --connect / AIMDB_CONNECT, so the client cannot probe arbitrary paths on the host.

Write control: The tool list the client sees reflects the current mode. Without --allow-writes , calls to write tools are rejected with a prompt for the required flag. Enable only when the agent should be able to modify the running system. The instance's own AimX security policy still applies: an instance running with SecurityPolicy::read_only() rejects writes even with --allow-writes .

Serial transport: Off by default (it pulls in tokio-serial → libudev on Linux); you must build with cargo build -p aimdb-mcp --features transport-serial before you can connect to serial:// endpoints.

Example server: Starting the example server creates an instance with example records in /tmp/aimdb-demo.sock .

Record contract

The MCP server does not infer schemas. To understand record contents, use the contract declared by the record and inspect real values:list_records returns schema_type and schema_version;get_record returns the current value as {value, ts} , which should be treated as a single observation sample: it only shows the shape of that value, not which fields are optional or what an array can hold. Records without a configured schema have no schema_type or schema_version; fields are omitted rather than null, and in that case get_record is the only data view, and the agent should ask the user about units or semantics.graph_nodes carries the same contract as the schema:{ name, version }.

Resources and prompts

Instance resources are discovered by scanning Unix sockets, with URIs keyed by socket path:

  • aimdb://instances: list of all discovered instances
  • aimdb://instance/{socket_path}: details of a specific instance
  • aimdb://{socket_path}/records: all records in an instance

The server provides one helper prompt (unavailable in--public mode):troubleshooting, for guided diagnosis of connection/record issues.

Protocol details

  • stdio: JSON-RPC 2.0 over standard input/output
  • Format: NDJSON (newline-delimited JSON)
  • Tools: ✓ (13; 10 published by default, all 13 under--allow-writes , 3 in--public mode)
  • Resources: ✓ (instances and their records)
  • Prompts: ✓ (1)
  • Sampling: ✗ (not supported)
  • Logging: ✓ (stderr)

Use cases

Record exploration, data monitoring, configuration updates (requires --allow-writes).

Security and limitations

  • Currently no authentication is required; access is controlled by Unix socket permissions; token-based authentication is planned for the future.
  • Read-only by default (list, get, drain, graph); tools that modify a running instance are only available with --allow-writes provided below.
  • Write operations (set) also require the record on the instance to be writable.
  • No shell access or arbitrary code execution; no network communication; all data stays on the local machine.
  • Tool latency: local operations < 10ms; memory usage: about 5MB baseline; concurrent connections: single-threaded stdio.
  • Stage performance analysis and buffer metrics respectively require the target instance to be built with the profiling / metrics features, otherwise records do not carry the corresponding data.
  • Serial port transport is disabled by default and requires an explicit build feature.

Troubleshooting

When the server does not respond, check whether the MCP server is running and test stdio manually; when an instance cannot be found, check the socket path and verify permissions. When debug logging is enabled, logs are output to stderr, keeping stdio clean for use by the MCP protocol.

Extension

Define tools in tools.rs , implement handlers in server.rs , and add them to the tool list of list_tools() .

Reference

  • MCP specification:https://spec.modelcontextprotocol.io/
  • AimX protocol: docs/design/008-M3-remote-access.md
  • Schema query (superseded, historical): docs/design/011-M4-schema-query.md
  • See the LICENSE file for the license.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools