mcp-data-source
Enables querying and managing ClickHouse databases with support for HTTP/HTTPS and read-only enforcement.
Enables querying and managing Huawei DWS (GaussDB) databases with schema discovery and read-only enforcement.
Enables querying and managing MongoDB databases with JSON query support and read-only enforcement.
Enables querying and managing MySQL databases with schema discovery, pagination, and read-only enforcement.
Enables querying and managing PostgreSQL databases with schema discovery, pagination, and read-only enforcement.
Enables querying and managing SQLite database files with schema discovery and read-only enforcement.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-data-sourceshow tables in the production MySQL database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-data-source
Multi-datasource MCP Server โ connect AI assistants to 6 database types with dynamic configuration and secure credential storage.
๐ ๅฎๆดไธญๆๆๆกฃ๏ผdocs/user-guide.md
Features
Capability | Description |
6 Database Types | MySQL, PostgreSQL, ClickHouse, MongoDB, SQLite, Huawei DWS |
Dynamic Configuration | Add/remove data sources at runtime via MCP tools โ no restart needed |
Secure Storage | Passwords encrypted with AES-256-GCM, stored in local SQLite |
Read-Only by Default | Write operations require explicit |
Schema Discovery | Auto-detect table structure to assist natural-language-to-SQL |
Pagination | Built-in |
Query Timeout | Per-database timeouts prevent long-running queries from blocking |
SSL/TLS | Encrypted connections with client certificate support |
Offline CLI |
|
Related MCP server: DBHub
Architecture
MCP Client (Claude Code / Claude Desktop / OpenCode)
โ stdio
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ mcp-data-source โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ 9 Tools โ โ Connectors (6) โ โ
โ โ config/* โ โ mysql / pg / dws โ โ
โ โ query/* โ โ ch / mongo / sql โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ ~/.mcp-data-source/ Remote DBs โ
โ config.db (encrypted) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโInstallation
cd mcp-data-source
npm install
npm run build
npm link # makes mcp-ds globally availableOr for distribution:
npm pack # โ mcp-data-source-1.0.0.tgz
npm install -g mcp-data-source-1.0.0.tgzRequirements: Node.js โฅ 18.x, npm โฅ 9.x.
MCP Client Configuration
Configuration is a two-step process: โ Set encryption key (system env var) โ โก Register the server (MCP client config).
โ ๏ธ
MCP_DATA_SOURCE_KEYis a system environment variable read viaprocess.env. It does NOT go in the MCP config file. The config only carriesMCP_LOG_LEVEL(optional).
Step 1: Set Encryption Key (system env var)
First, generate and set MCP_DATA_SOURCE_KEY as a system environment variable (see Generate Encryption Key below).
macOS / Linux โ add to ~/.zshrc or ~/.bashrc:
export MCP_DATA_SOURCE_KEY=your-64-char-hex-keyWindows โ set in System Environment Variables, or PowerShell:
[Environment]::SetEnvironmentVariable("MCP_DATA_SOURCE_KEY", "your-64-char-hex-key", "User")Restart your terminal / MCP client after setting.
Step 2: MCP Client Config
โ ๏ธ Configuration format differs between MCP clients. Copy-pasting between them won't work.
Format Comparison
Setting | Claude Code | Claude Desktop | OpenCode |
Config file |
|
|
|
Top-level key |
|
|
|
Env var key |
|
|
|
Extra fields | โ | โ |
|
Claude Code
{
"mcpServers": {
"data-source": {
"command": "mcp-data-source",
"env": {
"MCP_LOG_LEVEL": "info"
}
}
}
}Claude Desktop
Config file: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
{
"mcpServers": {
"data-source": {
"command": "node",
"args": ["/absolute/path/to/dist/server.js"],
"env": {
"MCP_LOG_LEVEL": "info"
}
}
}
}OpenCode
Config file: opencode.json in project root (not .mcp.json).
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"data-source": {
"type": "local",
"command": ["mcp-data-source"],
"environment": {
"MCP_LOG_LEVEL": "info"
},
"enabled": true
}
}
}Common OpenCode pitfalls: using
mcpServersinstead ofmcp,envinstead ofenvironment, or forgetting"enabled": true.
CLI Tool (mcp-ds)
Manage data sources offline โ passwords never go through the LLM.
# Add a data source (interactive password prompt โ secure)
mcp-ds add mysql --name prod --host 10.0.0.1 --port 3306 --username admin --password
# Add via environment variable (for scripting)
DB_PASS=xxx mcp-ds add mysql --name prod --host 10.0.0.1 --username admin --password-env DB_PASS
# SQLite
mcp-ds add sqlite --name local --file-path /path/to/database.db
# ClickHouse with HTTPS
mcp-ds add clickhouse --name ch --host 10.0.0.1 --username admin --password --protocol https
# List, test, delete
mcp-ds list
mcp-ds test prod
mcp-ds delete prodFull add Options
Option | Required | Description |
| โ | Unique data source name |
| * | Database host (not for SQLite) |
| Port (uses default for type) | |
| Database name | |
| * | Username (not for SQLite) |
| Interactive prompt (secure, recommended) | |
| Read password from env variable | |
| * | SQLite file path (SQLite only) |
| ClickHouse: | |
| Enable SSL/TLS | |
| CA certificate content | |
| Client certificate content | |
| Client private key content |
Generate Encryption Key
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# Or: openssl rand -hex 32Set the generated key as a system environment variable (not in MCP config):
macOS/Linux: export MCP_DATA_SOURCE_KEY=... in ~/.zshrc or ~/.bashrc
Windows: System Environment Variables, or [Environment]::SetEnvironmentVariable("MCP_DATA_SOURCE_KEY", "...", "User") in PowerShell
Keep it safe โ if lost, stored passwords cannot be decrypted. Restart your MCP client after setting.
Supported Databases
Database |
| Required Fields | Default Port |
MySQL |
| host, username, password | 3306 |
PostgreSQL |
| host, username, password | 5432 |
Huawei DWS |
| host, username, password | 5432 |
ClickHouse |
| host, username, password | 8123 |
MongoDB |
| host, username, password | 27017 |
SQLite |
| filePath | โ |
MCP Tools Overview
Configuration (6 tools)
Tool | Description |
| Get required fields for a database type |
| Add new data source (credentials encrypted) |
| List all configured sources (passwords hidden) |
| Modify an existing data source |
| Remove a data source |
| Verify connectivity to a data source |
Query (3 tools)
Tool | Description |
| Execute SQL or MongoDB JSON query |
| Discover table structure |
| Get schema context for natural language questions |
Quick Usage Examples
# Add and explore
User: Add a MySQL data source named "prod" at 10.0.0.1:3306, user admin, password secret123
User: Test the connection
User: Show me the tables in prod
# Natural language query
User: How many orders were placed last month in the analytics database?
โ AI auto-discovers schema, constructs SQL, and returns results
# Pagination
User: Query users table, 50 per page
User: Next page
# Write operations (requires explicit authorization)
User: Insert a new user record, allow writesEnvironment Variables
Variable | Required | Default | How to set | Description |
| Yes | โ | System env var | AES-256-GCM encryption key (64 hex chars) |
| No |
| MCP config | Log level: |
MCP_DATA_SOURCE_KEYis read from the system environment byprocess.env.MCP_LOG_LEVELcan be injected via the MCP client config.
Security
AES-256-GCM authenticated encryption with random IV per operation
Passwords stored encrypted in
~/.mcp-data-source/config.dblist_data_sourcesnever returns password fieldsDefault
readOnly: trueblocks all write operationsEach query uses an isolated connection, closed immediately after use
Connection pooling (max 10) with automatic cleanup for MySQL/PostgreSQL
Troubleshooting
Issue | Check |
Server won't start | Run |
Encryption key not configured | Set |
OpenCode | Use |
Connection test fails | Check network/VPN, port, credentials, remote access enabled |
Write operation rejected | Set |
Query timeout | Optimize SQL, reduce |
For detailed troubleshooting and advanced usage, see docs/user-guide.md.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Crankhead/mcp-data-source'
If you have feedback or need assistance with the MCP directory API, please join our Discord server