Background
In the last month, Microsoft released the MSSQL MCP Server (Preview), a bridge that lets AI applications talk to SQL Server using Model Context Protocol.
The announcement (see official post) sparked my curiosity, I wanted to test-drive natural-language querying against my own databases.
While kicking the tires I discovered a limitation: the preview Node.js implementation only supported Azure Active Directory interactive authentication. That’s perfect for demos, but many real-world deployments still depend on classic SQL logins or Windows auth. Rather than wait for the roadmap, I decided to extend the MCP server myself so the AI-powered SQL agent could run anywhere.
But, why build AI Powered SQL DB Agents?
The promise of natural language database queries is transforming how we interact with data. With the OpenAI Agents SDK and Azure Foundry hosted large language models, developers can now build intelligent agents that translate plain English into optimized SQL queries, execute them safely, and return results instantly.
Here’s how the pieces fit together in a clean, modular flow:

- SQL Agent: Orchestrates user intent, powered by OpenAI Agents SDK.
- Large Language Model: Interprets natural language and generates query logic.
- SQL MCP Server: Custom bridge to SQL environments with extended auth.
- Database: Your on-prem SQL Server or Azure SQL Database.
What I added: Multi-Authentication Support
The official MCP server from Azure Samples (SQLMcp) is a great starting point, but its Node.js version is locked to Azure AD interactive auth, a browser-based flow unsuitable for headless agents or non-Azure setups. I extended the server code to handle:
- SQL Server Authentication: Classic username/password logins.
- Windows Authentication: for domain-joined environments.
- Azure AD: Retained the original interactive method.
This means the AI agent isn’t tied to one auth model, you pick what fits. The updated server is bundled in the repository with setup instructions.
Try It Yourself
- Clone the repo: https://github.com/bhushang19/openai-sql-agent
- Configure your .env with SQL Server details and auth credentials.
- Install dependencies and run the Python agent to start querying in natural language.
Detailed steps are in the README file inside the repository, check the updated MCP Server Setup section for additional details.
Why SQL MCP Matters?
Beyond the cool factor, having SQL MCP implementation unlocks practical value:
- Non-technical users query databases without learning SQL.
- DBAs and devs prototype faster with plain-English inputs.
- Works in legacy on-prem setups or modern cloud environments.
Agent in Action
Since this is just a console based setup, the agent was given a query below in plain English and it took hardly a few seconds for it to respond accurately against the data in SQL Azure database.
Input to agent: Show me the top 10 products by total sales value, including the product name, category, and the total revenue for each, ordered from highest to lowest revenue.
Agent Output: I could have instructed the agent to respond with structured schema or JSON but for simplicity configured it to emit response in table format for better readability.

My Next Steps
This agent is a foundation, I’m already planning updates to it:
- UI Layer: A friendly web or desktop interface for end users.
- Chart Integration: Pairing with a visualization MCP to render query results as graphs
Show me the Code
While you are free to go ahead and check the implementation in the GitHub repository link I have shared above, I’m sharing the code here for quick reference that showcases how the MCP server is integrated with Open AI Agent SDK and how the agent is run.
Wrap-up
Building an AI agent that speaks SQL felt like fiction a few years ago, however today, it’s a weekend project thanks to OpenAI’s SDK and Microsoft’s MCP vision. By extending the MCP server for multiple auth types, we’ve made it usable across different SQL setups. Clone the code, try a query, and let me know what you build. I can already see that someone has created a new PR in official repo of sqlmcp, so we could see extended auth options becoming available for everyone soon hopefully.
References:
Open AI Agent SDK: https://openai.github.io/openai-agents-python
MCP Fundamentals: https://github.com/microsoft/mcp-for-beginners