MCP says what an agent can do; Nevermined adds who can access it and how to charge.
- Protect MCP tools, resources and prompts with a Nevermined paywall
- Authenticate the MCP session with Authorization: Bearer and read payment in-band from _meta["x402/payment"]
- Compute credits dynamically per request
- Compare a high-level McpServer SDK build with a low-level JSON-RPC one
The MCP session is OAuth-protected: the client authenticates with an Authorization: Bearer access token, and the per-call payment is read in band from the MCP request _meta["x402/payment"]. A header-only payment (no _meta) still works as a deprecated fallback for one release.
Nevermined handles the Express server, sessions, OAuth discovery endpoints, credit checks and deduction — you expose the capability.
weather.today(city) # tool
weather://today/{city} # resource
weather.ensureCity # prompt| src/main.ts | MCP server with Nevermined Payments (withPaywall wrapper) |
| src/services/weather.service.ts | weather data via Open-Meteo |
| RUN.md | setup and running instructions |
Sandbox agent — real payment round-trips (402 → authorize → settle) with a per-session credit balance, no external service and no real money. Streamable-HTTP MCP, compatible with MCP Inspector; the sandbox runs the gated tool call locally. See the README to connect a hosted weather-mcp server.