ThinkBase.AI.MPP 1.0.2

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

ThinkBase.AI.MPP

The server side of the Machine Payments Protocol (MPP) for ASP.NET Core Model Context Protocol servers.

An agent that holds no API key is not turned away: the call it is making is priced, answered with a 402 Payment Required challenge, and run once the agent comes back with a payment credential. An agent may pay with a card, settled through Stripe, or in stablecoin, by transferring TIP-20 tokens to the server's deposit address on the Tempo blockchain.

Piece What it does
MppPaymentMiddleware Sits in front of the MCP endpoint: challenges an unpaid tools/call, settles a credential, answers a payment probe
MppChallengeService The stateless challenge every payment method shares, its HMAC identifier and its replay protection
MppPaymentService The stripe/charge method: a shared payment token settled as a Stripe PaymentIntent
TempoPaymentService The tempo/charge method: a TIP-20 transfer verified on the Tempo blockchain
ToolPricingService The per tool prices, one document per tool in a MongoDB collection, cached in memory
MppDiscoveryService The /openapi.json discovery document, with an x-payment-info offer per payable tool
MppReceiptFilter Returns the receipt of a settled payment in the _meta of the tool result

Using it

// The prices, the payment methods and the discovery document, bound from the Mpp configuration
// section. The tools that are priced are those declared by the assemblies named here.
builder.Services.AddMachinePayments(builder.Configuration, typeof(Program).Assembly);

// How this application recognises a subscriber, who is billed rather than challenged.
builder.Services.AddScoped<IMppSubscriberResolver, ApiKeySubscriberResolver>();

var app = builder.Build();

// Before the MCP endpoint is mapped.
app.UseMachinePayments();
app.MapMcp();

The host still owns three things, because they are its own:

  • the Stripe client the payments are settled with (AddStripe, from Stripe.Extensions.DependencyInjection);
  • an IMppSubscriberResolver, which says whether a request already belongs to a subscriber — without one every call is paid for;
  • an IDistributedCache, in which settled challenges and spent transfers are remembered.

Serve the discovery document from a controller of the application, which knows the URL it is reached at:

[HttpGet("/openapi.json")]
public async Task<IActionResult> GetDiscoveryDocument(CancellationToken cancellationToken)
{
    var realm = string.IsNullOrWhiteSpace(_options.Realm) ? Request.Host.Host : _options.Realm;
    var document = await _discoveryService.BuildDocumentAsync($"{Request.Scheme}://{Request.Host}", realm, cancellationToken);

    Response.Headers.CacheControl = $"public, max-age={MppDiscoveryService.CacheSeconds}";
    return Content(document.ToJsonString(), "application/json");
}

Configuration

Everything is bound from the Mpp configuration section and, as in the Stripe machine payments sample, three settings are enough: Stripe:secret_key, from which the challenge signing secret and the Tempo network are derived, Mpp:NetworkId and Mpp:Tempo:DepositAddress. The prices are read from Mpp:DatabaseName (or MongoAuthDatabase) of Mpp:ConnectionString (or MongoConnectionString). The full list of settings, and a description of the protocol as it is implemented here, is in the README of MCP.Scientio.Com.

Tests

ThinkBase.AI.MPP.Tests covers the library on its own:

dotnet test ThinkBase.AI.MPP.Tests/ThinkBase.AI.MPP.Tests.csproj
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
1.0.2 74 10/24/2026