"
Dalineage provides an MCP (Model Context Protocol) server that allows AI assistants and other tools to interact with the SQL parser directly via REST API.
MCP (Model Context Protocol) is a standard protocol for AI assistants to interact with external tools and services. The Dalineage MCP server exposes parsing capabilities through a simple REST endpoint.
The MCP server provides a parser endpoint that accepts SQL code in various dialects and returns the Abstract Syntax Tree (AST).
POST /api/parser/{dialect}
oracle
- Oracle SQLtsql
- Microsoft SQL Server / T-SQLbigquery
- Google BigQuerysnowflake
- Snowflaketeradata
- Teradataimpala
- Apache Impalaredshift
- Amazon Redshiftpowerbi
- Power BI M languageThe endpoint requires HTTP Basic Authentication (same as other API endpoints).
The response is a JSON object with the following structure:
Success response:
{
"status": "success",
"data": {
"type": "Script",
"statementCount": 2,
"ast": "Script(\n statements = List(\n SelectQuery(...),\n InsertQuery(...)\n )\n)"
}
}
Error response:
{
"status": "error",
"data": "Parsing failed: unexpected token at line 5..."
}
curl -X POST http://localhost:8080/api/parser/oracle \
-u admin:admin \
-H "Content-Type: text/plain" \
-d "SELECT * FROM employees WHERE salary > 1000"
curl -X POST http://localhost:8080/api/parser/tsql \
-u admin:admin \
-H "Content-Type: text/plain" \
-d "SELECT TOP 10 * FROM customers WHERE country = 'USA'"
curl -X POST http://localhost:8080/api/parser/bigquery \
-u admin:admin \
-H "Content-Type: text/plain" \
-d "SELECT * FROM \`project.dataset.table\` WHERE date > '2023-01-01'"
curl -X POST http://localhost:8080/api/parser/snowflake \
-u admin:admin \
-H "Content-Type: text/plain" \
--data-binary @my_script.sql
curl -X POST http://localhost:8080/api/parser/oracle \
-u admin:admin \
-H "Content-Type: text/plain" \
-d "SELECT * FROM employees" | jq
The AST (Abstract Syntax Tree) is returned as a formatted string representation using the same format as internal Dalineage processing. This representation shows:
AI assistants can use this endpoint to:
Development tools can integrate the parser to:
Automated pipelines can use the parser to:
Static analysis tools can:
The parser returns detailed error messages when parsing fails:
{
"status": "error",
"data": "Parsing failed: Expected identifier:1:8, found \"FROM\""
}
Error messages include:
The MCP server uses the same configuration as the main Dalineage application:
-Dserver.port=XXXX
)The parser endpoint: