AzureFunctions.TestFramework.Mcp 0.12.0

dotnet add package AzureFunctions.TestFramework.Mcp --version 0.12.0
                    
NuGet\Install-Package AzureFunctions.TestFramework.Mcp -Version 0.12.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="AzureFunctions.TestFramework.Mcp" Version="0.12.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AzureFunctions.TestFramework.Mcp" Version="0.12.0" />
                    
Directory.Packages.props
<PackageReference Include="AzureFunctions.TestFramework.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 AzureFunctions.TestFramework.Mcp --version 0.12.0
                    
#r "nuget: AzureFunctions.TestFramework.Mcp, 0.12.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 AzureFunctions.TestFramework.Mcp@0.12.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=AzureFunctions.TestFramework.Mcp&version=0.12.0
                    
Install as a Cake Addin
#tool nuget:?package=AzureFunctions.TestFramework.Mcp&version=0.12.0
                    
Install as a Cake Tool

AzureFunctions.TestFramework.Mcp

NuGet

MCP (Model Context Protocol) trigger invocation support for the Azure Functions Test Framework. Provides InvokeMcpToolAsync(...), InvokeMcpResourceAsync(...), and InvokeMcpPromptAsync(...) — extensions on IFunctionsTestHost that let you trigger MCP-triggered functions directly from integration tests.

Usage

McpToolTrigger

using AzureFunctions.TestFramework.Core;
using AzureFunctions.TestFramework.Mcp;

[Fact]
public async Task McpTool_WithArguments_Succeeds()
{
    var result = await _testHost.InvokeMcpToolAsync(
        "MyTool",
        toolArguments: new Dictionary<string, object> { ["input"] = "hello" });

    Assert.True(result.Success);
}

McpResourceTrigger

[Fact]
public async Task McpResource_WithUri_Succeeds()
{
    var result = await _testHost.InvokeMcpResourceAsync(
        "MyResource",
        resourceUri: "resource://my-resource/item-1");

    Assert.True(result.Success);
}

McpPromptTrigger

[Fact]
public async Task McpPrompt_WithArguments_Succeeds()
{
    var result = await _testHost.InvokeMcpPromptAsync(
        "MyPrompt",
        arguments: new Dictionary<string, string> { ["topic"] = "testing" });

    Assert.True(result.Success);
}

API

// McpToolTrigger
Task<FunctionInvocationResult> InvokeMcpToolAsync(
    this IFunctionsTestHost host,
    string functionName,
    IReadOnlyDictionary<string, object>? toolArguments = null,
    string? toolName = null,
    string? sessionId = null,
    CancellationToken cancellationToken = default)

// McpResourceTrigger
Task<FunctionInvocationResult> InvokeMcpResourceAsync(
    this IFunctionsTestHost host,
    string functionName,
    string resourceUri,
    string? sessionId = null,
    CancellationToken cancellationToken = default)

// McpPromptTrigger
Task<FunctionInvocationResult> InvokeMcpPromptAsync(
    this IFunctionsTestHost host,
    string functionName,
    IReadOnlyDictionary<string, string>? arguments = null,
    string? promptName = null,
    string? sessionId = null,
    CancellationToken cancellationToken = default)
  • functionName — the name of the MCP function (case-insensitive).
  • toolArguments / arguments — optional named arguments to pass to the tool or prompt.
  • resourceUri — the URI of the MCP resource to trigger.
  • toolName / promptName — optional name override; defaults to functionName when null.
  • sessionId — optional MCP session ID; a new GUID is generated when null.

Output binding capture

Use FunctionInvocationResult to inspect output bindings produced by the function:

var result = await _testHost.InvokeMcpToolAsync("MyTool",
    toolArguments: new Dictionary<string, object> { ["input"] = "hello" });

Assert.True(result.Success);

// Read the function return value
var returnValue = result.ReadReturnValueAs<string>();
Assert.Equal("expected output", returnValue);

References

License

MIT

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 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.12.0 46 4/20/2026