Productivity

Productivity

Feb 23, 2026

Feb 23, 2026

SQL MCP Server Guide: Connecting AI Agents to Databases in February 2026

Learn how to set up SQL MCP servers to connect AI agents to databases securely. Covers Azure SQL, authentication, and read-only security. February 2026 guide.

image of Xavier Pladevall

Xavier Pladevall

Co-founder & CEO

image of Xavier Pladevall

Xavier Pladevall

Setting up a Claude MCP SQL server involves editing JSON configuration files, managing database credentials, and making sure your AI assistant can load schema context without exposing admin permissions. The friction shows up in connection strings that Azure rejects, environment variables that don't propagate, and MCP server binaries that your IDE can't find in PATH. This guide covers Azure SQL Database setup with Entra ID, on-premises SQL Server authentication, and the read-only security model that prevents accidental deletes from reaching your tables.

TLDR:

  • SQL MCP servers connect AI assistants to databases via a standardized protocol.

  • You can authenticate via SQL credentials, Windows auth, or Azure Active Directory tokens.

  • Text-to-SQL through MCP lets business users query databases in English without SQL knowledge.

  • Always create read-only database users and turn on query logging to prevent accidental writes.

  • Index turns natural language queries into charts and collaborative dashboards with pre-built SaaS metrics.

What SQL MCP Servers Are and Why They Matter

The Model Context Protocol (MCP) is an open standard from Anthropic that gives AI assistants a structured way to connect to external data sources. Instead of building one-off integrations for every AI tool and database combination, MCP creates a shared language between them.

SQL MCP servers act as translators. They sit between AI assistants like Claude or Cursor and your databases, exposing schema information and query capabilities through a standardized interface. When you ask an AI agent a question about your data, the MCP server handles the connection, authentication, and query execution behind the scenes.

The math here matters. Without MCP, connecting M AI tools to N databases requires M×N custom integrations. Each new tool or data source multiplies the engineering work. MCP collapses that to M+N: build one MCP server per database type, one MCP client per AI tool, and they all work together.

This standardization lets AI agents query databases without hard-coded connectors for every possible pairing.

Setting Up Authentication for SQL MCP Servers

SQL MCP servers support three main authentication paths, each with different tradeoffs for security and day-to-day complexity.

SQL Server Authentication uses username and password credentials passed directly in the connection string. For local development, this works fine. For production, store credentials in environment variables or a secrets manager instead of hardcoding them in config files.

Windows-integrated auth relies on the credentials of the process running the MCP server. The AI assistant inherits database access from the Windows account that launched it. This eliminates password management but ties authorization to OS-level identity.

Cloud deployments to Azure SQL Database can authenticate through Azure Active Directory, using managed identities or service principals. Azure handles token refresh and rotation automatically, reducing the surface area for credential leaks.

The critical rule: create a dedicated read-only database user for your MCP server. Grant SELECT permissions only on the specific schemas and tables the AI needs to query.

Authentication Method

How It Works

Best Use Case

Security Considerations

SQL Server Authentication

Username and password credentials passed directly in the connection string. Credentials are validated by the database server itself.

Local development environments and testing scenarios where simplicity matters more than maximum security.

Store credentials in environment variables or secrets manager. Never hardcode in config files. Credentials travel over the network and require TLS encryption.

Windows Integrated Authentication

MCP server inherits database access from the Windows account that launched the process. No password transmission occurs.

On-premises deployments where Active Directory already manages user identity and your MCP server runs on Windows infrastructure.

Authorization is tied to OS-level identity. The Windows account needs appropriate SQL Server login mappings. Reduces password management overhead.

Azure Active Directory (Entra ID)

Token-based authentication using managed identities or service principals. Azure handles automatic token refresh and rotation behind the scenes.

Cloud deployments to Azure SQL Database where you want centralized identity management and automatic credential rotation.

Requires tenant ID, client ID, and client secret stored as environment variables. Reduces credential leak surface area. Firewall rules still apply at the network layer.

Connecting Azure SQL Database with MCP Servers

Azure SQL Database connection strings need the fully qualified server name: your-server.database.windows.net. Your MCP server config file expects the database name, server endpoint, and either SQL credentials or Entra ID parameters.

For Entra ID (formerly Azure AD), define the authentication type in your SQL connection parameters and include the tenant ID. The MCP server requests tokens on its own. Store AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET as environment variables instead of hardcoding them in JSON files.

Azure rejects unencrypted connections at the network layer, so you can drop the Encrypt=True flag. The real friction point: Azure SQL blocks IP access by default. Add your MCP server's IP to the firewall allow list, or turn on Azure service access if both sit in the same environment.

Integrating SQL MCP Servers with Claude Desktop and Cursor

Claude Desktop reads its MCP server configuration from claude_desktop_config.json, typically located in ~/Library/Application Support/Claude on macOS or %APPDATA%/Claude on Windows. Add your SQL MCP server as a new entry under the mcpServers object:

{
  "mcpServers": {
    "sql-server": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-mssql"],
      "env": {
        "SQL_CONNECTION_STRING": "Server=your-server;Database=your-db;..."
      }
    }
  }
}

Restart Claude Desktop after saving. The MCP server appears in the connection status indicator at the bottom of the chat window.

Cursor IDE follows the same config file pattern but looks for .cursor/config.json in your project root. The structure mirrors Claude Desktop, but Cursor launches the MCP server per project, not globally.

Common failure points: the MCP server binary not found in PATH, connection strings with unescaped special characters, and firewall rules blocking outbound database connections. Check the AI assistant's developer console for MCP server logs.

Text-to-SQL Capabilities Through MCP

MCP servers cut out the queue: business users ask questions in English, get database answers without waiting on analysts. The AI needs schema context: table names, column names, column types, and relationships to write correct SQL without hallucinating structure, similar to how a semantic layer provides consistent business logic.

The flow: type "show revenue by product category this quarter" into Claude or Cursor, an example of conversational BI in action. The MCP server loads the schema into the context. The LLM writes a SELECT with correct joins and filters. The server runs the query and returns rows.

Multi-table questions work if schema relationships are clean. Ask about customer lifetime value, and the model finds orders, customers, and payments, then builds JOIN logic from foreign keys. That only works when your schema actually documents those links.

Security Best Practices for SQL MCP Deployments

Treat your MCP server like any other database client: minimum permissions, no more. Create a dedicated SQL user per instance. Grant SELECT only on necessary schemas and tables. Never use admin accounts or credentials for INSERT, UPDATE, or DELETE operations in exploratory queries.

Read-only mode stops accidents before they happen. Most SQL MCP servers include a configuration flag to reject non-SELECT statements at the server level. Turn it on. If your LLM generates a DROP or DELETE by mistake, the server blocks it before reaching your database.

Environment variables keep credentials out of version control. Store connection strings, passwords, and tenant IDs in .env files or a secrets manager like HashiCorp Vault or AWS Secrets Manager. Reference them in your MCP config with $SQL_CONNECTION_STRING syntax. Hardcoding credentials in JSON files puts them in Git history forever.

Connection encryption should be non-negotiable. Cloud databases like Azure SQL and AWS RDS enforce TLS by default. For on-premises SQL Server, verify that Encrypt=True appears in your connection string, and that your server has a valid certificate configured.

Audit logging tracks what queries the AI actually runs. Turn on query logging at the database or MCP server level. You need visibility into which tables get accessed, how often, and whether sensitive columns leak into the LLM context. Review logs weekly during initial rollout, then monthly once patterns stabilize.

MCP Adoption and the Enterprise AI Shift in 2026

One year after launch, MCP has achieved 97M+ monthly SDK downloads, backed by Anthropic, OpenAI, Google, and Microsoft. Analysts project the MCP market will reach $10.3B by 2025, with a 34.6% CAGR.

Pilot projects are moving into production. The protocol is no longer an experiment.

SQL MCP servers sit at the center of this shift. They connect LLMs to the data layer where actual business logic lives. Early teams running text-to-SQL queries are now deploying agents that read schemas, write joins, and return results without human intervention, part of a broader trend in natural language query tools.

The gap between demo and deployment is closing.

Database Access Patterns for Business Intelligence

SQL MCP servers handle connection and query execution, but raw SQL responses don't build dashboards, track metrics over time, or share insights with stakeholders.

BI tools turn those queries into charts, cohort analyses, and recurring reports that teams use for decisions.

The pattern: an MCP server lets you ask "what was revenue last month" and returns a number. A BI layer takes that same question, visualizes the trend over twelve months, compares it to the forecast, and saves the chart to a dashboard that refreshes daily.

Index covers both sides. Natural language queries work like text-to-SQL, but instead of returning rows, you get visualizations, collaborative editing, and pre-modeled metrics for SaaS businesses. The query is in English, the results appear as a chart, and your team can comment and iterate together.

Final Thoughts on Deploying SQL MCP Servers in Production

Azure SQL MCP servers and other database connectors give your AI direct access to query your data in natural language. You skip the manual SQL writing, get answers faster, and reduce the bottleneck on your data team. The next step after getting query results is turning them into repeatable BI workflows with charts and shared metrics. Book a demo to see how Index turns those same queries into collaborative, visual experiences.

FAQs

How do I configure an SQL MCP server to connect with Claude Desktop?

Edit the claude_desktop_config.json file in your application support directory, add your SQL MCP server entry under mcpServers with the command, arguments, and connection string as environment variables, then restart Claude Desktop to activate the connection.

What database permissions should I grant to an MCP server in production?

Create a dedicated read-only user with SELECT permissions only on the specific schemas and tables your AI needs to query. Never use admin credentials or accounts with INSERT, UPDATE, or DELETE rights for exploratory queries.

Can MCP servers handle multi-table queries across foreign key relationships?

Yes, MCP servers load your database schema including table relationships and foreign keys into the AI's context. The LLM uses that schema information to generate correct JOIN logic when you ask questions that span multiple tables.

What's the difference between SQL MCP servers and business intelligence tools?

SQL MCP servers handle connection and query execution, returning raw data rows in response to natural language questions. BI tools take that same data and turn it into charts, dashboards, and recurring reports that teams use for decisions over time.

How do I store database credentials securely for MCP deployments?

Store connection strings, passwords, and tenant IDs in environment variables or a secrets manager like HashiCorp Vault or AWS Secrets Manager. Reference them in your MCP config with variable syntax instead of hardcoding credentials in JSON files that end up in version control.