This MCP Server provides SQL query execution capabilities across multiple database systems through RESTful API endpoints and specialized tools.
Core Capabilities:
Execute SQL queries against PostgreSQL, MySQL, Microsoft SQL Server, and Oracle databases via the
/sql/query
endpointRun parameterized, allow-listed SQL templates using the
run_named_query
tool with named parameters for dynamic executionList all configured databases using the
/dbs
endpointCheck server status and health via the
/health
endpointExecute custom SQL queries for data retrieval, manipulation, schema information, and table listings
Additional Features:
Access sample data from themed databases (Library, E-commerce, Hospital, University systems) for testing and demonstration
Support for tools like Postman for API testing and interaction
Specify target database types (e.g.,
pg
,mysql
,mssql
,oracle
) for precise query execution
Provides tools for executing named SQL queries against a SQLite database using allow-listed templates for safe database operations.
API Endpoint MCP Server
Tools existed inside this MCP Server (As 10 September 2025):
- SQL tools for different databases (Postgres, MySQL, SQL, Oracle)
SQL tools for different databases (Postgres, MySQL, SQL, Oracle)
After you deploying the MCP Server on the website, you will get a particular link called Base URL. With that link, you be able to access some information through the endpoints that is specified. If your Base URL such as http://localhost:8787
, then you can use the endpoints as http://localhost:8787/health
. You can test the endpoints using Postman as well.
This MCP Server does not manage multiple databases of the same type. Instead, it provides connectivity to multiple database system (Postgres, MySQL, MSSQL, Oracle). Each system is configured independently via environment variables, and queries are executed againts the selected DB.
Note: We can extend the current MCP Server to support not only multiple database types but also multiple instances of the same database type if needed.
Below are the endpoints under the SQL Tools:
Method | Endpoint | Description |
---|---|---|
GET | /dbs | Lists all configured databases. |
GET | /health | Health check endpoint (server status). |
POST | /sql/query | Executes an SQL query against a database. |
To specify what should be sent to the /sql/query
, you have to send in JSON form with 2 information:
"db"
: To specify what kind of database that we wanted it to be connected to."pg"
: PostgreSQL"mysql"
: MySQL"mssql"
: Microsoft SQL"oracle"
: Oracle
"sql"
: SQL Queries based on the database used.
Below is the exact format:
Database Used and Data
In this project, multiple relational database system were tested to ensure compatibility with the MCP Server. The database used are:
- PostgreSQL
- MySQL
- Microsoft SQL Server (MSSQL)
- Oracle Database
Each database contains two custom tables with a few sample rows of data.
- The tables are designed with different themes per database (e.g., hospital system, university system, employee system, etc.) so that outputs can be easily distinguished during testing.
- This prevents confusion when retrieving results and makes it clear which database the data originated from.
1) POSTGRESQL DATABASE (Library System)
TABLE NAME: books
book_id | title | author | genre | year_published |
---|---|---|---|---|
1 | The Silent Forest | John Rivers | Fiction | 2015 |
2 | Data Science Simplified | Alice Tan | Education | 2020 |
2 | Demon Slayer: Kimetsu no Yaiba | Koyoharu Gotouge | Fiction | 2016 |
TABLE NAME: members
member_id | name | join_date | active | |
---|---|---|---|---|
101 | Sarah Lim | sarah@example.com | 2021-03-10 | true |
102 | Ahmad Zaki | ahmad.zaki@example.com | 2022-07-22 | false |
103 | Megan Raaj | megan.raaj@example.com | 2025-09-10 | false |
Testing Using Postman to retrieve information:
2) MySQL Database (E-commerce Store)
TABLE NAME: products
product_id | name | category | price | stock |
---|---|---|---|---|
501 | Laptop X100 | Electronics | 3500.00 | 15 |
502 | Running Shoes | Sports | 280.00 | 50 |
503 | Office Table | Furniture | 200.00 | 10 |
TABLE NAME: orders
order_id | product_id | customer_name | quantity | order_date |
---|---|---|---|---|
9001 | 501 | Daniel Wong | 1 | 2024-12-15 |
9002 | 502 | Mei Li | 2 | 2025-01-20 |
9003 | 503 | Syahid Akbar | 2 | 2025-09-10 |
Testing Using Postman to retrieve information:
3) MSSQL Database (Hospital Management)
TABLE NAME: patients
patient_id | full_name | dob | blood_type | admitted |
---|---|---|---|---|
P001 | Kevin Smith | 1990-05-21 | O+ | 2025-02-01 |
P002 | Aisha Rahman | 1985-11-03 | A- | 2025-02-07 |
P003 | Ariff Hafizal | 2001-08-06 | AB | 2025-09-01 |
TABLE NAME: doctors
doctor_id | name | specialty | phone | available |
---|---|---|---|---|
D001 | Dr. Michael | Cardiology | 012-3456789 | Yes |
D002 | Dr. Nur Farah | Pediatrics | 019-8765432 | No |
D003 | Dr. Abd. Rahman | Surgeon | 011-78150955 | Yes |
Testing Using Postman to retrieve information:
4) Oracle Database (University System)
TABLE NAME: COURSES
course_id | course_name | department | credits | semester |
---|---|---|---|---|
CSE101 | Intro to Computer Science | Computing | 4 | Fall |
BUS201 | Marketing Basics | Business | 3 | Spring |
ENG301 | Thermodynamics | Engineering | 4 | Fall |
TABLE NAME: STUDENTS
student_id | name | major | gpa | enrollment_year |
---|---|---|---|---|
S1001 | Raj Kumar | Computer Science | 3.8 | 2021 |
S1002 | Emily Tan | Business Administration | 3.5 | 2020 |
S1003 | Ahmad Ali | Mechanical Engineering | 3.2 | 2019 |
Testing Using Postman to retrieve information:
Database Environments
The MCP Server uses environment variables for database connections.
- Not all environments are required.
- If an environment for a database type is missing, the server will still run (It can be used for all database or just use for your desired database).
- This project do supports SQLite but it will not be focused on since SQLite is usually for the local testing.
Variable | Usage / Description | Example Value |
---|---|---|
MYSQL_HOST | Hostname or IP address of the MySQL server | 127.0.0.1 |
MYSQL_PORT | Port number for the MySQL server (default: 3306 ) | 3306 |
MYSQL_USER | Username to authenticate with the MySQL server | root |
MYSQL_PASSWORD | Password for the MySQL user | mypassword |
MYSQL_DB | Name of the MySQL database to connect to | test_db |
PG_HOST | Hostname or IP address of the PostgreSQL server | 127.0.0.1 |
PG_PORT | Port number for the PostgreSQL server (default: 5432 ) | 5432 |
PG_USER | Username to authenticate with the PostgreSQL server | postgres |
PG_PASSWORD | Password for the PostgreSQL user | secret123 |
PG_DB | Name of the PostgreSQL database to connect to | sampledb |
MSSQL_HOST | Hostname or IP address of the Microsoft SQL Server | 127.0.0.1 |
MSSQL_PORT | Port number for the Microsoft SQL Server (default: 1433 ) | 1433 |
MSSQL_USER | Username to authenticate with the Microsoft SQL Server | sa |
MSSQL_PASSWORD | Password for the Microsoft SQL Server user | P@ssw0rd! |
MSSQL_DB | Name of the Microsoft SQL Server database to connect to | hospital_db |
ORACLE_CONNECT_STRING | Oracle EZConnect string in the format host:port/service_name | 127.0.0.1:1521/XEPDB1 |
ORACLE_USER | Username to authenticate with the Oracle database | system |
ORACLE_PASSWORD | Password for the Oracle user | oracle123 |
Deployment to Azure Web App
Delete the existing node_modules and installs dependencies exactly as listed in your package-lock.json
(ci = clean install):
Runs the build script in your package.json under "scripts":
Delete the existing node_modules and installs dependencies exactly as listed in your package-lock.json (ci = clean install):
Runs the build script in your package.json under "scripts":
Remove of the directory if exist:
Make directory to be zipped:
Copy project sources and assets Oryx needs. If you read any templates at runtime, include them too. DO NOT copy node_modules
(Oryx will install on Linux):
Build a ZIP whose root is the content (not a nested folder):
Azure Login:
Set runtime to Node 20 LTS:
Enable build automation (Oryx):
Deploy to Azure:
Enable Logs and Monitor to view (In another cmd):
Find the outbound IP - to put in the SQL Server if your server is inside Azure
Tools
A starter template for building MCP servers with SQLite database integration. Provides a foundation with SQL query tools, database seeding capabilities, and a development client for testing.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol (MCP) server implementation that provides database interaction and business intelligence capabilities through SQLite. This server enables running SQL queries, analyzing business data, and automatically generating business insight memos.Last updated -68,079MIT License
- -securityFlicense-qualityAn MCP server that provides safe, read-only access to SQLite databases through MCP. This server is built with the FastMCP framework, which enables LLMs to explore and query SQLite databases with built-in safety features and query validation.Last updated -84
- -securityAlicense-qualityA template project for building custom MCP servers that enables direct access to PostgreSQL databases, allowing SQL query execution and schema information retrieval through the Model Context Protocol.Last updated -31MIT License
- -securityAlicense-qualityA lightweight MCP server that provides read-only access to SQLite databases, allowing users to execute SELECT queries, list tables, and describe table schemas.Last updated -MIT License