# Configure Local MCP The local MCP server runs as a single process on your machine via the `@digitalocean/mcp` npm package, providing a unified bridge to DigitalOcean services. You enable the services you need, such as App Platform, Droplets, or Databases, by adding them in your local `mcp.json` client configuration. The MCP client then uses this configuration to launch the server and manage your DigitalOcean resources. ## Prerequisites To use the local MCP server, you need the following: - Node.js v18 or later - npm v8 or later - An MCP client such as [Claude](#claude), [Cursor](#cursor), [VS Code](#vs-code), or [Windsurf](#windsurf) - A [DigitalOcean API token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) **Warning**: Do not commit access tokens to your Git repository. Many MCP clients require you to put access tokens directly in their configuration files. This is safe only if the configuration file is **not** checked into a Git repository and has appropriately restricted read permissions. If the configuration file is in a Git repository, add it to `.gitignore` or use any available client-specific techniques (for example, VS Code’s [input variable substitution](https://code.visualstudio.com/docs/reference/variables-reference#_input-variables)) to avoid exposing your access token. The DigitalOcean MCP server runs locally using npm’s `npx` command and requires no further installation. ## Configure the Local MCP Server The local MCP server (`@digitalocean/mcp`) is launched directly by your MCP client using the settings defined in your `mcp.json` configuration file. The exact location of this file and how it is applied depends on your MCP client. To enable local MCP services, add an entry to the `mcpServers` block with the following: - `command` set to `"npx"` - `args` that include the MCP package name and the `--services` flag to add the DigitalOcean services you want to enable, such as `"apps"`, `"droplets"`, or `"databases"` - `env` that contains your DigitalOcean API token The following example configures the DigitalOcean MCP server with `` and enables access to only the App Platform (`apps`) service. Replace `` with your DigitalOcean API token, or use the client-specific method of variable substitution (if available) to keep your token out of the configuration file. ```json { "mcpServers": { "digitalocean": { "command": "npx", "args": ["-y", "@digitalocean/mcp", "--services", "apps"], "env": { "DIGITALOCEAN_API_TOKEN": "" } } } } ``` Refer to the [`mcp-digitalocean` repository](https://github.com/digitalocean-labs/mcp-digitalocean) for more information on supported DigitalOcean services and detailed lists and descriptions of their available tools. ## Add the MCP Server to Your MCP Client ### Claude Use `claude mcp add` to add the MCP server to Claude Code (the server must be defined in your `mcp.json` file first). Set the `DIGITALOCEAN_API_TOKEN` environment variable to your DigitalOcean API token before running this command: ```shell claude mcp add digitalocean \ --env DIGITALOCEAN_API_TOKEN=${DIGITALOCEAN_API_TOKEN} \ -- npx -y "@digitalocean/mcp" ``` Check if the addition was successful by listing your available MCP servers: ```shell claude mcp list ``` For more information, see the official Claude Code [Installing MCP servers](https://docs.anthropic.com/en/docs/claude-code/mcp#installing-mcp-servers) documentation. To add MCP servers using Claude Desktop, see [Getting started with Local MCP Servers on Claude Desktop](https://support.anthropic.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop). ### Cursor [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=digitalocean&config=eyJjb21tYW5kIjoibnB4IEBkaWdpdGFsb2NlYW4vbWNwIC0tc2VydmljZXMgYXBwcyIsImVudiI6eyJESUdJVEFMT0NFQU5fQVBJX1RPS0VOIjoiIn19) Use the **Add to Cursor** badge or see [Cursor’s Model Context Protocol docs](https://docs.cursor.com/context/model-context-protocol) to add the DigitalOcean MCP server to Cursor. ### Visual Studio Code See [Use MCP servers in VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) to add the DigitalOcean MCP server to Visual Studio Code. ### Windsurf See the [Windsurf Cascade MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp) to learn how to add the DigitalOcean MCP server to Windsurf. After you add the MCP server to your client, the local MCP server is launched whenever you access a DigitalOcean service enabled in your client’s configuration. ## Troubleshooting If your DigitalOcean MCP server is not working as expected, check the following common issues. ### Authentication Issues The DigitalOcean MCP server requires an active and properly-scoped access token: - Ensure the `DIGITALOCEAN_API_TOKEN` variable is correctly set in the MCP server's environment. - Verify the access token has appropriate permissions for the services you're using. - Check that the access token hasn't expired. ### Unsupported Region or Service An LLM may configure services or features that are not available in the specified region: - Check [regional availability](https://docs.digitalocean.com/platform/regional-availability/index.html.md) for the service you're setting up. - Verify the service is available in your selected region. - Use `doctl compute region list` to see available regions. ### Debugging Best Practices When debugging issues with LLMs and the DigitalOcean MCP server, consider the following: - **Keep Logs**: Save the MCP request/response logs for reproducibility. - **Start Small**: Test with small and focused operations first before moving on to complex workflows. - **Check Permissions**: Ensure your API token has the necessary scopes.