> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Monetize an MCP server with SDK integration

> Use the SolvaPay TypeScript SDK to monetize an MCP server with full control over auth, paywall behavior, and tool access.

Use this guide when you want to monetize an MCP server and keep implementation control in your own codebase.

<Note>
  If you want SolvaPay to host auth, checkout, and paywall enforcement with no
  code changes, use [Managed MCP](/guides/monetize-mcp-server-no-code) instead.
</Note>

## Who this is for

* Teams building custom MCP server behavior
* Teams that need custom auth and entitlement logic
* Teams that want SDK-level control instead of Managed MCP

## What you will achieve

By the end, your MCP server uses the SolvaPay SDK to enforce purchases and manage monetized tool access.

## What the change looks like

You wrap your existing tool handlers with `payable.mcp()`. Your business logic
stays untouched — SolvaPay intercepts the call, checks for a valid purchase,
and either runs your function or returns a checkout URL to the agent.

```typescript theme={null}
// Before — unprotected tool
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { arguments: args } = request.params
  return await createTask(args)
})

// After — protected with SolvaPay
const solvaPay = createSolvaPay({ apiKey: process.env.SOLVAPAY_SECRET_KEY })
const payable = solvaPay.payable({ product: 'prd_YOUR_PRODUCT_ID' })

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { arguments: args } = request.params
  return await payable.mcp(createTask)(args)
})
```

## Prerequisites

* A SolvaPay account
* A product and at least one plan in the SolvaPay Console
* A TypeScript MCP server project

Start from `createSolvaPayMcpServer` — the recommended factory that wires the transport, intent tools, paywall, and UI resource for you, so you register paid tools with `registerPayable` instead of hand-rolling an MCP server.

## Steps

1. Complete [SDK quick start](/sdks/typescript/setup/quick-start) to set up the base paywall flow.
2. Follow the [MCP integration guide](/sdks/typescript/guides/mcp) for the full implementation.
3. Configure identity with [custom auth](/sdks/typescript/guides/custom-auth) if your server uses external auth.
4. Add usage billing with [usage events](/sdks/typescript/guides/usage-events) where needed.
5. Render a custom checkout or account UI inside the host iframe with the [MCP App integration guide](/sdks/typescript/guides/mcp-app).

## Verify

* Protected MCP tools require an eligible purchase
* Valid purchases allow tool execution
* Usage events are recorded for billable calls

## Next related tasks

* [Monetize an MCP server without code](/guides/monetize-mcp-server-no-code)
* [Handle SolvaPay webhooks safely](/guides/handle-webhooks)
