CI License: MIT TypeScript smithery badge

Maintained by DynamicEndpoints - Contact: [email protected]

A Model Context Protocol (MCP) server that provides integration with PayPal's APIs. This server enables seamless interaction with PayPal's payment processing, invoicing, and business management features through a standardized interface.

PayPal MCP server

Architecture

graph TB
    subgraph "MCP Environment"
        Client[MCP Client]
        Server[PayPal MCP Server]
        Validation[Input Validation]
        Auth[OAuth Authentication]
    end

    subgraph "PayPal APIs"
        Orders[Orders API]
        Payments[Payments API]
        Payouts[Payouts API]
        Invoicing[Invoicing API]
        Products[Products API]
        Disputes[Disputes API]
        Identity[Identity API]
    end

    Client --> |Request| Server
    Server --> |Response| Client
    Server --> Validation
    Server --> Auth
    Auth --> |Access Token| PayPal

    Server --> Orders
    Server --> Payments
    Server --> Payouts
    Server --> Invoicing
    Server --> Products
    Server --> Disputes
    Server --> Identity

    style Client fill:#f9f,stroke:#333,stroke-width:2px
    style Server fill:#bbf,stroke:#333,stroke-width:2px
    style Auth fill:#bfb,stroke:#333,stroke-width:2px
    style Validation fill:#bfb,stroke:#333,stroke-width:2px

Features

  • Payment Processing
  • Create and manage orders
  • Process payments
  • Handle payment tokens
  • Manage disputes

  • Business Operations

  • Create and manage products
  • Generate invoices
  • Process payouts
  • Handle partner referrals

  • User Management

  • Identity verification
  • User information retrieval
  • Web profile management

Installation

Installing via Smithery

To install PayPal MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @DynamicEndpoints/Paypal-MCP --client claude

Manual Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Build the project:
    npm run build
  4. Configure PayPal credentials in the MCP settings file:
    {
      "mcpServers": {
        "paypal": {
          "command": "node",
          "args": ["path/to/paypal-server/build/index.js"],
          "env": {
            "PAYPAL_CLIENT_ID": "your_client_id",
            "PAYPAL_CLIENT_SECRET": "your_client_secret"
          },
          "disabled": false,
          "autoApprove": []
        }
      }
    }

Available Tools

Payment Operations

create_payment_token

Create a payment token for future use.

{
  customer: {
    id: string;
    email_address?: string;
  };
  payment_source: {
    card?: {
      name: string;
      number: string;
      expiry: string;
      security_code: string;
    };
    paypal?: {
      email_address: string;
    };
  };
}

create_order

Create a new order in PayPal.

{
  intent: 'CAPTURE' | 'AUTHORIZE';
  purchase_units: Array<{
    amount: {
      currency_code: string;
      value: string;
    };
    description?: string;
    reference_id?: string;
  }>;
}

create_payment

Create a direct payment.

{
  intent: string;
  payer: {
    payment_method: string;
    funding_instruments?: Array<{
      credit_card?: {
        number: string;
        type: string;
        expire_month: number;
        expire_year: number;
        cvv2: string;
        first_name: string;
        last_name: string;
      };
    }>;
  };
  transactions: Array<{
    amount: {
      total: string;
      currency: string;
    };
    description?: string;
  }>;
}

Business Operations

create_product

Create a new product in the catalog.

{
  name: string;
  description: string;
  type: 'PHYSICAL' | 'DIGITAL' | 'SERVICE';
  category: string;
  image_url?: string;
  home_url?: string;
}

create_invoice

Generate a new invoice.

{
  invoice_number: string;
  reference: string;
  currency_code: string;
  recipient_email: string;
  items: Array<{
    name: string;
    quantity: string;
    unit_amount: {
      currency_code: string;
      value: string;
    };
  }>;
}

create_payout

Process a batch payout.

{
  sender_batch_header: {
    sender_batch_id: string;
    email_subject?: string;
    recipient_type?: string;
  };
  items: Array<{
    recipient_type: string;
    amount: {
      value: string;
      currency: string;
    };
    receiver: string;
    note?: string;
  }>;
}

User & Profile Management

get_userinfo

Retrieve user information.

{
  access_token: string;
}

create_web_profile

Create a web experience profile.

{
  name: string;
  presentation?: {
    brand_name?: string;
    logo_image?: string;
    locale_code?: string;
  };
  input_fields?: {
    no_shipping?: number;
    address_override?: number;
  };
  flow_config?: {
    landing_page_type?: string;
    bank_txn_pending_url?: string;
  };
}

Usage Examples

Creating an Order

const result = await mcpClient.useTool('paypal', 'create_order', {
  intent: 'CAPTURE',
  purchase_units: [{
    amount: {
      currency_code: 'USD',
      value: '100.00'
    },
    description: 'Premium Subscription'
  }]
});

Generating an Invoice

const result = await mcpClient.useTool('paypal', 'create_invoice', {
  invoice_number: 'INV-2024-001',
  reference: 'REF-2024-001',
  currency_code: 'USD',
  recipient_email: '[email protected]',
  items: [{
    name: 'Consulting Services',
    quantity: '1',
    unit_amount: {
      currency_code: 'USD',
      value: '500.00'
    }
  }]
});

Processing a Payout

const result = await mcpClient.useTool('paypal', 'create_payout', {
  sender_batch_header: {
    sender_batch_id: 'Payroll_2024_001',
    email_subject: 'You have received a payment'
  },
  items: [{
    recipient_type: 'EMAIL',
    amount: {
      value: '1000.00',
      currency: 'USD'
    },
    receiver: '[email protected]',
    note: 'Monthly salary payment'
  }]
});

Error Handling

The server implements comprehensive error handling:

  • Input validation errors with detailed messages
  • PayPal API errors with response details
  • Network and authentication errors
  • Rate limiting and timeout handling

Security Considerations

  • All sensitive data is validated and sanitized
  • OAuth 2.0 authentication with PayPal
  • Secure credential management through environment variables
  • Input validation for all API parameters
  • Error messages do not expose sensitive information

Development

Building

npm run build

Testing

npm test

Debugging

The server outputs detailed logs to help with debugging: - Authentication issues - API call failures - Validation errors - Request/response details

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License

[
  {
    "description": "Create a payment token",
    "inputSchema": {
      "properties": {
        "customer": {
          "properties": {
            "email_address": {
              "type": "string"
            },
            "id": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "type": "object"
        },
        "payment_source": {
          "properties": {
            "card": {
              "properties": {
                "expiry": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "security_code": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "paypal": {
              "properties": {
                "email_address": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "customer",
        "payment_source"
      ],
      "type": "object"
    },
    "name": "create_payment_token"
  },
  {
    "description": "Create a payment",
    "inputSchema": {
      "properties": {
        "intent": {
          "type": "string"
        },
        "payer": {
          "properties": {
            "funding_instruments": {
              "items": {
                "properties": {
                  "credit_card": {
                    "properties": {
                      "cvv2": {
                        "type": "string"
                      },
                      "expire_month": {
                        "type": "number"
                      },
                      "expire_year": {
                        "type": "number"
                      },
                      "first_name": {
                        "type": "string"
                      },
                      "last_name": {
                        "type": "string"
                      },
                      "number": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "type": "array"
            },
            "payment_method": {
              "type": "string"
            }
          },
          "required": [
            "payment_method"
          ],
          "type": "object"
        },
        "transactions": {
          "items": {
            "properties": {
              "amount": {
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "total": {
                    "type": "string"
                  }
                },
                "required": [
                  "total",
                  "currency"
                ],
                "type": "object"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "amount"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "intent",
        "payer",
        "transactions"
      ],
      "type": "object"
    },
    "name": "create_payment"
  },
  {
    "description": "Create a batch payout",
    "inputSchema": {
      "properties": {
        "items": {
          "items": {
            "properties": {
              "amount": {
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "value",
                  "currency"
                ],
                "type": "object"
              },
              "note": {
                "type": "string"
              },
              "receiver": {
                "type": "string"
              },
              "recipient_type": {
                "type": "string"
              },
              "sender_item_id": {
                "type": "string"
              }
            },
            "required": [
              "recipient_type",
              "amount",
              "receiver"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "sender_batch_header": {
          "properties": {
            "email_subject": {
              "type": "string"
            },
            "recipient_type": {
              "type": "string"
            },
            "sender_batch_id": {
              "type": "string"
            }
          },
          "required": [
            "sender_batch_id"
          ],
          "type": "object"
        }
      },
      "required": [
        "sender_batch_header",
        "items"
      ],
      "type": "object"
    },
    "name": "create_payout"
  },
  {
    "description": "Create a referenced payout",
    "inputSchema": {
      "properties": {
        "referenced_payouts": {
          "items": {
            "properties": {
              "payout_amount": {
                "properties": {
                  "currency_code": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "currency_code",
                  "value"
                ],
                "type": "object"
              },
              "payout_destination": {
                "type": "string"
              },
              "reference_id": {
                "type": "string"
              },
              "reference_type": {
                "type": "string"
              }
            },
            "required": [
              "reference_id",
              "reference_type",
              "payout_amount",
              "payout_destination"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "referenced_payouts"
      ],
      "type": "object"
    },
    "name": "create_referenced_payout"
  },
  {
    "description": "Create a new order in PayPal",
    "inputSchema": {
      "properties": {
        "intent": {
          "enum": [
            "CAPTURE",
            "AUTHORIZE"
          ],
          "type": "string"
        },
        "purchase_units": {
          "items": {
            "properties": {
              "amount": {
                "properties": {
                  "currency_code": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "currency_code",
                  "value"
                ],
                "type": "object"
              },
              "description": {
                "type": "string"
              },
              "reference_id": {
                "type": "string"
              }
            },
            "required": [
              "amount"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "intent",
        "purchase_units"
      ],
      "type": "object"
    },
    "name": "create_order"
  },
  {
    "description": "Create a partner referral",
    "inputSchema": {
      "properties": {
        "business_entity": {
          "properties": {
            "business_name": {
              "type": "string"
            },
            "business_type": {
              "properties": {
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          },
          "required": [
            "business_type",
            "business_name"
          ],
          "type": "object"
        },
        "email": {
          "type": "string"
        },
        "individual_owners": {
          "items": {
            "properties": {
              "names": {
                "items": {
                  "properties": {
                    "given_name": {
                      "type": "string"
                    },
                    "surname": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "given_name",
                    "surname"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "names"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "individual_owners",
        "business_entity",
        "email"
      ],
      "type": "object"
    },
    "name": "create_partner_referral"
  },
  {
    "description": "Create a web experience profile",
    "inputSchema": {
      "properties": {
        "flow_config": {
          "properties": {
            "bank_txn_pending_url": {
              "type": "string"
            },
            "landing_page_type": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "input_fields": {
          "properties": {
            "address_override": {
              "type": "number"
            },
            "no_shipping": {
              "type": "number"
            }
          },
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "presentation": {
          "properties": {
            "brand_name": {
              "type": "string"
            },
            "locale_code": {
              "type": "string"
            },
            "logo_image": {
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "name": "create_web_profile"
  },
  {
    "description": "Create a new product in PayPal",
    "inputSchema": {
      "properties": {
        "category": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "home_url": {
          "type": "string"
        },
        "image_url": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "enum": [
            "PHYSICAL",
            "DIGITAL",
            "SERVICE"
          ],
          "type": "string"
        }
      },
      "required": [
        "name",
        "description",
        "type",
        "category"
      ],
      "type": "object"
    },
    "name": "create_product"
  },
  {
    "description": "List all products",
    "inputSchema": {
      "properties": {
        "page": {
          "minimum": 1,
          "type": "number"
        },
        "page_size": {
          "maximum": 100,
          "minimum": 1,
          "type": "number"
        }
      },
      "type": "object"
    },
    "name": "list_products"
  },
  {
    "description": "Get details of a dispute",
    "inputSchema": {
      "properties": {
        "dispute_id": {
          "type": "string"
        }
      },
      "required": [
        "dispute_id"
      ],
      "type": "object"
    },
    "name": "get_dispute"
  },
  {
    "description": "Get user info from identity token",
    "inputSchema": {
      "properties": {
        "access_token": {
          "type": "string"
        }
      },
      "required": [
        "access_token"
      ],
      "type": "object"
    },
    "name": "get_userinfo"
  },
  {
    "description": "Create a new invoice",
    "inputSchema": {
      "properties": {
        "currency_code": {
          "type": "string"
        },
        "invoice_number": {
          "type": "string"
        },
        "items": {
          "items": {
            "properties": {
              "name": {
                "type": "string"
              },
              "quantity": {
                "type": "string"
              },
              "unit_amount": {
                "properties": {
                  "currency_code": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "recipient_email": {
          "type": "string"
        },
        "reference": {
          "type": "string"
        }
      },
      "required": [
        "invoice_number",
        "reference",
        "currency_code",
        "recipient_email",
        "items"
      ],
      "type": "object"
    },
    "name": "create_invoice"
  }
]