@solvapay/mcp
v0.2.7
Published
Official @modelcontextprotocol/sdk + @modelcontextprotocol/ext-apps adapter for the SolvaPay MCP toolbox (createSolvaPayMcpServer, registerPayableTool) with ./fetch + ./express subpath exports for runtime-specific OAuth bridges.
Downloads
2,161
Readme
@solvapay/mcp
Official @modelcontextprotocol/sdk + @modelcontextprotocol/ext-apps adapter for SolvaPay MCP servers.
When to use this package: add paywalled tools and SolvaPay transport tools to an MCP server. For a new app, prefer the scaffolder first:
npm create solvapay@latest my-mcp-app -- --type mcpManual createSolvaPayMcpServer wiring is the advanced path for existing servers or custom frameworks.
Install
pnpm add @solvapay/mcp @solvapay/server \
@modelcontextprotocol/sdk @modelcontextprotocol/ext-apps zodQuickstart (advanced)
import { createSolvaPayMcpServer, registerPayableTool } from '@solvapay/mcp'
import { createSolvaPay } from '@solvapay/server'
import { z } from 'zod'
const solvaPay = createSolvaPay({ apiKey: process.env.SOLVAPAY_SECRET_KEY! })
const server = createSolvaPayMcpServer({
solvaPay,
productRef: 'prd_video',
resourceUri: 'ui://my-app/mcp-app.html',
htmlPath: './dist/mcp-app.html',
publicBaseUrl: 'https://my-app.example.com',
additionalTools: ({ registerPayable }) => {
registerPayable('create_video', {
schema: { prompt: z.string() },
description: 'Generate a short video from a text prompt.',
handler: async ({ prompt }, ctx) => ctx.respond({ videoUrl: await generate(prompt) }),
})
},
})One call wires transport tools, UI resource (Stripe CSP baseline), and your payable tools.
Subpath exports
| Import | Use when |
| --- | --- |
| @solvapay/mcp | createSolvaPayMcpServer, registerPayableTool |
| @solvapay/mcp/express | Node (req, res, next) OAuth middleware |
| @solvapay/mcp/fetch | Edge createSolvaPayMcpFetchHandler / createSolvaPayMcpFetch |
Framework-neutral contracts live in @solvapay/mcp-core.
Handler contract
Handlers receive args and a ResponseContext. Return ctx.respond(data, options?). Paywall gates are text-only narrations — the widget iframe opens only on deliberate intent tools (upgrade, manage_account, topup).
See also
create-solvapay— scaffold MCP apps (recommended for greenfield)@solvapay/mcp-core— descriptors for custom adapters@solvapay/react/mcp— MCP App UI components@solvapay/server— core paywall runtime- MCP app example
