Native.Mcp.NativeLambdaRouter 2.1.0

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

Native.Mcp.NativeLambdaRouter

Hosts a Native.Mcp server inside NativeLambdaRouter — the recommended way to run an MCP server in the Swepay Native ecosystem.

The router owns routing, claims extraction, health checks and the Lambda entry point; Native.Mcp owns the JSON-RPC protocol and per-tool authorization. Responsibilities stay cleanly separated and you reuse the same edge stack as every other Swepay Lambda.

Responsibility split

Layer Owns
API Gateway JWT Authorizer (edge) Authentication — validates the JWT (signature/exp/iss/aud) before the Lambda runs.
NativeLambdaRouter Routing (POST /mcp), claims extraction into RouteContext, health checks, the Lambda entry point.
Native.Mcp JSON-RPC dispatch (initialize/tools/list/tools/call) and per-tool authorization (context.HasRole).

MCP is a single route. The router can only see the path /mcp, not the tool name (which is in the JSON-RPC body), so per-tool authorization must live in the tools. The MCP route is registered AllowAnonymous at the router (the edge Authorizer is the auth gate); the validated claims still flow through to the tools.

Quickstart

using Amazon.Lambda.APIGatewayEvents;
using Amazon.Lambda.Core;
using Amazon.Lambda.RuntimeSupport;
using Amazon.Lambda.Serialization.SystemTextJson;
using Microsoft.Extensions.DependencyInjection;
using Native.Mcp;
using Native.Mcp.NativeLambdaRouter;

var services = new ServiceCollection();
services.AddNativeMcpServer(o =>
{
    o.ServerName = "swepay-native-guard-trial-provisioner";
    o.ServerVersion = "1.0.0";
    o.AddDiscoveredTools(AppJsonContext.Default);   // or AddTool<...>(...)
});
services.AddNativeMcpTelemetry();

await using var provider = services.BuildServiceProvider();
var function = new McpRoutedApiGatewayFunction(provider);   // routes POST /mcp -> dispatcher

var serializer = new SourceGeneratorLambdaJsonSerializer<AppJsonContext>();
var handler = (APIGatewayHttpApiV2ProxyRequest req, ILambdaContext ctx) => function.FunctionHandler(req, ctx);
await LambdaBootstrapBuilder.Create(handler, serializer).Build().RunAsync();

You do not need to register NativeMediator — the function supplies a no-op mediator to the router (dispatch is handled by Native.Mcp, not the mediator).

Custom route path

public sealed class MyMcpFunction : McpRoutedApiGatewayFunction
{
    public MyMcpFunction(IServiceProvider sp) : base(sp) { }
    protected override string McpPath => "/v1/mcp";
}

What's in the package

  • McpRoutedApiGatewayFunction — a RoutedApiGatewayFunction that maps POST /mcp to the MCP dispatcher and returns its response verbatim. Override McpPath to change the route.
  • McpRouteContextMapper — maps the router's RouteContext (claims/headers/body) to McpRequestContext (claims, raw JWT, x-correlation-id, x-idempotency-key).

License

MIT.

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
2.1.0 42 6/5/2026
2.0.0 86 6/5/2026