Repository navigation
Description
What happened?
Context
I'm building an NPM package that exposes multiple enterprise SQL Server databases through a single MCP (Model Context Protocol) server using Data API Builder (DAB). The goal is to allow AI agents like GitHub Copilot to query hundreds of tables across multiple databases dynamically without manually mapping each table.
I'm using:
- DAB 2.0.9 with multi-source configuration
- autoentities pattern (
%.%) to discover all tables in all schemas at runtime - MCP stdio mode to expose database entities as MCP tools
The Bug
When using multi-source configuration with multiple child configs containing autoentities, DAB successfully starts and loads all entities during initialization, but the MCP describe_entities tool returns NoEntitiesConfigured error.
What Works ✅
- Single database with
autoentities+ MCP works perfectly - Each child config tested individually returns hundreds of entities via
describe_entities - Multi-source with parent + 1 child works
dab validateshows entities are discovered correctly for all configs
What Fails ❌
- Multi-source with parent + 2 or more children:
describe_entitiesreturns no entities - The error message:
"No entities are configured in the runtime configuration." - This happens despite DAB logging "Successfully completed runtime initialization"
Steps to Reproduce
1. Create parent config (dab-config.json):
{
"data-source": {
"database-type": "mssql",
"connection-string": "@env('DATABASE1_CONNSTRING')"
},
"data-source-files": [
"databases/database1/dab-config.json",
"databases/database2/dab-config.json",
"databases/database3/dab-config.json"
],
"runtime": {
"rest": { "enabled": false },
"graphql": { "enabled": false },
"mcp": {
"enabled": true,
"dml-tools": {
"describe-entities": true,
"read-records": true,
"aggregate-records": true
}
},
"host": { "mode": "production" }
},
"entities": {}
}2. Create child config (databases/database1/dab-config.json):
{
"$schema": "https://github.com/Azure/data-api-builder/releases/latest/download/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "@env('DATABASE1_CONNSTRING')"
},
"autoentities": {
"db1": {
"patterns": {
"include": ["%.%"],
"exclude": [],
"name": "db1_{schema}_{object}"
},
"template": {
"rest": { "enabled": false },
"graphql": { "enabled": false },
"mcp": { "dml-tools": true }
},
"permissions": [
{ "role": "anonymous", "actions": [{ "action": "read" }] }
]
}
}
}3. Start DAB:
dab start --mcp-stdio --config dab-config.json --verboseOutput:
info: Azure.DataApiBuilder.Service.Startup[0]
Successfully completed runtime initialization.
4. Send MCP initialize request:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}Response: ✅ Success
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true},"logging":{}},"serverInfo":{"name":"SQL MCP Server","version":"2.0.9"}}}5. Call describe_entities:
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"describe_entities","arguments":{"nameOnly":true}}}Response: ❌ Error
{
"toolName": "describe_entities",
"status": "error",
"error": {
"type": "NoEntitiesConfigured",
"message": "No entities are configured in the runtime configuration."
}
}Expected Behavior
describe_entities should return all entities discovered from child configs via autoentities, with prefixes like:
db1_schema_tabledb2_schema_tabledb3_schema_table
Actual Behavior
NoEntitiesConfigured error is returned, despite:
- All configs loading successfully
- Entities being discovered during validation (
dab validateshows hundreds of entities) - Startup completing without errors
Analysis
The bug appears to be in DAB's config merging logic for multi-source mode. When merging parent + multiple children:
- autoentities successfully discover entities in each child config
- DAB starts and reports successful initialization
- But the merged runtime configuration exposed to MCP contains no entities
- MCP's
describe_entitiestool sees an empty entity list
Single child works because no complex merging is needed. Multiple children fail because autoentities from children don't propagate to the merged runtime configuration that MCP queries.
Environment
- DAB Version: 2.0.9
- Database: SQL Server 2022 (RTM-CU13-GDR)
- OS: Windows
- Node.js: v25.6.0
- MCP Inspector: v0.22.0
Workaround
Run separate DAB instances per database instead of using multi-source, and configure multiple MCP servers in the consumer.
Impact
This prevents using DAB's multi-source feature with autoentities in MCP mode, requiring manual entity mapping or separate server instances per database.
Version
2.0.9
What database are you using?
Azure SQL
What hosting model are you using?
No response
Which API approach are you accessing DAB through?
No response
Relevant log output
info: Azure.DataApiBuilder.Service.Startup[0]
Successfully completed runtime initialization.
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true},"logging":{}},"serverInfo":{"name":"SQL MCP Server","version":"2.0.9"}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"describe_entities","arguments":{"nameOnly":true}}}
{"jsonrpc":"2.0","id":2,"result":{"content":[{"Type":"text","text":"{\r\n \u0022toolName\u0022: \u0022describe_entities\u0022,\r\n \u0022status\u0022: \u0022error\u0022,\r\n \u0022error\u0022: {\r\n \u0022type\u0022: \u0022NoEntitiesConfigured\u0022,\r\n \u0022message\u0022: \u0022No entities are configured in the runtime configuration.\u0022\r\n }\r\n}","type":"text"}],"isError":true}}
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
JerryNixon commentedon Jul 17, 2026
Yep, this is a bug.
Thanks for the detailed reproduction, configuration examples, and MCP request/response output. This is very helpful, and the behavior is consistent with an issue involving the interaction between multi-source configuration, SQL autoentities, and the shared runtime configuration used by MCP.
describe_entities does not expand autoentities itself. It enumerates the entities already present in RuntimeConfig.Entities. During startup, each SQL metadata provider expands its configured autoentities definitions, creates generated entities, and adds them to the runtime configuration. In a multi-source setup, that process must work across all child configurations while preserving the correct entity-to-data-source mapping.
The reported behavior suggests that entity discovery succeeds for the child configurations, but the generated entities are not fully propagated into the final runtime configuration consumed by MCP. This would explain why:
till returns NoEntitiesConfigured.
The difference between validation and runtime startup is important. Validation processes child configurations independently, while MCP reads the final merged runtime configuration. Therefore, successful validation confirms that autoentity discovery can work, but it does not necessarily confirm that all generated entities are available through the runtime MCP configuration.