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/sdkPeer dependencies
@mcp2p/sdk has the following peer dependencies that must be installed alongside it:
| Package | Version | Notes |
|---|---|---|
| zod | ^3.22 | Runtime schema validation |
| @modelcontextprotocol/sdk | ^1.0 | MCP protocol transport layer |
Install them together:
pnpm add @mcp2p/sdk zod @modelcontextprotocol/sdkTypeScript 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
}
}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.tsBuilding for production
For production deployments, compile to JavaScript first:
# Compile
npx tsc
# Run compiled output
node dist/server.jsEnvironment 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.
| Variable | Required | Description |
|---|---|---|
| MCP2P_LICENSE_KEY | Yes | Your mcp2p license key. Format: mcp2p_[env]_[hash] |
| TWILIO_ACCOUNT_SID | Yes | Twilio Account SID for 2FA SMS delivery |
| TWILIO_AUTH_TOKEN | Yes | Twilio Auth Token |
| TWILIO_VERIFY_SERVICE_SID | Yes | Twilio Verify Service SID |
| BANK_API_KEY | Yes | Your bank aggregator API key. Name may vary by provider. |
| MCP2P_LICENSE_SERVER_URL | No | Override the license server URL. Defaults to the production endpoint. |
.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_keyVerifying 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 moduleerror, verify thatnode_modules/@mcp2p/sdkexists and that yourmoduleResolutionsetting 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.