# Self-hosted MCP

> Run the open-source Grovs MCP server against your own self-hosted Grovs backend.

Source: https://docs.grovs.io/docs/ai/mcp/self-hosted

On Grovs Cloud, AI tools connect to `https://mcp.grovs.io/mcp`. If you run Grovs yourself, run the MCP server too and point it at your backend. The server is open source: [github.com/grovs-io/mcp](https://github.com/grovs-io/mcp).

Your Grovs backend already serves the OAuth endpoints and the API the MCP server uses, on its `mcp.` host (for example `mcp.grovs.example.com`). See [Self-hosting](https://docs.grovs.io/docs/self-hosting). The MCP server is a separate Node.js process that AI tools talk to.

## Run the server

```bash
git clone https://github.com/grovs-io/mcp.git
cd mcp
npm install && npm run build
GROVS_API_URL=https://mcp.grovs.example.com \
PUBLIC_URL=https://ai.grovs.example.com \
npm start
```

Or with Docker:

```bash
docker build -t grovs-mcp .
docker run -p 8080:8080 \
  -e GROVS_API_URL=https://mcp.grovs.example.com \
  -e PUBLIC_URL=https://ai.grovs.example.com \
  grovs-mcp
```

| Variable        | Default                 | Description                                                  |
| --------------- | ----------------------- | ------------------------------------------------------------ |
| `PORT`          | `8080`                  | Port the server listens on.                                  |
| `GROVS_API_URL` | `https://mcp.grovs.io`  | Your Grovs backend's `mcp.` host.                            |
| `PUBLIC_URL`    | `http://localhost:8080` | The public URL of this MCP server, used for OAuth callbacks. |

`ai.grovs.example.com` above is an example: serve the MCP server on any HTTPS host your AI tools can reach, and set `PUBLIC_URL` to it.

## Connect your tools

Use `<PUBLIC_URL>/mcp` as the server URL, for example `https://ai.grovs.example.com/mcp`, in any of the client guides: [Cursor](https://docs.grovs.io/docs/ai/mcp/cursor), [VS Code](https://docs.grovs.io/docs/ai/mcp/vs-code), [Claude Code](https://docs.grovs.io/docs/ai/mcp/claude-code), [Claude Desktop](https://docs.grovs.io/docs/ai/mcp/claude-desktop), [ChatGPT](https://docs.grovs.io/docs/ai/mcp/chatgpt), [Windsurf](https://docs.grovs.io/docs/ai/mcp/windsurf). On the [Build with AI](https://docs.grovs.io/docs/ai#connect-the-mcp-server) page, switch the server URL to **Self-hosted** to get install buttons for your URL.

For a quick local try, run the server on your machine and use `http://localhost:8080/mcp`. ChatGPT and Claude.ai connect from their own servers, so they need a public HTTPS URL.

The first time a tool connects, it opens your dashboard's consent page (`/mcp/authorize`, set by `MCP_CONSENT_URL` in the [backend configuration](https://docs.grovs.io/docs/self-hosting/configure/configuration)) to approve it.
