db-tools-mcp
An MCP server that exposes SQL Server and Snowflake schema metadata to AI coding agents, enabling schema exploration, join path discovery, stored procedure management, and database administration — primarily using a local cache to avoid live queries on every request.
Schema & Metadata Exploration
list_sources,list_schemas,list_tables,get_table,get_dialect,list_all_foreign_keys— browse database sources, schemas, tables, columns, FK relationships, and SQL dialect without live queries
Join Path Discovery
find_direct_joins— find FK-defined direct joins between two tablessuggest_joins— suggest multi-hop join paths using FK graph and heuristic column matching, ordered by confidence
Search
search_tables— search for tables by keywordsearch_columns— search for columns by name across a source or within a specific schema
Stored Procedure Tools
list_stored_procedures,get_stored_procedure,search_stored_procedures,search_stored_procedure_text— list, inspect, and search procedures by name or body textget_call_template— generate a ready-to-use SQLEXECor Pythonpyodbccall templateexport_stored_procedure— write a stored procedure's SQL definition to a file
Live (Uncached) Tools
get_live_stored_procedure— directly connect to any SQL Server via Windows auth to fetch a stored procedure's definition and metadata, bypassing the cache
Admin & Configuration
add_database— register a new SQL Server or Snowflake source with connection details and optional live connection testing (requires user confirmation before modifying config)refresh_metadata— re-scan live databases to update the local schema cache (throttled to once per 24 hours; supports forced refresh)
Provides connectivity to Snowflake databases through a SQL Server linked server, enabling schema exploration, table/column metadata retrieval, foreign key discovery, and stored procedure management without executing live queries on every request.
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., "@db-tools-mcplist tables in dbo schema"
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.
db-tools-mcp
MCP server that exposes SQL Server and Snowflake schema metadata to AI coding agents. It caches table/column/FK information locally and provides tools for searching schemas, finding join paths, and managing database connections — without running live queries on every request. A separate live-lookup tool is available for one-off stored procedure queries against a database directly.
Quick start
1. Install and run with uvx
uvx db-tools-mcpOr install with pip:
pip install db-tools-mcp
db-tools-mcpOr install locally for development:
git clone https://github.com/urjeetpatel/db-tools-mcp.git
cd db-tools-mcp
uv sync
uv run db-tools-mcp2. Register with your MCP client
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"db-tools": {
"command": "uvx",
"args": ["db-tools-mcp"]
}
}
}Claude Code (.mcp.json in your project root):
{
"mcpServers": {
"Db_Tools": {
"command": "uvx",
"args": ["db-tools-mcp"]
}
}
}3. Add your first database
Use the add_database tool through your MCP client:
add_database(
name="my_db",
db_type="sqlserver",
url="mssql+pyodbc:///?odbc_connect=DRIVER=ODBC Driver 17 for SQL Server;Server=myhost;Database=MyDB;Trusted_Connection=Yes;"
)Or copy the example config manually:
# Linux / macOS
mkdir -p ~/.config/db-tools
cp config.example.yaml ~/.config/db-tools/config.yaml
# Windows (PowerShell)
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\db-tools"
Copy-Item config.example.yaml "$env:USERPROFILE\.config\db-tools\config.yaml"Then edit ~/.config/db-tools/config.yaml with your connection details.
4. Populate the cache
refresh_metadata() # all sources
refresh_metadata(source="my_db") # one sourceOr from the command line:
uvx db-tools-refresh
db-tools-refresh --source my_db # if installed locallyRelated MCP server: io.github.Optisol-Business/db-metadata-extractor-mcp
Tools
Read tools (safe, use cached data)
Tool | Description |
| List cached database sources |
| List schemas in a source |
| List tables in a schema |
| Get columns + FK relationships |
| SQL dialect ( |
| All FKs in a schema |
| FK joins between two tables |
| Multi-hop join path suggestions |
| Search table names |
| Search column names |
Stored procedure tools
Tool | Description |
| List stored procedure names in a schema |
| Get SP metadata: parameters, dates, and definition |
| Search SP names (case-insensitive, optional schema filter) |
| Search SP body text for a keyword; returns matching procedures with a one-line excerpt |
| Generate a SQL or Python call template for an SP |
| Write SP definition (SQL only) to a file; returns resolved path + line count |
export_stored_procedure writes the raw SQL definition only — no JSON wrapper. The output_file must be an absolute path to a writable location; writes to system directories, network paths, drive roots, and the db-tools config directory are blocked.
Live (uncached) tools
Tool | Description |
| Connect directly to a SQL Server (Windows auth) and return an SP's definition + metadata, bypassing the metadata cache entirely |
Unlike the stored procedure tools above, get_live_stored_procedure does not use source from config — it opens an ad-hoc Trusted_Connection to any servername/database you specify. Useful for one-off lookups against a database that isn't (or isn't yet) registered as a source. If schema is omitted and multiple procedures share the name across schemas, it returns the candidate schemas instead of guessing.
Admin tools (require confirmation)
Tool | Description |
| Add a source to config + test connection |
| Re-scan live databases (throttled to 1/day) |
Configuration
Config and cache live in ~/.config/db-tools/ (XDG standard):
~/.config/db-tools/
config.yaml # database connections
metadata_cache/ # cached JSON per source
.refresh_state.json # last-refresh timestamps
server.log # MCP server logsOverride the location with DB_TOOLS_CONFIG_DIR or XDG_CONFIG_HOME:
DB_TOOLS_CONFIG_DIR=/custom/path db-tools-mcpSupported source types
SQL Server (direct ODBC):
my_db:
enabled: true
url: "mssql+pyodbc:///?odbc_connect=DRIVER=ODBC Driver 17 for SQL Server;Server=host;Database=db;Trusted_Connection=Yes;"
include_schemas: ["*"]
exclude_schemas: [INFORMATION_SCHEMA, sys, db_owner, ...]Snowflake (via SQL Server linked server / OPENQUERY):
my_snowflake:
enabled: true
sqlserver_url: "mssql+pyodbc:///?odbc_connect=..."
linked_server: "SNOWFLAKE"
database: "MY_SNOWFLAKE_DB"
include_schemas: ["*"]
exclude_schemas: [INFORMATION_SCHEMA]Requirements
Python >= 3.11
ODBC Driver 17 for SQL Server (for SQL Server and Snowflake-via-linked-server connections)
Network access to the target databases
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceEnables AI agents to understand and query your database safely by providing a semantic layer of metadata, with tools to search, explain, validate, and generate safe SQL.2MIT
- Alicense-qualityDmaintenanceEnables extraction and querying of database schema metadata from PostgreSQL, Snowflake, SQL Server, BigQuery, and Oracle databases, saving results locally for analysis.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to execute SQL queries and explore Snowflake databases using natural language, with schema discovery, table inspection, and readonly mode.11741MIT
- Flicense-qualityCmaintenanceExposes SQL Server stored procedures as tools for LLM clients (Claude Desktop, VS Code, Cursor, etc.) enabling direct database interaction through natural language.
Related MCP Connectors
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.
Define, ship & query your analytics tracking from one source of truth, trusted by humans and agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/urjeetpatel/db-tools-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server