# Set up a local MCP server

PayPal provides two ways for merchants to set up the MCP server:&#x20;

* **Running the MCP server locally.** This option enables developers to download, install, and run the MCP server locally.&#x20;
* **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.

One way to use the MCP server is to run it locally. To do that, you must first install Node.js <code class="expression">space.vars.NODE\_VERSION</code> or later. If you haven't already done so, visit the [Node.js](https://nodejs.org/en) website to download and install it.&#x20;

To install the MCP server in a local configuration:&#x20;

{% stepper %}
{% step %}

### Update the configuration file in your favorite MCP client

1. Open the MCP client.&#x20;
2. 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`.
3. In the new entry, replace `YOUR_PAYPAL_ACCESS_TOKEN` with your [actual PayPal access token](https://github.com/paypal/agent-toolkit/tree/main/modelcontextprotocol#generating-an-access-token). Alternatively, you can set the `PAYPAL_ACCESS_TOKEN` as an environment variable. You also can pass it as an argument using `--access-token` in `args`. \
   \
   Set the `PAYPAL_ENVIRONMENT` to `SANDBOX` for testing or `PRODUCTION` for your production environment.<br>

   <pre class="language-json" data-line-numbers><code class="lang-json">{
      "mcpServers": {
        "paypal": {
          "command": "npx",
          "args": [
            "-y",
            "@paypal/mcp",
            "--tools=all"
          ],
          "env": {
   <strong>         "PAYPAL_ACCESS_TOKEN": "YOUR_PAYPAL_ACCESS_TOKEN",
   </strong><strong>         "PAYPAL_ENVIRONMENT": "SANDBOX"
   </strong>       }
        }
      }
   } 
   </code></pre>

{% endstep %}

{% step %}

### Test your integration

1. Quit and restart the MCP client to apply your changes.&#x20;
2. 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.

{% hint style="info" %}
If your test doesn't produce the results you expect, try the ideas [here](https://modelcontextprotocol.io/docs/tools/debugging). &#x20;
{% endhint %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://paypal.gitbook.com/agent-toolkit-and-mcp-server/mcp-server/set-up-a-local-mcp-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
