Skip to content

Conversation

@souvikghosh04
Copy link
Contributor

@souvikghosh04 souvikghosh04 commented Nov 21, 2025

Why make this change?

This change allows entity-level MCP configuration to control which entities participate in MCP runtime tools, providing granular control over DML operations and custom tool exposure.

What is this change?

This change introduces an optional mcp property at the entity level that controls participation in MCP's runtime tools. This is a prerequisite for custom tools support.

The MCP property supports two formats:

  • Boolean shorthand: "mcp": true or "mcp": false
  • Object format: {"dml-tools": boolean, "custom-tool": boolean}

Property Behavior:

  1. Boolean Shorthand ("mcp": true/false)
  • "mcp": true: Enables DML tools only; custom tools remain disabled.
  • "mcp": false: Disables all MCP functionality for the entity.
  1. Object Format ("mcp": { ... })
  • { "dml-tools": true, "custom-tool": true }: Enables both (valid only for stored procedures).
  • { "dml-tools": true, "custom-tool": false }: DML only.
  • { "dml-tools": false, "custom-tool": true }: Custom tool only (stored procedures).
  • { "dml-tools": false, "custom-tool": false }: Fully disabled.

Single-property cases:

  • {"dml-tools": true}: Enables DML only; auto-serializes to "mcp": true.
  • {"custom-tool": true}: Enables custom tool only; serializes as given.
  1. No MCP Configuration in Entity (default)
  • dml-tools will still be enabled by default and no other change is behavior

How was this tested?

  • Unit Tests
  • Integrations Tests
  • CLI Command Testing

Sample CLI commands:

Add table with DML tools enabled

dab add Book --source books --permissions "anonymous:*" --mcp.dml-tools true

Add stored procedure with custom tool enabled

dab add GetBookById --source dbo.get_book_by_id --source.type stored-procedure --permissions "anonymous:execute" --mcp.custom-tool true

Add stored procedure with both properties

dab add UpdateBook --source dbo.update_book --source.type stored-procedure --permissions "anonymous:execute" --mcp.custom-tool true --mcp.dml-tools false

@souvikghosh04 souvikghosh04 self-assigned this Nov 21, 2025
@souvikghosh04 souvikghosh04 added mssql an issue thats specific to mssql config changes related to config mcp-server labels Nov 21, 2025
@souvikghosh04 souvikghosh04 added this to the Nov 2025 milestone Nov 21, 2025
@souvikghosh04 souvikghosh04 linked an issue Nov 21, 2025 that may be closed by this pull request
@souvikghosh04 souvikghosh04 moved this from Todo to Review In Progress in Data API builder Nov 21, 2025
@souvikghosh04 souvikghosh04 marked this pull request as ready for review November 21, 2025 15:16
Copilot AI review requested due to automatic review settings November 21, 2025 15:16
@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces entity-level MCP (Model Context Protocol) configuration support, allowing fine-grained control over entity participation in MCP runtime tools. The changes enable entities to specify whether they participate in DML tools and custom tools through a new mcp property that accepts either a boolean or an object with dml-tools and custom-tool keys.

  • Added EntityMcpOptions class with custom JSON converter for flexible boolean/object serialization
  • Implemented schema validation to restrict custom-tool property to stored procedures only
  • Updated all test configurations and entity constructors to include the new Mcp parameter
  • Added CLI support for --mcp.custom-tool and --mcp.dml-tools flags

Reviewed changes

Copilot reviewed 67 out of 68 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dab-config.PostgreSql.json Added runtime-level MCP config and reordered rest/graphql sections for consistency
dab-config.MySql.json Added runtime-level MCP config, reordered sections, and added Default_Books entity
dab-config.MsSql.json Complete reformatting with whitespace changes and runtime-level MCP config addition
dab-config.CosmosDb_NoSql.json Added runtime-level MCP config, removed telemetry section, reordered rest/graphql blocks
SqlMetadataProviderUnitTests.cs Added Mcp: null to Entity constructor calls
RequestValidatorUnitTests.cs Added Mcp: null parameter to Entity constructor
ConfigValidationUnitTests.cs Added Mcp: null to multiple Entity constructor calls
TestHelper.cs Added Mcp: null to Entity constructor in helper method
MsSqlGraphQLQueryTests.cs Fixed Entity constructor parameter ordering issue
GraphQLQueryTestBase.cs Added Mcp: null to Entity constructors
ConfigurationTests snapshots Updated to reflect mapping changes from Fields to Mappings section
OpenApiDocumentor tests Added Mcp: null to all Entity constructor calls
GraphQLBuilder tests Added Mcp: null to Entity constructors in test helpers
CosmosTests Added Mcp: null to Entity constructors across query and mutation tests
Comments suppressed due to low confidence (1)

src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs:1

  • Missing parameter in Entity constructor call. The constructor expects 8 parameters but line 876 adds an extra null parameter before the permissions array, shifting the parameter positions incorrectly. The Mcp parameter should be added after permissions, not before.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posting comments so far

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25 Aniruddh25 dismissed their stale review December 9, 2025 06:12

Going OOF for a few days - dont want to block

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions to optimise test code. But main requesting change is to ensure DmlToolsEnabled is true even if not provided.

Copy link
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address issues with tests and give answers to comments that were resolved with no visible changes

- Updated MCP DML tools default value to true in EntityMcpOptions.
- Simplified MCP properties in various test snapshots by removing unnecessary fields.
- Consolidated test methods for updating table entities with MCP DML tools into a single parameterized test.
- Removed obsolete test snapshots related to MCP DML tools.
- Enhanced MCP configuration tests to assert default values and behavior more effectively.
- Updated CLI command options help text to reflect new default values for MCP properties.
@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for addressing all the feedback!

@souvikghosh04
Copy link
Contributor Author

/azp run

@souvikghosh04 souvikghosh04 enabled auto-merge (squash) December 16, 2025 18:48
@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

@RubenCerna2079 RubenCerna2079 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the changes :)

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 merged commit 9dad3d5 into main Dec 17, 2025
11 checks passed
@souvikghosh04 souvikghosh04 deleted the Usr/sogh/entity-level-mcp-config branch December 17, 2025 04:07
@github-project-automation github-project-automation bot moved this from Review In Progress to Done in Data API builder Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config changes related to config mcp-server mssql an issue thats specific to mssql

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add tests for entity MCP config Add mcp option at entity level

5 participants