anydb-mcp
Zero-config MCP server that empowers AI agents to safely query SQL and NoSQL databases like PostgreSQL, MySQL, SQLite, MongoDB, and Redis.
README
AnyDB MCP Server
<div align="center">
The Universal Database Connector for AI Agents
</div>
anydb-mcp is a professional, zero-config Model Context Protocol (MCP) server that empowers AI agents to safely query SQL and NoSQL databases.
It acts as a universal bridge, allowing tools like Cursor, Claude, Gemini, and Zed to interact with your data effortlessly using a single unified interface.
✨ Features
- 🔌 Universal Support: Works with PostgreSQL, MySQL, SQLite, MongoDB, and Redis out of the box.
- 🚀 Zero Config: No configuration files required. Just run it via
npx. - ⚡ Stateless & Fast: Connections are created on-demand and closed immediately.
- 🛡️ Secure: Designed for read-only access (enforceable via DB users).
- 🧠 Smart Parsing: Automatically detects database types from standard connection URIs.
📦 Quick Start
You can run this server directly using npx without installing anything manually.
🤖 Choose Your Client
<details open> <summary><strong>Cursor</strong> (Recommended)</summary>
- Open Cursor Settings > Features > MCP.
- Click + Add New MCP Server.
- Enter the following details:
- Name:
anydb - Type:
command - Command:
npx - Args:
-y anydb-mcp
- Name:
</details>
<details> <summary><strong>Claude Desktop</strong></summary>
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"anydb": {
"command": "npx",
"args": ["-y", "anydb-mcp"]
}
}
}
</details>
<details> <summary><strong>Zed Editor</strong></summary>
Edit your settings.json (Cmd/Ctrl + ,):
{
"context_servers": {
"anydb": {
"command": {
"path": "npx",
"args": ["-y", "anydb-mcp"]
}
}
}
}
</details>
<details> <summary><strong>Gemini CLI</strong></summary>
Add to your mcp_servers.json:
{
"mcpServers": {
"anydb": {
"command": "npx",
"args": ["-y", "anydb-mcp"]
}
}
}
Note: On Windows, explicitly use npx.cmd.
</details>
<details> <summary><strong>VS Code (Cline / Roo Cline)</strong></summary>
- Open the MCP Servers tab (usually in the sidebar or settings).
- Select Configure MCP Servers.
- Add the configuration:
"anydb": {
"command": "npx",
"args": ["-y", "anydb-mcp"]
}
</details>
🔗 Connection URIs
The AI agent will provide these URIs automatically, or you can provide them in the chat context.
| Database | Protocol | Example URI |
|---|---|---|
| PostgreSQL | postgres:// |
postgres://user:pass@localhost:5432/mydb |
| MySQL | mysql:// |
mysql://user:pass@localhost:3306/mydb |
| SQLite | sqlite:// |
sqlite:///Users/alex/data.db (Absolute path) |
| MongoDB | mongodb:// |
mongodb://user:pass@localhost:27017 |
| Redis | redis:// |
redis://:pass@localhost:6379 |
🛠️ Tool Usage
The server exposes one powerful tool: db_query.
Arguments:
uri(string, required): The connection string.query(string, required): The SQL query, MongoDB filter (JSON), or Redis command.collection(string, optional): Required only for MongoDB.
Examples:
SQL (Postgres/MySQL/SQLite):
SELECT id, email FROM users WHERE created_at > '2024-01-01' LIMIT 5;
MongoDB:
{ "status": "active", "age": { "$gt": 21 } }
Redis:
GET session:12345
🔒 Security Best Practices
- Read-Only User: ALWAYS create a dedicated database user with SELECT-only permissions (or equivalent) for the AI.
- Postgres:
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ai_user; - MySQL:
GRANT SELECT ON mydb.* TO 'ai_user'@'%';
- Postgres:
- Network: Ensure the database host is accessible from the machine running the MCP server.
- Data Privacy: Be cautious. The AI has access to whatever data the query returns.
👨💻 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repo.
npm installnpm test- Submit a Pull Request.
License
MIT © Alexeev Alexandr
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.