Microsoft.Agents.A365.Tooling.Extensions.AgentFramework 1.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Microsoft.Agents.A365.Tooling.Extensions.AgentFramework --version 1.0.0
                    
NuGet\Install-Package Microsoft.Agents.A365.Tooling.Extensions.AgentFramework -Version 1.0.0
                    
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="Microsoft.Agents.A365.Tooling.Extensions.AgentFramework" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Agents.A365.Tooling.Extensions.AgentFramework" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Agents.A365.Tooling.Extensions.AgentFramework" />
                    
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 Microsoft.Agents.A365.Tooling.Extensions.AgentFramework --version 1.0.0
                    
#r "nuget: Microsoft.Agents.A365.Tooling.Extensions.AgentFramework, 1.0.0"
                    
#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 Microsoft.Agents.A365.Tooling.Extensions.AgentFramework@1.0.0
                    
#: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=Microsoft.Agents.A365.Tooling.Extensions.AgentFramework&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Agents.A365.Tooling.Extensions.AgentFramework&version=1.0.0
                    
Install as a Cake Tool

Microsoft.Agents.A365.Tooling.Extensions.AgentFramework

Microsoft Agent Framework integration for the Microsoft Agent 365 Tooling SDK. Provides MCP (Model Context Protocol) tool server discovery and registration for agents built with Microsoft.Extensions.AI and Microsoft.Agents.AI.

Installation

dotnet add package Microsoft.Agents.A365.Tooling.Extensions.AgentFramework

Key Features

  • MCP tool discovery — queries the Agent 365 Tooling Gateway and connects to configured MCP servers
  • AddToolServersToAgent — builds an AIAgent with MCP tools loaded alongside any existing tools
  • GetMcpToolsAsync — returns discovered MCP tools as IList<AITool> for manual agent wiring
  • SendChatHistoryAsync — forwards conversation history to the real-time threat-protection endpoint
  • V1/V2 per-audience token support — V1 servers share the ATG token; V2 servers (distinct audience) receive audience-scoped OBO tokens automatically
  • Dev-mode support — tokens sourced from environment variables when ASPNETCORE_ENVIRONMENT=Development

Service Registration

using Microsoft.Agents.A365.Tooling.Extensions.AgentFramework.Extensions;

// Program.cs
builder.Services.AddMcpServices();

AddMcpServices() registers:

  • IMcpToolServerConfigurationServiceMcpToolServerConfigurationService (scoped)
  • IMcpToolRegistrationServiceMcpToolRegistrationService (scoped)

Usage

Adding MCP tools to an agent

using Microsoft.Agents.A365.Tooling.Extensions.AgentFramework.Services;
using Microsoft.Agents.Builder.App.UserAuth;
using Microsoft.Extensions.AI;

public class MyActivityHandler : ActivityHandler
{
    private readonly IMcpToolRegistrationService _mcpTools;
    private readonly IChatClient _chatClient;

    public MyActivityHandler(IMcpToolRegistrationService mcpTools, IChatClient chatClient)
    {
        _mcpTools = mcpTools;
        _chatClient = chatClient;
    }

    protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
    {
        var userAuth = turnContext.Activity.GetUserAuthorization();

        var agent = await _mcpTools.AddToolServersToAgent(
            chatClient: _chatClient,
            agentInstructions: "You are a helpful assistant.",
            initialTools: [],
            agentUserId: turnContext.Activity.From.Id,
            userAuthorization: userAuth,
            authHandlerName: "default",
            turnContext: turnContext);

        var response = await agent.CompleteAsync(turnContext.Activity.Text, cancellationToken: cancellationToken);
        await turnContext.SendActivityAsync(response.Message.Text, cancellationToken: cancellationToken);
    }
}

Retrieving tools without building an agent

IList<AITool> tools = await _mcpTools.GetMcpToolsAsync(
    agentUserId: turnContext.Activity.From.Id,
    userAuthorization: userAuth,
    authHandlerName: "default",
    turnContext: turnContext);

Sending chat history

// From a list of ChatMessage objects
OperationResult result = await _mcpTools.SendChatHistoryAsync(chatMessages, turnContext, cancellationToken);

Authentication

Production

Token acquisition is automatic. The service uses the Agent Framework UserAuthorization and authHandlerName parameters to perform agentic OBO token exchange via AgenticMcpTokenProvider.

  • V1 servers (no audience field, or audience matches the ATG App ID) — receive the shared ATG-scoped token.
  • V2 servers (audience identifies a different application) — receive a token scoped to {audience}/{scope} or {audience}/.default.

Local development

Set ASPNETCORE_ENVIRONMENT=Development (or DOTNET_ENVIRONMENT=Development). Tokens are read from environment variables instead of the OBO flow:

Variable Purpose
BEARER_TOKEN_<SERVERNAME> Per-server token (hyphens in name replaced with underscores, uppercased)
BEARER_TOKEN Shared fallback token for all servers

Example: for a server named my-mcp-server, set BEARER_TOKEN_MY_MCP_SERVER.

Environment Variables

Variable Purpose Default
ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT Set to Development to enable dev mode
MCP_PLATFORM_ENDPOINT Override the Tooling Gateway base URL https://agent365.svc.cloud.microsoft
BEARER_TOKEN_<SERVERNAME> Dev-mode per-server Bearer token
BEARER_TOKEN Dev-mode shared Bearer token fallback

Trademarks

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
1.1.9-preview 41 5/27/2026
1.1.8-preview 38 5/26/2026
1.1.5-preview 48 5/14/2026
1.0.0 549 5/1/2026
0.3.4-beta 66 4/23/2026
0.2.152-beta 75 4/13/2026
0.2.151-beta 2,210 4/3/2026
0.2.144-beta 73 3/25/2026
0.2.127-beta 104 2/9/2026
0.2.118-beta 152 1/24/2026
0.2.112-beta 184 1/18/2026
0.1.75-beta 433 11/19/2025
0.1.72-beta 2,332 11/18/2025

See CHANGELOG.md for release notes.