Overview
MCP (Model Context Protocol) enables AI applications to interact with external tools, resources, and prompts. The Nevermined SDK provides built-in MCP integration to:- Protect tools, resources, and prompts with paywalls
- Handle OAuth 2.1 authentication
- Manage credit consumption per operation
MCP Integration API
Access the MCP integration throughpayments.mcp:
Simplified API (Recommended)
The simplified API handles server setup automatically:Register a Tool
Register a Resource
Register a Prompt
Start the Server
Advanced API
For more control, use the advanced API:Configure and Protect Handlers
Attach to Existing Server
Complete Example
Server Configuration
Handler Options
Response Metadata (_meta)
After each paywall-protected call, the SDK injects a _meta field into the response following the MCP specification. This field is always present regardless of whether credit redemption succeeded or failed:
Endpoints
The MCP server exposes:/.well-known/oauth-authorization-server- OAuth 2.1 discovery/.well-known/oauth-protected-resource- Resource metadata/register- Client registration/mcp- MCP protocol endpoint (POST/GET/DELETE)/health- Health check
Next Steps
A2A Integration
Agent-to-Agent protocol
x402 Protocol
Payment protocol details