Installation

This page covers all installation options for @mcp2p/sdk, including peer dependencies, TypeScript configuration, and the environment variables required before the server can start.

Install the package

Install @mcp2p/sdk using your preferred package manager:

# pnpm (recommended)
pnpm add @mcp2p/sdk

# npm
npm install @mcp2p/sdk

# yarn
yarn add @mcp2p/sdk

# bun
bun add @mcp2p/sdk

Peer dependencies

@mcp2p/sdk has the following peer dependencies that must be installed alongside it:

PackageVersionNotes
zod^3.22Runtime schema validation
@modelcontextprotocol/sdk^1.0MCP protocol transport layer

Install them together:

pnpm add @mcp2p/sdk zod @modelcontextprotocol/sdk

TypeScript setup

The SDK ships with full TypeScript types. No additional @types/ packages are needed. Your tsconfig.json should target ES2022 or later and use moduleResolution: "bundler" or "node16":

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  }
}
The SDK enforces strict TypeScript. Your createMcp2pServer call will produce type errors if required fields are missing — this is the first of the four license gates.

Running with tsx

For development without a compile step, install tsx as a dev dependency:

pnpm add -D tsx

# Then run your server with:
npx tsx server.ts

Building for production

For production deployments, compile to JavaScript first:

# Compile
npx tsc

# Run compiled output
node dist/server.js

Environment variables

The following environment variables must be set before the SDK starts. The SDK reads these at startup and will throw a descriptive error if any required variable is missing.

VariableRequiredDescription
MCP2P_LICENSE_KEYYesYour mcp2p license key. Format: mcp2p_[env]_[hash]
TWILIO_ACCOUNT_SIDYesTwilio Account SID for 2FA SMS delivery
TWILIO_AUTH_TOKENYesTwilio Auth Token
TWILIO_VERIFY_SERVICE_SIDYesTwilio Verify Service SID
BANK_API_KEYYesYour bank aggregator API key. Name may vary by provider.
MCP2P_LICENSE_SERVER_URLNoOverride the license server URL. Defaults to the production endpoint.
Never commit .env files or hardcode secrets in source code. Use your platform's secret management — Vercel environment variables, Cloudflare Workers secrets, or a secrets manager.

Example .env file

# mcp2p license
MCP2P_LICENSE_KEY=mcp2p_test_your_key_here

# Twilio Verify (2FA)
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_VERIFY_SERVICE_SID=VAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Bank connector
BANK_API_KEY=your_aggregator_api_key

Verifying the installation

After installing, verify the package resolves correctly by checking its exported types:

import { createMcp2pServer } from "@mcp2p/sdk";
// TypeScript should resolve this with full autocomplete
  • If you see a Cannot find module error, verify that node_modules/@mcp2p/sdk exists and that your moduleResolution setting is compatible.
  • If you see peer dependency warnings, install the missing peer deps listed in the table above.

Next steps

Once installed, proceed to Configuration to learn all available options for createMcp2pServer, or go back to Getting Started for a step-by-step walkthrough.