MCP server
Last updated: Apr 10th, 11:13am
Model Context Protocol (MCP) supports managing and passing relevant information to models with appropriate context, so they operate properly within a given scope. Using this technology, PayPal developed an MCP server to enable merchants to use natural language with their favorite MCP client to perform business tasks, such as creating or listing invoices.
Examples in this content use Claude as the MCP client, but you can use any MCP client that you prefer, such as Cursor or Cline.
Set up MCP server
PayPal provides two ways for merchants to set up the MCP server:
- Running the MCP server locally. This option enables developers to download, install, and run the MCP server locally.
- Using the MCP server remotely. This option is for users who prefer not to install the MCP server locally. With remote MCP server support, users can continue their tasks across devices with a single login after authentication.
Run MCP server locally
A preferred way to use the MCP server in some environments is to run it locally. To do that, you have to install Node.js locally first.
To install the MCP server in a local configuration:
- Visit the Node.js official website to download and install it. Be sure that you are running Node.js v18 or later.
- Update the configuration file in your favorite MCP client:
- Open the MCP client.
- In the configuration settings for the client, locate the external tools or connectors configuration section, and add the PayPal connector configuration that follows this procedure. In Claude, for example, you add this to
~/Claude/claude_desktop_config.json
- In the new entry, replace
YOUR_PAYPAL_ACCESS_TOKEN
with your actual PayPal access token. Alternatively, you can set thePAYPAL_ACCESS_TOKEN
as an environment variable. You also can pass it as an argument using--access-token
inargs
.
Set thePAYPAL_ENVIRONMENT
toSANDBOX
for testing orPRODUCTION
for your production environment.
- Test your integration:
- Quit and restart the MCP client to apply your changes.
- Ask the MCP client to perform one of the supported tasks. For example, ask the MCP client to list your PayPal invoices for the last month.
1{2 "mcpServers": {3 "paypal": {4 "command": "npx",5 "args": [6 "-y",7 "@paypal/mcp",8 "--tools=all"9 ],10 "env": {11 "PAYPAL_ACCESS_TOKEN": "YOUR_PAYPAL_ACCESS_TOKEN",12 "PAYPAL_ENVIRONMENT": "SANDBOX"13 }14 }15 }16}
If your test effort doesn't produce the results you expect, try the ideas here.
Connect to MCP server remotely
Another way of connecting with the MCP server is to do so remotely. Use your preferred MCP client for this procedure.
- Open the configuration file for your MCP client in a text editor, and replace the configuration with the new configuration that follows this procedure.
- Save the file, and restart your MCP client. The MCP client will send you to the PayPal login page.
- Provide your consent for the client to work with the MCP server:
- Log into PayPal when the login page appears.
- Authorize the client to work with the MCP server.
- Quit and reopen your MCP client.
- To test your integration, ask the MCP client to preform one of the supported tasks. For example, ask it to create an invoice for landscaping services for Green Lawns for $200 with a date of last Friday.
1{2 "mcpServers": {3 "paypal-mcp-server": {4 "command": "npx",5 "args": [6 "mcp-remote",7 "https://mcp.paypal.com/sse"8 ]9 }10 }11}
If you have trouble connecting after completing this procedure, clear the files that the integration adds to ~/.mcp-auth:
rm -rf ~/.mcp-auth
Also be aware that emerging technology, like MCP and MCP clients, can come with performance issues or other challenges initially. For example, Windows users with Cursor might encounter a known issue when connecting to the MCP server remotely.
MCP server tools overview
The MCP server currently include tools for performing 2 critical invoice jobs:
- Creating invoices
- Listing invoices
Plans for this feature include adding more tools over time.
Create invoice
Using your favorite MCP client with the MCP server to create invoices offers several advantages over creating invoices in a more traditional way. For example, a merchant can use natural language with an MCP client to process multiple invoice requests by using a drive-system connector or a file-system connector. With this connection, users can ask the MCP client to perform a PayPal-related task, the MCP clients access their records for the data, and then the client uses that data to send PayPal invoices to multiple customers in bulk.
For example, a user asks the MCP client to create an invoice with PayPal.
The user supplies the necessary information, as the MCP client indicates. Then the MCP client accesses the necessary data, creates the invoice using the MCP server, and then it sends the invoice, as shown in the following illustration.
The following example shows a sample of the invoice the customer receives.
List invoices
This tool lists the merchant or service provider's PayPal invoices. Additionally, the merchant or service provider can gain valuable data, such as identifying unpaid customer invoices or tracking invoice-related trends for a specific time period.