Skip to content

Commit 6e3a09f

Browse files
authored
Merge branch 'main' into dev/aaronburtle/tool-registry-hot-reload
2 parents 08004e2 + d783120 commit 6e3a09f

60 files changed

Lines changed: 3728 additions & 604 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config-generators/cosmosdb_nosql-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ update PlanetAlias --config "dab-config.CosmosDb_NoSql.json" --permissions "anon
44
update PlanetAlias --config "dab-config.CosmosDb_NoSql.json" --permissions "authenticated:create,read,update,delete"
55
update PlanetAlias --config "dab-config.CosmosDb_NoSql.json" --permissions "limited-read-role:read"
66
update PlanetAlias --config "dab-config.CosmosDb_NoSql.json" --permissions "item-level-permission-role:read"
7+
update PlanetAlias --config "dab-config.CosmosDb_NoSql.json" --permissions "claim_policy_tester:read" --policy-database "@item.name eq @claims.userId"
78
add Character --config "dab-config.CosmosDb_NoSql.json" --source "graphqldb.planet" --permissions "anonymous:create,read,update,delete" --graphql "Character:Characters"
89
update Character --config "dab-config.CosmosDb_NoSql.json" --permissions "item-level-permission-role:read"
910
add Star --config "dab-config.CosmosDb_NoSql.json" --source "graphqldb.planet" --permissions "anonymous:create,read,update,delete" --graphql "Star:Stars"

config-generators/dwsql-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ update Book --config "dab-config.DwSql.json" --permissions "policy_tester_08:cre
101101
update Book --config "dab-config.DwSql.json" --permissions "policy_tester_08:update" --fields.include "*" --policy-database "@item.id eq 9"
102102
update Book --config "dab-config.DwSql.json" --permissions "policy_tester_08:delete" --fields.include "*" --policy-database "@item.id eq 9"
103103
update Book --config "dab-config.DwSql.json" --permissions "policy_tester_08:read" --fields.include "*"
104+
update Book --config "dab-config.DwSql.json" --permissions "claim_policy_tester:read" --fields.include "*" --policy-database "@item.title eq @claims.userId"
104105
update Book --config "dab-config.DwSql.json" --permissions "test_role_with_noread:create,update,delete"
105106
update Book --config "dab-config.DwSql.json" --permissions "test_role_with_excluded_fields:create,update,delete"
106107
update Book --config "dab-config.DwSql.json" --permissions "test_role_with_excluded_fields:read" --fields.exclude "publisher_id"

config-generators/mssql-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ update Book --config "dab-config.MsSql.json" --permissions "policy_tester_08:cre
124124
update Book --config "dab-config.MsSql.json" --permissions "policy_tester_08:update" --fields.include "*" --policy-database "@item.id eq 9"
125125
update Book --config "dab-config.MsSql.json" --permissions "policy_tester_08:delete" --fields.include "*" --policy-database "@item.id eq 9"
126126
update Book --config "dab-config.MsSql.json" --permissions "policy_tester_08:read" --fields.include "*"
127+
update Book --config "dab-config.MsSql.json" --permissions "claim_policy_tester:read" --fields.include "*" --policy-database "@item.title eq @claims.userId"
127128
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_noread:create,update,delete"
128129
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_excluded_fields:create,update,delete"
129130
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_excluded_fields:read" --fields.exclude "publisher_id"

config-generators/mysql-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ update Book --config "dab-config.MySql.json" --permissions "policy_tester_08:cre
9696
update Book --config "dab-config.MySql.json" --permissions "policy_tester_08:update" --fields.include "*" --policy-database "@item.id eq 9"
9797
update Book --config "dab-config.MySql.json" --permissions "policy_tester_08:delete" --fields.include "*" --policy-database "@item.id eq 9"
9898
update Book --config "dab-config.MySql.json" --permissions "policy_tester_08:read" --fields.include "*"
99+
update Book --config "dab-config.MySql.json" --permissions "claim_policy_tester:read" --fields.include "*" --policy-database "@item.title eq @claims.userId"
99100
update Book --config "dab-config.MySql.json" --permissions "test_role_with_noread:create,update,delete"
100101
update Book --config "dab-config.MySql.json" --permissions "test_role_with_excluded_fields:create,update,delete"
101102
update Book --config "dab-config.MySql.json" --permissions "test_role_with_excluded_fields:read" --fields.exclude "publisher_id"

config-generators/postgresql-commands.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ update Book --config "dab-config.PostgreSql.json" --permissions "policy_tester_0
9898
update Book --config "dab-config.PostgreSql.json" --permissions "policy_tester_08:update" --fields.include "*" --policy-database "@item.id eq 9"
9999
update Book --config "dab-config.PostgreSql.json" --permissions "policy_tester_08:delete" --fields.include "*" --policy-database "@item.id eq 9"
100100
update Book --config "dab-config.PostgreSql.json" --permissions "policy_tester_08:read" --fields.include "*"
101+
update Book --config "dab-config.PostgreSql.json" --permissions "claim_policy_tester:read" --fields.include "*" --policy-database "@item.title eq @claims.userId"
101102
update Book --config "dab-config.PostgreSql.json" --permissions "test_role_with_noread:create,update,delete"
102103
update Book --config "dab-config.PostgreSql.json" --permissions "test_role_with_excluded_fields:create,update,delete"
103104
update Book --config "dab-config.PostgreSql.json" --permissions "test_role_with_excluded_fields:read" --fields.exclude "publisher_id"
@@ -178,3 +179,4 @@ add dbo_DimAccount --config "dab-config.PostgreSql.json" --source "dimaccount" -
178179
update dbo_DimAccount --config "dab-config.PostgreSql.json" --map "parentaccountkey:ParentAccountKey,accountkey:AccountKey"
179180
update dbo_DimAccount --config "dab-config.PostgreSql.json" --relationship parent_account --target.entity dbo_DimAccount --cardinality one --relationship.fields "parentaccountkey:accountkey"
180181
update dbo_DimAccount --config "dab-config.PostgreSql.json" --relationship child_accounts --target.entity dbo_DimAccount --cardinality many --relationship.fields "accountkey:parentaccountkey"
182+
add DateOnlyTable --config "dab-config.PostgreSql.json" --source "date_only_table" --permissions "anonymous:*" --rest true --graphql true --source.key-fields "event_date"

nuget/nuget_mcp/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Data API builder MCP Library
2+
3+
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4+
5+
## About
6+
7+
**Microsoft.DataApiBuilder.Mcp** provides Model Context Protocol (MCP) integration for [Data API builder](https://learn.microsoft.com/azure/data-api-builder/) (DAB).
8+
9+
This package is intended for teams that want to host DAB MCP tools in their own .NET applications.
10+
11+
## Key capabilities
12+
13+
- Registers DAB MCP services in dependency injection
14+
- Maps DAB MCP endpoints for HTTP hosting
15+
- Uses Data API builder Core capabilities for entity and tool execution
16+
17+
## Installation
18+
19+
```bash
20+
dotnet add package Microsoft.DataApiBuilder.Mcp
21+
```
22+
23+
## Usage
24+
25+
This package is designed for ASP.NET Core applications that expose MCP endpoints.
26+
27+
Use it to register DAB MCP services in dependency injection and map DAB MCP endpoints in your app's hosting pipeline.
28+
29+
Current distribution scope is internal Azure Artifacts feeds.
30+
31+
## Resources
32+
33+
- [Official Documentation](https://learn.microsoft.com/azure/data-api-builder/)
34+
- [GitHub Repository](https://github.com/Azure/data-api-builder)
35+
- [Samples](https://aka.ms/dab/samples)

scripts/notice-generation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ param (
99

1010
# Download and save the ChilliCream License 1.0 from ChilliCream/graphql-platform GitHub repo
1111
$chiliCreamLicenseSavePath = "$BuildArtifactStagingDir/chillicreamlicense.txt"
12-
$chiliCreamLicenseMetadataURL = "https://raw.githubusercontent.com/ChilliCream/graphql-platform/main/website/src/basic/licensing/chillicream-license.md"
12+
$chiliCreamLicenseMetadataURL = "https://raw.githubusercontent.com/ChilliCream/graphql-platform/main/website/content/licensing/chillicream-license.md"
1313
Invoke-WebRequest $chiliCreamLicenseMetadataURL -UseBasicParsing |
1414
Select-Object -ExpandProperty Content |
1515
Out-File $chiliCreamLicenseSavePath

src/Auth/IAuthorizationResolver.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,15 @@ public interface IAuthorizationResolver
7272
public string GetDBPolicyForRequest(string entityName, string roleName, EntityActionOperation operation);
7373

7474
/// <summary>
75-
/// Retrieves the policy of an operation within an entity's role entry
76-
/// within the permissions section of the runtime config, and tries to process
77-
/// the policy.
75+
/// Resolves claim references in a database policy to parameter aliases and
76+
/// returns their typed values separately from the policy text.
7877
/// </summary>
7978
/// <param name="entityName">Entity from request.</param>
8079
/// <param name="roleName">Role defined in client role header.</param>
8180
/// <param name="operation">Operation type: Create, Read, Update, Delete.</param>
8281
/// <param name="httpContext">Contains token claims of the authenticated user used in policy evaluation.</param>
83-
/// <returns>Returns the parsed policy, if successfully processed, or an exception otherwise.</returns>
84-
public string ProcessDBPolicy(string entityName, string roleName, EntityActionOperation operation, HttpContext httpContext);
82+
/// <returns>The policy text and typed claim values to bind to it.</returns>
83+
public ResolvedDatabasePolicy ResolveDBPolicy(string entityName, string roleName, EntityActionOperation operation, HttpContext httpContext);
8584

8685
/// <summary>
8786
/// Get list of roles defined for entity within runtime configuration.. This is applicable for GraphQL when creating authorization

src/Auth/ResolvedDatabasePolicy.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using System.Collections.ObjectModel;
5+
6+
namespace Azure.DataApiBuilder.Auth;
7+
8+
/// <summary>
9+
/// A database authorization policy whose claim references have been replaced by
10+
/// OData parameter aliases. Claim values remain separate from the policy text so
11+
/// they can be injected into the parsed OData AST as typed constants.
12+
/// </summary>
13+
public sealed record ResolvedDatabasePolicy
14+
{
15+
/// <summary>
16+
/// Policy text containing OData parameter aliases.
17+
/// </summary>
18+
public string Policy { get; }
19+
20+
/// <summary>
21+
/// Immutable snapshot of typed claim values keyed by parameter alias.
22+
/// </summary>
23+
public IReadOnlyDictionary<string, object?> ClaimValues { get; }
24+
25+
/// <summary>
26+
/// Represents an operation without a database authorization policy.
27+
/// </summary>
28+
public static ResolvedDatabasePolicy Empty { get; } = new(
29+
string.Empty,
30+
new ReadOnlyDictionary<string, object?>(new Dictionary<string, object?>()));
31+
32+
/// <summary>
33+
/// Initializes a resolved database policy and takes an immutable snapshot of its claim values.
34+
/// </summary>
35+
/// <param name="policy">Policy text containing OData parameter aliases.</param>
36+
/// <param name="claimValues">Typed claim values keyed by their parameter alias.</param>
37+
public ResolvedDatabasePolicy(string policy, IReadOnlyDictionary<string, object?> claimValues)
38+
{
39+
ArgumentNullException.ThrowIfNull(policy);
40+
ArgumentNullException.ThrowIfNull(claimValues);
41+
42+
Policy = policy;
43+
ClaimValues = new ReadOnlyDictionary<string, object?>(
44+
new Dictionary<string, object?>(claimValues, StringComparer.Ordinal));
45+
}
46+
}

src/Azure.DataApiBuilder.Mcp/Azure.DataApiBuilder.Mcp.csproj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,29 @@
44
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<PackageOutputPath>./nupkg</PackageOutputPath>
8+
<PackageId>Microsoft.DataApiBuilder.Mcp</PackageId>
9+
<Title>Microsoft.DataApiBuilder.Mcp</Title>
10+
<Authors>Microsoft</Authors>
11+
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
12+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
13+
<RepositoryType>git</RepositoryType>
14+
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=2224253</PackageProjectUrl>
15+
<PackageTags>microsoft mcp model-context-protocol dab dataApiBuilder azure sql graphql rest sdk internal</PackageTags>
16+
<AssemblyName>Microsoft.DataApiBuilder.Mcp</AssemblyName>
17+
<Description>MCP integration library for Data API builder with services and endpoint mapping for exposing DAB tools through Model Context Protocol.</Description>
18+
<PackageIcon>nuget_icon.png</PackageIcon>
19+
<PackageReadmeFile>README.md</PackageReadmeFile>
20+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
21+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
722
<!-- Suppress transitive dependency version mismatch warnings from MCP SDK -->
823
<NoWarn>$(NoWarn);NU1603</NoWarn>
924
</PropertyGroup>
1025

26+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
27+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
28+
</PropertyGroup>
29+
1130
<ItemGroup>
1231
<InternalsVisibleTo Include="Azure.DataApiBuilder.Service.Tests" />
1332
</ItemGroup>
@@ -21,6 +40,13 @@
2140
<ProjectReference Include="..\Core\Azure.DataApiBuilder.Core.csproj" />
2241
</ItemGroup>
2342

43+
<ItemGroup>
44+
<None Include="..\..\nuget\nuget_mcp\README.md" Pack="true" PackagePath="\" />
45+
<None Include="..\..\nuget\nuget_icon.png" Pack="true" PackagePath="\" />
46+
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="\" />
47+
<None Include="..\..\nuget_mcp\NOTICE.txt" Pack="true" PackagePath="\" Condition="Exists('..\..\nuget_mcp\NOTICE.txt')" />
48+
</ItemGroup>
49+
2450
<ItemGroup>
2551
<Folder Include="CustomTools\" />
2652
</ItemGroup>

0 commit comments

Comments
 (0)