Database MCP Server
A Model Context Protocol (MCP) server that enables GitHub Copilot and other LLMs to execute read-only SQL queries against Oracle databases.
š¦ Installation
From npm (Recommended)
Or install locally in your project:
From Source
ļæ½š Quick Start with VS Code
If installed via npm:
Configure VS Code MCP settings
Create .vscode/mcp.json:
Reload VS Code and ask Copilot:
If running from source:
See Quick Start Guide for detailed setup.
Features
š Read-only access - Uses a dedicated read-only database user for security
š” stdio transport - Communicates via standard input/output (no HTTP server needed)
ā” Connection pooling - Efficient Oracle connection management
š Schema introspection - Query table and column information
š Audit logging - All queries are logged with execution metrics
ā±ļø Timeout protection - Prevents long-running queries
š”ļø Result limits - Configurable row limits to prevent memory issues
Architecture
Prerequisites
Node.js v18 or higher
Oracle Database with a read-only user created
Running locally (Docker recommended)
Or accessible remote instance
Note: This project uses the node-oracledb package in Thin Mode, which means no Oracle Instant Client installation is required! The pure JavaScript driver connects directly to Oracle Database, just like Python's oracledb library.
Optional: Running Oracle Database Locally with Docker
If you need a local Oracle database for development:
macOS (using Colima):
Linux/Other:
The database will be available at:
Connection:
localhost:1521/XEPDB1SYS password:
OraclePwd123Web UI: http://localhost:5500/em
Setup
1. Clone and Install Dependencies
2. Create Read-Only Database User
Connect to your Oracle database as a DBA and run:
3. Configure Environment Variables
Copy the example environment file:
Edit .env and set your Oracle connection details:
4. Build the Server
5. Configure GitHub Copilot / MCP Client
Create or update your MCP client configuration file:
VS Code (cline_mcp_config.json or similar):
Or use environment variables from your shell:
Usage
Once configured, the MCP server provides two tools to GitHub Copilot:
Testing with the Built-in Client
Before integrating with Copilot, you can test the server locally:
This will:
Start the MCP server
Connect to it via the test client
List available tools
Get database schema (list all tables)
Disconnect and shut down
Edit src/client.ts to customize the test queries.
Using with GitHub Copilot
Once configured, the MCP server provides two tools to GitHub Copilot:
1. query_database
Execute read-only SQL queries:
Parameters:
query(required): SQL SELECT statementmaxRows(optional): Maximum rows to returntimeout(optional): Query timeout in milliseconds
Example:
2. get_database_schema
Get schema information:
Parameters:
tableName(optional): Specific table name, or omit to list all tables
Example Prompts for Copilot
"List all tables in the database"
"Show me the schema of the ORDERS table"
"How many active users do we have?"
"What are the top 5 products by sales this month?"
"Show me recent transactions for customer ID 12345"
Development
Project Structure
Scripts
Logging
All queries and events are logged in JSON format. Logs go to stdout/stderr:
Set LOG_LEVEL=debug in .env for more verbose logging.
Security Considerations
Read-Only User - Database user has only SELECT privileges
Local Client - Designed for trusted local use only
No Injection Protection - Trust the LLM to generate valid queries
Query Limits - Row count and timeout limits prevent resource exhaustion
Audit Logging - All queries logged for review
Troubleshooting
Docker/Colima Issues (macOS)
Docker not running:
Database won't start:
Connection Failed
Solutions:
Check your
ORACLE_CONNECTION_STRINGformat:hostname:port/servicenameFor local Docker: use
localhost:1521/XEPDB1Verify database is running:
docker ps | grep oracle
Permission Denied
Solution: Grant SELECT privileges to your read-only user on the required tables.
Database Not Ready
If the test client fails immediately after starting the database:
Wait 1-2 minutes for Oracle to fully initialize
Check health status:
docker psshould show(healthy)Watch startup logs:
docker logs -f oracle-xe
Thin Mode vs Thick Mode
This project uses Thin Mode (pure JavaScript, no Oracle Client needed). If you encounter issues and want to use Thick Mode:
Install Oracle Instant Client
Add to your code:
oracledb.initOracleClient()before creating the pool
For most use cases, Thin Mode is simpler and works great!
Documentation
š Integration Guides:
MCP Integration Guide - Learn about MCP protocol, tools, and how it works
VS Code Integration Guide - Set up with GitHub Copilot (includes custom instructions)
Claude Desktop Integration Guide - Set up with Claude Desktop
Quick Start Guide - Get started with VS Code in 3 steps ā”
VS Code Agent Mode Plan - Implementation details and troubleshooting
š Test Results:
Test Results - Comprehensive test results with example queries
š Custom Instructions:
.github/copilot-instructions.md- Project-wide Copilot instructions.github/instructions/- Language-specific coding guidelines
License
ISC
Contributing
Contributions welcome! Please open an issue or pull request.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables GitHub Copilot and other LLMs to execute read-only SQL queries against Oracle databases with secure connection pooling and schema introspection capabilities.