SQL Query Tools MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MAX_ROWS | No | Maximum rows returned per query. | 200 |
| SQL_USER | Yes | The database user. | |
| AUDIT_LOG | No | Set to true to enable audit logging. | false |
| SQL_SERVER | Yes | The SQL Server hostname or IP address. | |
| SQL_ENCRYPT | No | Set to true for Azure SQL or cloud servers. | false |
| SQL_DATABASE | Yes | The database name. | |
| SQL_INSTANCE | No | Named instance of SQL Server (leave empty if default). | |
| SQL_PASSWORD | Yes | The database password. | |
| AUDIT_LOG_DIR | No | Directory for audit log files. | ./logs |
| ALLOWED_TABLES | No | Comma-separated list of allowed tables/views (supports wildcards). Leave empty for all. | |
| SQL_QUERY_TIMEOUT | No | Query timeout in milliseconds. | 30000 |
| SQL_TRUST_SERVER_CERT | No | Set to true to trust server certificate. | true |
| SCHEMA_CACHE_TTL_MINUTES | No | Cache duration for schema in minutes. | 5 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| db_test_connectionA | Tests the connection to SQL Server and returns basic server information. Use this first to verify the server is reachable before running other tools. |
| db_describe_schemaA | Returns all available tables and views with their column count. Use this first to understand what data is available before writing queries. Results are cached to avoid repeated database calls. |
| db_describe_tableA | Returns full column details (name, data type, nullable) for a specific table or view. Use this when you need to know exact column names before writing a query. |
| db_sample_dataA | Returns 5 sample rows from a table or view. Use this to understand the actual data format, values and patterns before writing a more specific query. |
| db_run_readonlyA | Executes a SELECT query on SQL Server. Only read operations are allowed — write operations are blocked. TOP is automatically injected if no row limit is present. Use db_describe_schema and db_describe_table first if you are unsure about table or column names. |
| db_list_databasesA | Returns the currently connected database name and status. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
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/negrip/mcp-sqlserver-readonly'
If you have feedback or need assistance with the MCP directory API, please join our Discord server