db-mcp
by ShootaOT
Overview
Run an SQLite Model Context Protocol (MCP) server that provides secure access via OAuth 2.0, tool filtering, and options for WASM or native SQLite versions to manage databases effectively.
Installation
db-mcp --transport http --port 3000 --sqlite ./data.dbEnvironment Variables
- DB_MCP_TOOL_FILTER
- TOOL_FILTER
- DATABASE_URI
- SQLITE_DATABASE
- SQLITE_PATH
- POSTGRES_URI
- POSTGRESQL_URI
- MYSQL_URI
- MONGODB_URI
- MONGO_URI
- REDIS_URI
- LOG_LEVEL
- KEYCLOAK_URL
- KEYCLOAK_REALM
- KEYCLOAK_CLIENT_ID
- KEYCLOAK_CLIENT_SECRET
Security Notes
The server has critical SQL injection vulnerabilities. Numerous tools, such as `sqlite_vector_search`, `sqlite_text_split`, `sqlite_json_extract`, `sqlite_stats_basic`, and many others, accept user-provided SQL fragments like `whereClause` or `orderBy` as direct string inputs. These inputs are then concatenated directly into the SQL queries executed against the database without proper escaping or parameterization. This allows an attacker to inject arbitrary SQL, leading to data exfiltration, modification, deletion, or even full database compromise. While a `validateQuery` method exists, it performs only basic pattern matching and is insufficient to prevent sophisticated SQL injection attacks. The `no-console` ESLint rule is good for MCP's stdio transport, and OAuth implementation uses the `jose` library correctly, but these do not mitigate the core SQL injection risk.
Similar Servers
mcp-container-ts
Provides a secure, extensible Model Context Protocol (MCP) server using Node.js and TypeScript, designed to expose custom tools to LLMs, deployable on Azure Container Apps with robust JWT and RBAC security.
sqlite-mcp
A Model Context Protocol (MCP) server that enables LLMs to interact with SQLite databases by providing tools and resources for querying and managing data.
mcp-mysql-server
Provides an MCP-compliant interface for AI models to securely interact with a MySQL database for CRUD operations, schema inspection, and performance analysis.
sqlite-mcp-server
Provides an MCP interface for an SQLite database, offering a wide range of data management, advanced analytics, JSON processing, text/vector search, and geospatial capabilities.