GovUK.Dfe.AI.Agents.Mcp 0.0.1-prerelease.459

Prefix Reserved
This is a prerelease version of GovUK.Dfe.AI.Agents.Mcp.
dotnet add package GovUK.Dfe.AI.Agents.Mcp --version 0.0.1-prerelease.459
                    
NuGet\Install-Package GovUK.Dfe.AI.Agents.Mcp -Version 0.0.1-prerelease.459
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GovUK.Dfe.AI.Agents.Mcp" Version="0.0.1-prerelease.459" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GovUK.Dfe.AI.Agents.Mcp" Version="0.0.1-prerelease.459" />
                    
Directory.Packages.props
<PackageReference Include="GovUK.Dfe.AI.Agents.Mcp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GovUK.Dfe.AI.Agents.Mcp --version 0.0.1-prerelease.459
                    
#r "nuget: GovUK.Dfe.AI.Agents.Mcp, 0.0.1-prerelease.459"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GovUK.Dfe.AI.Agents.Mcp@0.0.1-prerelease.459
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GovUK.Dfe.AI.Agents.Mcp&version=0.0.1-prerelease.459&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=GovUK.Dfe.AI.Agents.Mcp&version=0.0.1-prerelease.459&prerelease
                    
Install as a Cake Tool

GovUK.Dfe.AI.Agents.Mcp

Gives your GovUK.Dfe.AI.Agents agents tools from your own MCP servers. Tools run in your app with your credential. Foundry only sees each tool's name, description and input schema, never the server's address or a credential.

Set up

dotnet add package GovUK.Dfe.AI.Agents.Mcp
"AiAgents": {
  "McpServers": {
    "school-performance": {
      "ServerUri": "https://mcp.internal.example/mcp",
      "Scope": "api://school-performance/.default",
      "AllowedToolNames": [ "get_performance_data" ]
    }
  }
}
builder.Services.AddAgents(builder.Configuration, agents => agents
    .AddAgents(BriefingAgents.All)
    .AddMcpServers());

Add an entry per server; each has its own address, scope and allowed tools. Then list the tools each agent may call:

public static readonly AgentDefinition Ofsted = new("ofsted-agent", "Ofsted")
{
    AllowedTools = ["get_performance_data"],
};

Use MCP servers without agents

An app can call MCP tools itself, with no Foundry settings and no agents:

builder.Services.AddMcpServers(builder.Configuration, new ManagedIdentityCredential());

public sealed class PerformanceService([FromKeyedServices("school-performance")] IMcpToolClient server)
{
    public Task<string> GetAsync(string urn, CancellationToken ct)
        => server.CallToolAsync("get_performance_data", $$"""{"urn":"{{urn}}"}""", ct);
}

It reads the same AiAgents:McpServers section. Each server signs in with its own Authentication block, else the credential you pass. Only tools in AllowedToolNames can be called. If you later add agents with agents.AddMcpServers(), each server is still connected only once.

How it works

  • Deny by default: an agent can call a tool only if it's in both the server's AllowedToolNames and the agent's AllowedTools. This is checked on every call.
  • Sign-in: the app's identity gets a token for each server's Scope; tokens are cached and refreshed. To use a different identity, add an Authentication block to the server, or call agents.UseMcpCredential("school-performance", credential).
  • Safe output: tool output is cut at MaxToolOutputCharacters (default 40,000) and fenced as data, so the model doesn't follow instructions inside it.
  • Errors: a tool error is returned to the model. Calls are never retried, so side effects can't happen twice.
  • Startup check: if an allowed tool doesn't exist on its server, startup fails. If a server can't be reached, startup only logs a warning, so an outage doesn't stop new instances starting.

Settings

Each entry under McpServers is keyed by a name you choose.

Setting Default Purpose
ServerUri Required The server's MCP endpoint; https:// (http:// only for localhost), as each request carries a token
Scope Required The token scope, e.g. api://school-performance/.default
AllowedToolNames Required Every tool this app may use from the server
ToolListCacheDuration 5 minutes How long the server's tool list is reused
Authentication The default identity A separate identity for this server, possibly in another tenant
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-prerelease.459 0 10/14/2026
0.0.1-prerelease.426 0 10/14/2026
0.0.1-prerelease.394 0 10/14/2026
0.0.1-prerelease.363 0 10/14/2026
0.0.1-prerelease.333 27 10/13/2026
0.0.1-prerelease.305 45 10/9/2026
0.0.1-prerelease.278 41 10/9/2026
0.0.1-prerelease.252 45 10/9/2026
0.0.1-prerelease.227 46 10/9/2026
0.0.1-prerelease.203 47 10/9/2026
0.0.1-prerelease.180 39 10/9/2026
0.0.1-prerelease.158 42 10/9/2026
0.0.1-prerelease.137 43 10/9/2026
0.0.1-prerelease.117 49 10/9/2026
0.0.1-prerelease.98 44 10/7/2026
0.0.1-prerelease.80 48 10/7/2026
0.0.1-prerelease.63 51 10/6/2026
0.0.1-prerelease.47 56 10/5/2026
0.0.1-prerelease.33 52 10/5/2026
0.0.1-prerelease.20 64 10/2/2026
Loading failed