Sponsored by Deepsite.site

Ra Pay

Created By
Ra Pay AIa month ago
Ra Pay AI is the first AI native payment primitive for AI Agents that uses CLI as its distribution layer and a MCP server for AI Agent automation while keeping humans in control. Ra Pay AI's terminal architecture delivers superior privacy, AI token costs and reduced prompt injection attack surface compared to browser GUI based AI Agent payment applications. Yes, we just solved AI Payments using the terminal as our distribution layer. We did it first. For every computer on earth. Use Ra Pay AI to keep an eye on your payment privacy and your AI token costs. Join us. npm install -g @rapay/cli
Overview
⚠️

@rapay/mcp-server
TypeScript icon, indicating that this package has built-in type declarations

1.2.6 • Public • Published

Ra Pay MCP Server

MCP (Model Context Protocol) server for AI agent payment automation. Enables Claude Desktop, Claude API, and ChatGPT to execute payments via Ra Pay CLI.

Status: Perplexity Security Review APPROVED (98% confidence)

Features

  • 6 MVP tools for payment operations
  • Subprocess isolation (credentials never leave keyring)
  • Response sanitization (prevents prompt injection)
  • Rate limiting (1 payment/min, 10 queries/min)
  • Audit logging

Installation

Prerequisites

  • Node.js 18+
  • Ra Pay CLI installed and authenticated (ra link-bank)

Setup

cd rapay/mcp-server
npm install
npm run build

Claude Desktop Configuration

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "rapay": {
      "command": "node",
      "args": ["/Users/yourname/rapay/mcp-server/dist/index.js"]
    }
  }
}

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "rapay": {
      "command": "node",
      "args": ["C:\\Users\\yourname\\rapay\\mcp-server\\dist\\index.js"]
    }
  }
}

With custom CLI path:

{
  "mcpServers": {
    "rapay": {
      "command": "node",
      "args": ["/path/to/rapay/mcp-server/dist/index.js"],
      "env": {
        "RAPAY_CLI_PATH": "/custom/path/to/ra"
      }
    }
  }
}

After adding, restart Claude Desktop. You should see "rapay" in the MCP servers list.

Tools

Payment Operations (SENSITIVE)

ToolDescription
ra_sendExecute a payment transaction
ra_subscribeCreate a subscription for a customer
ra_refundOpen Stripe Dashboard for refunds

Query Operations

ToolDescription
ra_balanceCheck available balance
ra_historyGet transaction history
ra_whoamiCheck account status

Security

Subprocess Isolation

MCP server spawns Ra Pay CLI as subprocess. Credentials remain in OS keyring - MCP server never sees them directly.

Response Sanitization

All CLI output is sanitized to prevent prompt injection:

  • ANSI escape sequences removed
  • System markers filtered ([SYSTEM], [USER], etc.)
  • Control characters stripped

Rate Limiting

Defense-in-depth layer at MCP level:

ToolLimit
ra_send1 per 60 seconds
ra_subscribe1 per 60 seconds
ra_refund5 per 60 seconds
ra_balance10 per 60 seconds
ra_history10 per 60 seconds
ra_whoami20 per 60 seconds

Note: Backend also enforces velocity controls (account-tier daily limits).

Privacy & Data Storage

Ra Pay is designed as a "dumb pipe" to Stripe:

What Ra Pay stores:

  • Your user ID
  • Your Stripe account ID (encrypted)
  • Action logs: "payment sent", "balance checked" (no amounts)
  • Transaction audit trail with Stripe transfer IDs

What Ra Pay does NOT store:

  • Your payment amounts
  • Recipient details
  • Payment descriptions
  • Your account balance
  • Any personally identifiable information (Stripe handles KYC)

What MCP server adds:

  • Client type tracking ("called via Claude Desktop")
  • Tool call audit logs (same privacy level as above)
  • No new PII storage

Configuration

Environment Variables

VariableDescriptionDefault
RAPAY_CLI_PATHPath to Ra Pay CLI executablera

Audit Logging

Logs are written to ~/.rapay/mcp-audit.log with 7-day retention:

  • Tool name, timestamp, duration
  • Result (success/error/rate_limited)
  • Sanitized inputs (amounts redacted, emails masked)

Error Handling

Error Codes

CodeDescriptionRetryable
RATE_LIMIT_EXCEEDEDMCP rate limit hitNo (wait)
CLI_NOT_FOUNDRa Pay CLI not installedNo
TOS_ACCEPTANCE_REQUIREDToS not acceptedNo
ACCOUNT_NOT_LINKEDStripe account not linkedNo
VELOCITY_EXCEEDEDDaily limit exceededNo
TIMEOUTRequest timed outYes
NETWORK_ERRORNetwork connectivity issueYes
EXECUTION_FAILEDGeneric CLI errorNo

Rate Limit Error

{
  "error": "rate_limit_exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "message": "Too many requests. Please wait 60 seconds.",
  "retry_after_seconds": 60,
  "retryable": false
}

CLI Not Found Error

{
  "error": "cli_not_found",
  "code": "CLI_NOT_FOUND",
  "message": "Ra Pay CLI not found. Please install it first.",
  "retryable": false
}

ToS Required Error

{
  "error": "tos_required",
  "code": "TOS_ACCEPTANCE_REQUIRED",
  "message": "Terms of Service must be accepted. Run 'ra accept-tos' first.",
  "retryable": false
}

For Claude API Callers: Exponential Backoff

If you receive RATE_LIMIT_EXCEEDED, implement exponential backoff:

const maxRetries = 3;
let delay = 60; // seconds

for (let attempt = 0; attempt < maxRetries; attempt++) { try { return await mcp.callTool('ra_send', params); } catch (error) { if (error.code === 'RATE_LIMIT_EXCEEDED') { console.log(Rate limited. Waiting <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">delay</span><span class="pl-kos">}</span></span>s before retry...); await sleep(delay 1000); delay = 2; // exponential backoff } else { throw error; } } }

// DO NOT: // - Retry immediately (wastes time, still rate limited) // - Retry more than 3 times (indicates genuine rate limit) // - Ignore retry_after_seconds field

Note: MCP rate limiting is client-side defense-in-depth. Backend also enforces velocity controls per account tier.

Data Flow

You (Claude Desktop/API)
    |
    v
MCP Server (this package)
    | - Logs tool calls (no amounts/PII)
    | - Rate limits requests
    | - Sanitizes responses
    v
Ra Pay CLI (subprocess)
    | - Credentials in OS keyring
    | - Adds replay protection
    v
Ra Pay Backend
    | - Validates requests
    | - Enforces velocity limits
    v
Stripe API
    | - Owns all PII
    | - Processes payments
    v
Recipient's Bank

All sensitive data flows directly to Stripe. Ra Pay only records that an action occurred.

Security Model

This section documents the security posture of the published npm package.

What's Published to npm

CategoryIncludedExcluded
Compiled JavaScriptYes-
TypeScript declarationsYes-
Source maps (.js.map)NoExcluded for code privacy
Source code (src/)NoDevelopment only

Intentionally Public Information

MetadataValueRationale
Repositorygithub.com/Ra-Pay-AI/rapayOpen source by design
AuthorRa PayCompany name
LicenseMITStandard permissive license
Keywordsmcp, payments, stripe, claudeDiscoverability

Security Features Exposed (By Design)

These are documented for users and do not represent vulnerabilities:

  • Rate limiting rules - Users need to know limits to implement backoff
  • Error codes - Required for proper error handling
  • Tool schemas - Required by MCP protocol specification
  • Audit log location (~/.rapay/mcp-audit.log) - Users may need to inspect

What Is NOT Exposed

CategoryProtection
API keys/secretsNever in code (OS keyring only)
Backend URLsOnly public rapay.ai endpoints
User dataSubprocess isolation, never in MCP process
Payment amountsRedacted as [redacted] in all logs
Email addressesMasked (j***@example.com) in audit logs

Subprocess Isolation Model

┌─────────────────────┐
│  AI Agent (Claude)  │
└─────────┬───────────┘
          │ MCP Protocol (stdio)
┌─────────────────────┐
│  MCP Server (npm)   │  ← No credentials here
│  - Rate limiting    │
│  - Input validation │
│  - Response sanitize│
└─────────┬───────────┘
          │ Spawns subprocess
┌─────────────────────┐
│  Ra Pay CLI         │  ← Credentials in OS keyring
│  - Session tokens   │
│  - Stripe API calls │
└─────────────────────┘

The MCP server never has access to credentials. All sensitive operations are delegated to the CLI subprocess, which reads credentials directly from the OS keyring.

Development

npm run dev    # Watch mode
npm run build  # Build
npm run lint   # Lint
npm run test   # Test

License

MIT

Server Config

{
  "mcpServers": {
    "rapay": {
      "command": "npx",
      "args": [
        "-y",
        "@rapay/mcp-server"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Tavily Mcp
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
Serper MCP ServerA Serper MCP Server
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.