Skip to main content
Glama

Database Query MCP

by NewToolAI

image

Python Version License

[ 中文 | English ]

db-query-mcp

Introduction

db-query-mcp is an MCP tool that enables data querying and export operations across diverse databases, featuring:​

  • Multi-Database Support: Full compatibility with mainstream relational databases (MySQL, PostgreSQL, Oracle, SQLite, etc.)
  • Secure Access: Default read-only mode connection ensures data safety
  • Smart Query: Provides efficient SQL generation and execution capabilities
  • Data Export: Supports query result export functionality
  • Future versions will expand support for Elasticsearch, MongoDB, and graph databases, aiming to become a full-stack database query solution.

Demo

https://github.com/user-attachments/assets/51d0e890-27b2-411d-b5c3-e748599a9543

Installation

pip install db-query-mcp

Install from GitHub:

pip install git+https://github.com/NewToolAI/db-query-mcp

MySQL requires additional dependencies:

pip install pymysql

PostgreSQL requires additional dependencies:

pip install psycopg2-binary

For other databases, install their respective connection packages:

DatabaseConnection PackageExample Connection String
SQLiteBuilt-in Pythonsqlite:///example.db
MySQLpymysql or mysql-connector-pythonmysql+pymysql://user:password@localhost/dbname
PostgreSQLpsycopg2 or psycopg2-binarypostgresql://user:password@localhost:5432/dbname
Oraclecx_Oracleoracle+cx_oracle://user:password@hostname:1521/sidname
SQL Serverpyodbc or pymssqlmssql+pyodbc://user:password@hostname/dbname

Configuration

{ "mcpServers": { "db_query_mcp": { "command": "db-query-mcp", "args": [ "--db", "mysql+pymysql://user:password@host:port/database" ] } } }
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A versatile tool that enables querying and exporting data from multiple relational databases (MySQL, PostgreSQL, Oracle, SQLite, etc.) in read-only mode for data safety.

  1. Introduction
    1. Demo
      1. Installation
        1. Configuration

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            Provides read-only access to PostgreSQL databases, enabling users to inspect database schemas and execute read-only queries through a Model Context Protocol server.
            Last updated -
            3
            JavaScript
          • -
            security
            A
            license
            -
            quality
            DButils is an all-in-one MCP service that enables your AI to do data analysis by accessing versatile types of database (sqlite, mysql, postgres, and more) within a unified connection configuration in a safe way.
            Last updated -
            69
            Python
            MIT License
            • Linux
            • Apple
          • -
            security
            F
            license
            -
            quality
            Provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only SQL queries within a secure transaction context.
            Last updated -
            16,948
            JavaScript
            • Apple
          • -
            security
            F
            license
            -
            quality
            Provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only SQL queries.
            Last updated -
            16,948
            JavaScript
            • Apple

          View all related MCP servers

          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/NewToolAI/db-query-mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server