Skip to main content
Glama

AI Data MCP

Local MySQL, Redis, and MongoDB tools for AI agents and developers.

中文说明 · Configuration · Tool contracts · Security

Public Alpha: single operator, local machine, read-only by default. Production connections always reject writes. Non-production writes require explicit local configuration opt-in. Eighteen provider-specific tools share STDIO and authenticated loopback Streamable HTTP transports.

Provider

Inspection and reads

Explicit non-production writes

MySQL

Connections, tables/views, columns/indexes, parameterized SQL

Single DML/DDL, managed DML transactions

Redis

Connections, SCAN, allowlisted read commands

Allowlisted mutations

MongoDB

Connections, collections, find/count/aggregate

Insert, filtered update/delete

Try without credentials

Requires Node.js 22.12+ (CI: Node 22/24). Python 3.10+ is needed for publication checks and packaging. No model API key or database is needed for the demo.

git clone https://github.com/ResetFull/ai-data-mcp.git
cd ai-data-mcp
npm ci --ignore-scripts
npm run build
npm run demo

The demo starts a real STDIO MCP subprocess, discovers 18 tools, reads temporary synthetic configuration, and verifies write guards before database access. It opens no database sockets and does not read your existing configuration.

Related MCP server: db-connector

Configure your databases

npm run config:init
# Edit ~/.config/data-mcp/connections.json and secrets.json outside the checkout.
npm run config:validate
npm run smoke:configured

Initialization preserves existing files. Validation and configured smoke check configuration only; they do not establish connectivity or database permissions. See all fields and overrides.

Each connection has an environment (prod/staging/test/dev/local) and write_enabled (default false). Only a non-production connection with write_enabled=true can use write tools. Use database-enforced read-only accounts for production.

Successful query results are returned to your chosen AI host and may reach its model provider. Arbitrary query values are not automatically masked. Keep secrets outside source control and use the minimum database grants needed.

Connect any STDIO MCP client

Start the server directly, or configure your MCP host to launch it:

node dist/index.js --transport=stdio
{
  "mcpServers": {
    "data-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/ai-data-mcp/dist/index.js", "--transport=stdio"]
    }
  }
}

Replace the path with your real absolute path; on Windows use forward slashes or JSON-escaped backslashes. Logs go to stderr and protocol messages to stdout. Restart the server process after configuration changes.

Optional shared HTTP and Codex plugin

For a shared local process, set DATA_MCP_HTTP_TOKEN in both the server and client environments and run npm run start:http. The service listens only on loopback; /mcp requires the bearer token and /health is a local process-health endpoint. See HTTP setup.

Windows users may run npm run service:install after building. This installs the current-user AI-Data-MCP scheduled task and generates/reuses a user-scoped token. Restart Codex to inherit it. The installer refuses ports owned by other processes.

After configuring and starting that HTTP service, install the optional adapter:

codex plugin marketplace add https://github.com/ResetFull/ai-data-mcp.git
codex plugin add data-mcp@ai-data-mcp

The plugin connects to 127.0.0.1:17890; installation alone does not build the server or install a daemon. The generic STDIO configuration above works independently of the marketplace. Existing personal plugins with the same data-mcp identity should be managed explicitly in the host before switching installations.

Windows lifecycle commands: service:start, service:status, service:stop, and service:uninstall (run through npm run). Removal preserves external configuration and the shared token. Other operating systems can supervise the HTTP process themselves; no systemd/launchd installer is shipped.

Writes and failure recovery

MySQL DDL requires allow_ddl=true; UPDATE/DELETE without WHERE requires allow_all=true. MongoDB update/delete with an empty filter also requires allow_all=true. These flags do not bypass production or local write opt-in. DDL may implicitly commit, and managed transaction atomicity requires transactional tables such as InnoDB.

An interrupted write may have committed. WRITE_OUTCOME_UNKNOWN requires read-back before retrying; it is not evidence of rollback. The server does not automatically retry writes or provide a persistent idempotency store. See operation contracts.

Successful tool responses have a combined 100000-byte text/structured-data budget. Output bounds do not certify SQL cost, database workload, or peak driver memory. MySQL handshakes are bounded but active connections are not capped.

Validate and package

npm run check
npm run smoke
npm audit
python -B scripts/privacy_check.py
python -B scripts/publication_checks.py
python -B scripts/package_release.py

Release packaging requires a clean committed checkout, rebuilds the runtime, scans source and the final allowlisted ZIP, and writes SHA256SUMS. It includes source, compiled runtime, examples, tests, and documentation; dependencies are not bundled. GitHub Actions verifies Windows/Linux with Node 22/24 and disposable MySQL 8.4, Redis 7.4, and MongoDB 7.0 services. Validation scope and limitations separate these checks from business-system acceptance and unvalidated platforms.

License and contributions

Apache-2.0. See LICENSE, NOTICE, third-party dependencies, contribution guidance, and security policy.

Available Tools

18 tools
mongo_aggregateAggregate MongoDB documentsA
Read-onlyIdempotent

Run a bounded read-only MongoDB aggregation. Data MCP recursively rejects $out and $merge stages and appends a result limit.

Inputs: collection (required), connection_id (required), limit, pipeline, +2 more.

mongo_count_documentsCount MongoDB documentsB
Read-onlyIdempotent

Count documents matching a MongoDB filter with a bounded max execution time. This tool is read-only in every environment.

Inputs: collection (required), connection_id (required), filter, timeout_ms, +1 more.

mongo_delete_manyDelete non-production MongoDB documentsA
DestructiveIdempotent

Delete matching documents from a non-production collection. Empty filters require allow_all=true; production is always blocked.

Inputs: filter (required), collection (required), connection_id (required), allow_all, +1 more.

mongo_findFind MongoDB documentsA
Read-onlyIdempotent

Run a bounded MongoDB find query with filter, projection, sort, skip, and max-time controls. This tool is read-only in every environment.

Inputs: collection (required), connection_id (required), skip, sort, +5 more.

mongo_insert_oneInsert non-production MongoDB documentA

Insert one document into a non-production MongoDB collection. Production connections are always read-only.

Inputs: document (required), collection (required), connection_id (required), response_format.

mongo_list_collectionsList MongoDB collectionsB
Read-onlyIdempotent

List MongoDB collections and metadata with a bounded result size and optional case-insensitive name filter.

Inputs: connection_id (required), limit, name_contains, response_format.

mongo_list_connectionsList MongoDB connectionsA
Read-onlyIdempotent

List configured MongoDB connection IDs, environments, databases, and effective access modes. Connection URIs and credentials are never returned.

Inputs: response_format.

mongo_update_manyUpdate non-production MongoDB documentsA
Destructive

Update matching documents in a non-production collection. Empty filters require allow_all=true; production is always blocked.

Inputs: filter (required), update (required), collection (required), connection_id (required), +2 more.

mysql_describe_tableDescribe MySQL tableA
Read-onlyIdempotent

Inspect columns and indexes for one exact MySQL table or view. Returns types, nullability, defaults, comments, and ordered index columns. This tool is read-only in every environment.

Inputs: table (required), connection_id (required), schema, response_format.

mysql_executeExecute non-production MySQL statementA
Destructive

Execute one parameterized DML or DDL statement on a non-production connection. Never runs against a connection marked prod. Use mysql_execute_transaction for atomic multi-statement DML; run DDL separately because MySQL may implicitly commit it.

Inputs: sql (required), connection_id (required), allow_all, allow_ddl, +3 more.

mysql_execute_transactionExecute non-production MySQL transactionA
Destructive

Atomically execute 1-20 parameterized INSERT, REPLACE, UPDATE, or DELETE statements on one non-production connection. Rolls back on the first error. Prod, DDL, reads, transaction control, and session control are rejected.

Inputs: statements (required), connection_id (required), allow_all, timeout_ms, +1 more.

mysql_list_connectionsList MySQL connectionsA
Read-onlyIdempotent

List configured MySQL connection IDs, environments, databases, and effective access modes. Passwords are never returned. Use this before other tools when the connection ID is unknown.

Inputs: response_format.

mysql_list_tablesList MySQL tablesA
Read-onlyIdempotent

List tables and views in a MySQL schema with pagination and an optional name filter. Returns table type, engine, row estimate, and storage size. This tool is read-only in every environment.

Inputs: connection_id (required), limit, offset, schema, +2 more.

mysql_queryQuery MySQLA
Read-onlyIdempotent

Run exactly one parameterized read-only MySQL statement. Works in every environment, including prod. Data MCP rejects writes, locking reads, file access, session mutation, multiple statements, and selected resource-exhaustion functions; it also runs the statement in a read-only transaction and caps returned data.

Inputs: sql (required), connection_id (required), max_rows, parameters, +2 more.

redis_commandRun read-only Redis commandA
Read-onlyIdempotent

Run one explicitly allowlisted read-only Redis command with tokenized arguments. KEYS, scripting, administration, pub/sub, transactions, blocking operations, and all mutations are rejected.

Inputs: arguments (required), connection_id (required), response_format.

redis_executeExecute non-production Redis commandA
Destructive

Execute one explicitly allowlisted Redis mutation on a non-production connection. Production, scripts, transactions, administration, pub/sub, flush, and arbitrary commands are rejected.

Inputs: arguments (required), connection_id (required), response_format.

redis_list_connectionsList Redis connectionsA
Read-onlyIdempotent

List configured Redis connection IDs, environments, logical databases, and effective access modes. Passwords are never returned.

Inputs: response_format.

redis_scan_keysScan Redis keysA
Read-only

Incrementally scan Redis keys without using the blocking KEYS command. Returns the next cursor and a bounded page of keys.

Inputs: connection_id (required), type, count, cursor, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 18 tools

    Disambiguation5/5

    Tools are cleanly separated by database prefix (mysql_, mongo_, redis_) and distinct actions (list, describe, query, execute, find, aggregate, insert, update, delete). Read vs write vs specialized operations are clearly delineated in descriptions, leaving no meaningful ambiguity.

    Naming Consistency5/5

    All names follow a consistent snake_case pattern with a database prefix and verb-based naming. Minor verb variations (query/find/command) are conventional for each database and do not break predictability.

    Tool Count5/5

    18 tools across three databases (MySQL, MongoDB, Redis) is well-scoped; each database has a focused set covering essential read/write operations without redundancy. The count is justified by the multi-database purpose.

    Completeness4/5

    Covers core CRUD for MySQL (via execute), MongoDB, and Redis (via allowlisted commands), with safety constraints. Minor gaps include no batch insert for MongoDB, no single-document update/delete, and no explicit Redis key deletion/expiration tools.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Enables MCP clients such as Codex to safely inspect a MySQL database over stdio by listing tables, describing schemas and indexes, and running only validated single read-only SELECT/CTE queries plus JSON EXPLAIN plans. Queries execute inside read-only transactions with strict AST-based rejection of writes, multi-statements, and other risky operations, and results come back as structured JSON.
      6
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to connect to and interact with MySQL, Redis, and MongoDB through a stdio MCP server, with unified data source discovery, read-only querying, and explicitly authorized write operations.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables agents to connect to and work with PostgreSQL, MySQL, Redis, SQLite, and MongoDB through a uniform tool surface for opening connections, running queries and commands, inspecting schemas, and managing documents.
      13
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to explore and run read-only queries across MySQL/MariaDB, PostgreSQL, SQLite, SQL Server, Oracle, and MongoDB through MCP, with per-API-key database authorization, SQL whitelist and row/timeout limits, and a local web UI for managing connections and keys.
      Apache 2.0