In the code below we use “agent” terminology because it maps to the underlying object model, but you can think of it as the service/resource you’re charging for.
Prerequisites
1
Get Your API Key
- Go to nevermined.app and sign in
- Navigate to Settings > API Keys
- Generate a new key and copy it
2
Install the SDK
- TypeScript
- Python
Register Your Service (2 minutes)
Create a file to register your service and a payment plan. If you’re monetizing an MCP tool/server or a protected resource, you’ll still register the monetizable unit and attach a plan — only the delivery step changes.- TypeScript
- Python
- TypeScript
- Python
Add Payment Validation (3 minutes)
Add this middleware to validate entitlement before delivering your response/resource. The example shows an HTTP API route; the same check can be used before calling an MCP tool handler or before serving a protected asset:- TypeScript (Express)
- Python (FastAPI)
Use the Middleware
- TypeScript (Express)
- Python (FastAPI)