Skip to main content
Glama
urjeetpatel

db-tools-mcp

by urjeetpatel

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DB_TOOLS_CONFIG_DIRNoOverride the configuration and cache directory location. Defaults to ~/.config/db-tools/.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_sourcesA

List all database sources available in the local metadata cache.

list_schemasC

List all schemas for a given source.

list_tablesB

List all tables in a given schema.

get_tableC

Get columns and FK relationships (inbound + outbound) for a specific table.

get_dialectC

Return the SQL dialect for a source (e.g. 'mssql', 'snowflake').

list_all_foreign_keysC

Return every foreign key defined in a schema.

find_direct_joinsB

Return FK-defined direct joins between two tables (either direction). Provide table names as 'schema.table' (e.g. 'dbo.Orders').

suggest_joinsA

Suggest join paths between two tables using FK graph + heuristic column matching. Results ordered by descending confidence. Table names as 'schema.table'.

search_tablesB

Search for tables whose names contain keyword (case-insensitive).

search_columnsB

Search for columns whose names contain column_name (case-insensitive). Optionally restrict to a single schema.

list_stored_proceduresC

List all stored procedure names in a given schema.

get_stored_procedureA

Get full metadata for a stored procedure: parameters, create/modify dates, and definition.

search_stored_proceduresA

Search for stored procedures whose names contain keyword (case-insensitive). Optionally restrict to a single schema.

search_stored_procedure_textA

Search the body (definition) of stored procedures for keyword (case-insensitive). Returns each matching procedure with a short excerpt showing the first line that contains the keyword. Optionally restrict to a single schema.

get_call_templateA

Generate a ready-to-use call template for a stored procedure.

style='sql' — EXEC statement with typed placeholders for each parameter. style='python' — pyodbc script that executes the SP and collects every result set returned by the server using cursor.nextset().

export_stored_procedureB

Write the stored procedure definition (SQL code only) to a file.

refresh_metadataA

Refresh the local schema metadata cache by querying live databases.

THIS IS AN EXPENSIVE OPERATION — each source may take several minutes. Do NOT call automatically before reads. The cache is designed to be long-lived. Only call when:

  • No cache exists yet for a source (first-time setup)

  • The user explicitly says a schema has changed

Each source is throttled to one refresh per 24 hours. Set force=True ONLY when the user has confirmed recent schema changes.

add_databaseA

Add a new database source to config.yaml and optionally test the connection.

db_type='sqlserver': url (required) -- SQLAlchemy connection URL, e.g.: "mssql+pyodbc:///?odbc_connect=DRIVER=ODBC Driver 17 for SQL Server; Server=myserver;Database=MyDB;Trusted_Connection=Yes;"

db_type='snowflake' (via SQL Server linked server + OPENQUERY): sqlserver_url (required) -- SQLAlchemy URL for the gateway SQL Server linked_server (required) -- Linked server name (e.g. "SNOWFLAKE") snowflake_database (required) -- Snowflake database (e.g. "MY_DB")

Common: include_schemas -- ["*"] for all (default), or explicit list exclude_schemas -- defaults to system schemas for the db_type test_connection -- set False to skip the live connection test

After adding, call refresh_metadata(source='') to populate the cache.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

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