Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 5, 2025

Why make this change?

  • Closes [Enh]: Add MCP endpoint /mcp #2832
  • Enables AI agents and applications to interact with Data API Builder through the standardized Model Context Protocol (MCP), providing a dedicated /mcp endpoint for AI-driven automation and orchestration.
  • Allows agents to discover available entities, perform CRUD operations with entity-aware validation, and execute stored procedures in a way that models and agents can reliably consume.

What is this change?

This PR implements comprehensive MCP (Model Context Protocol) support for Data API Builder, adding:

Core MCP Runtime Configuration

  • New McpRuntimeOptions class with configurable endpoint path, enabled/disabled state, and DML tools configuration
  • JSON schema updates to support MCP configuration in dab.draft.schema.json
  • CLI integration with new options for dab init and dab configure commands:
    • --mcp.enabled / --runtime.mcp.enabled
    • --mcp.path / --runtime.mcp.path
    • DML tools configuration options (describe-entities, create-record, read-record, update-record, delete-record, execute-record)

MCP Server Implementation

  • Enhanced MCP server setup with proper service provider integration and conditional configuration
  • DML tools integration that respects configuration settings for individual operations
  • Async/await improvements for better performance and reliability
  • Development debugging support with automatic debugger attachment

Configuration Integration

  • Runtime options integration - MCP joins REST and GraphQL as a first-class API endpoint type
  • Path validation using existing URI validation infrastructure
  • Health endpoint support - MCP status included in health checks
  • Base route compatibility - MCP works with configured base routes

Testing & Validation

  • Comprehensive test coverage across 25+ test files updated
  • Configuration validation tests ensuring MCP settings are properly validated
  • Health endpoint tests including MCP status validation
  • Integration tests for MCP endpoint enabling/disabling scenarios

How was this tested?

  • Integration Tests - Updated existing integration tests to include MCP configuration
  • Unit Tests - Added comprehensive unit tests for MCP configuration, validation, and runtime behavior

Sample Request(s)

CLI Configuration

# Initialize with MCP enabled
dab init --database-type mssql --connection-string "..." --mcp.enabled true --mcp.path "/mcp"

# Configure MCP settings
dab configure --runtime.mcp.enabled true
dab configure --runtime.mcp.path "/api/mcp"
dab configure --runtime.mcp.dml-tools.enabled true

Configuration JSON

{
  "runtime": {
    "mcp": {
      "enabled": true,
      "path": "/mcp",
      "dml-tools": {
        "enabled": true,
        "describe-entities": true,
        "create-record": true,
        "read-record": true,
        "update-record": true,
        "delete-record": true,
        "execute-record": true
      }
    }
  }
}

MCP Request Example

# List available MCP tools
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

This implementation provides the foundation for AI agent integration with Data API Builder, enabling automated database operations through the standardized Model Context Protocol.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] generate a details PR description for this PR- @Azure/data-api-builder/pull/2866 using this template- ## Why make this change? - Reference associated issue using # syntax. e.g. Closes #XX - Include summary (1-2 sentences) of linked issue to avoid ... Implement Model Context Protocol (MCP) Runtime Support for AI Agent Integration Sep 5, 2025
Copilot AI requested a review from souvikghosh04 September 5, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enh]: Add MCP endpoint /mcp

2 participants