Langchain Data Agent

v1.0.0Data Science & MLstable

NL2SQL - Ask questions in plain English, get SQL queries and results. Powered by LangGraph.

a2aa2a-protocolai-agentsazuredata-agent
Share:
231
Stars
0
Downloads
0
Weekly
0/5

What is Langchain Data Agent?

Langchain Data Agent is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to nl2sql - ask questions in plain english, get sql queries and results. powered by langgraph.

NL2SQL - Ask questions in plain English, get SQL queries and results. Powered by LangGraph.

This server falls under the Data Science & ML category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • NL2SQL - Ask questions in plain English, get SQL queries and

Use Cases

Convert natural language to SQL queries
Enable database access with NL2SQL
Build data analysis agents
eosho

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 10, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langchain-data-agent

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Langchain Data Agent

Langchain Data Agent is a natural-language-to-SQL (NL2SQL) platform built on LangGraph and Azure OpenAI that lets you query databases in plain English and receive formatted results without writing any SQL. It supports multiple database backends including PostgreSQL, Azure SQL, Azure Synapse, Azure Cosmos DB, Databricks SQL, and Google BigQuery, and automatically routes your question to the correct data agent based on context. Teams that need business analysts or non-technical users to access structured data directly through conversational AI will benefit the most from this server.

Prerequisites

  • Python 3.12 or higher
  • uv package manager (https://docs.astral.sh/uv/)
  • An Azure OpenAI deployment with a model endpoint and API key
  • A running database instance (PostgreSQL, Azure SQL, Cosmos DB, Databricks, BigQuery, or Synapse)
  • An MCP-compatible client such as Claude Desktop or Cursor
1

Clone the repository and install dependencies

Clone the project and use uv to sync all dependencies including optional extras for your target database backends.

git clone https://github.com/eosho/langchain_data_agent
cd langchain_data_agent
uv sync --all-extras
2

Configure environment variables

Copy the example environment file and fill in your Azure OpenAI credentials and database connection strings. The .env file must be edited before the server can connect to any data source.

cp .env.example .env
# Edit .env and set:
# AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
# AZURE_OPENAI_API_KEY=your_api_key
# AZURE_OPENAI_DEPLOYMENT=your_deployment_name
# DATABASE_URL=postgresql://user:pass@host:5432/dbname
3

Validate configuration files

Use the data-agent CLI to validate your YAML configuration files for each data source before running queries.

data-agent validate
4

Test the CLI with a single query

Run a natural language query against your configured data source to confirm the setup is working end-to-end.

data-agent query "How many orders were placed last month?"
# Or target a specific config:
data-agent query "What is the total revenue by region?" -c contoso
5

Start the interactive chat mode

Launch the multi-turn interactive chat mode, which maintains conversation context so follow-up questions like 'Show me a bar chart of that' work correctly.

data-agent chat
6

Optionally launch the Chainlit web UI

For a browser-based interface with data visualization support, start the Chainlit web UI instead of the CLI.

chainlit run src/data_agent/ui/app.py

Langchain Data Agent Examples

Client configuration

Claude Desktop configuration to run the data agent as an MCP server process. Adjust the directory path to where you cloned the repo.

{
  "mcpServers": {
    "langchain-data-agent": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/langchain_data_agent",
        "data-agent"
      ],
      "env": {
        "AZURE_OPENAI_ENDPOINT": "https://your-resource.openai.azure.com/",
        "AZURE_OPENAI_API_KEY": "your_api_key",
        "AZURE_OPENAI_DEPLOYMENT": "your_deployment_name"
      }
    }
  }
}

Prompts to try

Natural language queries that the data agent translates to SQL and executes against your configured databases.

- "How many orders were placed last month?"
- "What is the total revenue by region for Q4?"
- "Show me all high-severity fraud alerts from the past week."
- "Who are the top 5 customers by transaction volume? Show me a bar chart."
- "What is the average daily rate by room type?"
- "Which products need to be reordered based on current inventory levels?"

Troubleshooting Langchain Data Agent

The agent returns 'No config found' or fails to route the query to a data agent

Run 'data-agent configs' to list available configuration files and 'data-agent validate' to check for YAML errors. Make sure your .env file has the correct DATABASE_URL and Azure OpenAI credentials set.

SQL validation errors when querying Azure SQL or Synapse

The system uses sqlglot for dialect-specific validation. Ensure your YAML config file specifies the correct dialect (e.g., 'tsql' for Azure SQL, 'sparksql' for Databricks). Check the docs/DATABASE_SETUP.md file in the repository for dialect-specific setup.

Azure AD authentication fails when connecting to Azure SQL or Cosmos DB

The server supports Azure AD token-based auth. Set the AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID environment variables in your .env file and ensure your service principal has the required database role assignments.

Frequently Asked Questions about Langchain Data Agent

What is Langchain Data Agent?

Langchain Data Agent is a Model Context Protocol (MCP) server that nl2sql - ask questions in plain english, get sql queries and results. powered by langgraph. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Langchain Data Agent?

Follow the installation instructions on the Langchain Data Agent GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Langchain Data Agent?

Langchain Data Agent works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Langchain Data Agent free to use?

Yes, Langchain Data Agent is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Data Science & ML MCP Servers

Explore all data science & ml servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "langchain-data-agent": { "command": "npx", "args": ["-y", "langchain-data-agent"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Langchain Data Agent?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides