gbp-mcp
by vivdigital
README.md
# gbp-mcp
An [MCP](https://modelcontextprotocol.io/) server for [Google Business Profile](https://business.google.com/). It lets AI assistants list accounts and locations, publish and update posts, manage reviews and photos, edit listing details, and read performance metrics.
The server speaks MCP over stdio. The included Docker image wraps that stdio server with [supergateway](https://github.com/supercorp-ai/supergateway) so clients can connect over HTTP/SSE on port 8765 (container port 8000).
Built with Grok.
This project started from [narkov/gbp-mcp-server](https://github.com/narkov/gbp-mcp-server) and has been substantially extended (location editing, performance reads, media uploads, and safer post CTA handling). Code carried over from that project (some files modified) is in `src/index.ts`, `src/auth.ts`, `src/auth-setup.ts`, `src/gbp-client.ts` and `src/tools/{accounts,media,posts,reviews}.ts`; narkov's MIT notice is kept in `LICENSE`.
## Tools
| Tool | Description |
|---|---|
| `gbp_list_accounts` | List all Google Business Profile accounts accessible to the authenticated user |
| `gbp_list_locations` | List business locations for an account |
| `gbp_get_location` | Get location details such as title, hours, phone, website, and address |
| `gbp_update_location` | Patch selected location fields (writes unless `validate_only=true`) |
| `gbp_list_services` | List a location's services and categories |
| `gbp_update_services` | Replace a location's service list (writes unless `validate_only=true`) |
| `gbp_list_category_services` | List predefined services for GBP categories |
| `gbp_get_attributes` | Get a location's attributes (payments, amenities, and similar) |
| `gbp_update_attributes` | Update location attributes (writes unless `validate_only=true`) |
| `gbp_list_attribute_definitions` | List available attribute definitions for a category, region, or location |
| `gbp_list_posts` | List local posts for a location |
| `gbp_get_post` | Get a specific post by resource name |
| `gbp_create_post` | Create a standard, event, or offer post, with optional media and CTA (`dryRun` supported) |
| `gbp_update_post` | Update a post's text and/or call-to-action (`dryRun` supported) |
| `gbp_delete_post` | Delete a post |
| `gbp_list_reviews` | List reviews for a location |
| `gbp_get_review` | Get a specific review by resource name |
| `gbp_reply_review` | Reply to a review on behalf of the business |
| `gbp_delete_review_reply` | Delete a business reply to a review |
| `gbp_list_media` | List photos and videos for a location |
| `gbp_create_media` | Upload a photo from a source URL (`dryRun` defaults to true) |
| `gbp_delete_media` | Delete a media item (`dryRun` defaults to true; never implied by other tools) |
| `gbp_performance_metrics` | Read-only performance metrics (calls, directions, clicks, impressions) |
| `gbp_performance_search_keywords` | Read-only monthly search-keyword impressions |
| `gbp_get_google_updated` | Read-only Google-updated view of a location, including pending or changed fields |
Write tools that support `dryRun` or `validate_only` default to a preview unless you explicitly opt into a live change.
## Prerequisites
1. A [Google Cloud](https://console.cloud.google.com/) project.
2. Enable the Business Profile APIs your tools will call, typically:
- [My Business Account Management API](https://console.cloud.google.com/apis/library/mybusinessaccountmanagement.googleapis.com)
- [My Business Business Information API](https://console.cloud.google.com/apis/library/mybusinessbusinessinformation.googleapis.com)
- [Business Profile Performance API](https://console.cloud.google.com/apis/library/businessprofileperformance.googleapis.com) (for the read-only performance tools)
3. **Google access approval.** Some Google Business Profile APIs are restricted. You may need to request access from Google before your OAuth client can call them. If a request fails with a service-disabled or access-not-granted error, check that the API is enabled and that your Cloud project has been approved.
4. An **OAuth 2.0 Client ID** (Web or Desktop) in that same Cloud project. Add your redirect URI (default `http://localhost:3456/callback`) under Authorized redirect URIs.
5. A Google account with access to the Google Business Profile locations you want to manage.
Use your own OAuth client. Do not reuse someone else's client ID or secret.
## Setup
### 1. Clone and configure
```bash
git clone https://github.com/vivdigital/gbp-mcp.git
cd gbp-mcp
cp .env.example .env
```
Edit `.env` and set your own values:
```
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=http://localhost:3456/callback
```
`GOOGLE_REDIRECT_URI` is optional and defaults to `http://localhost:3456/callback`. If you change it, add the same URI to your OAuth client and run the auth flow again.
### 2. Run the one-time auth flow
Tokens are stored on disk (default `credentials/gbp-tokens.json`) and refreshed automatically. They are never read from source control.
**Local (Node.js 22+):**
```bash
npm install
npm run auth
```
This starts a temporary listener on the redirect URI, opens a browser for Google consent, and writes the tokens file. If the browser does not open, copy the URL printed in the terminal.
**Where tokens are stored**
- Default: `./credentials/gbp-tokens.json` (inside the container, `/app/credentials/gbp-tokens.json` when that directory is mounted).
- Override with `GBP_TOKENS_PATH` if you want a different mounted file.
### 3. Run the server
**Docker Compose** (HTTP/SSE on host port 8765):
```bash
docker compose up --build -d
```
Example Compose file (this repository's `docker-compose.yml`):
```yaml
services:
gbp-mcp:
container_name: gbp-mcp
build:
context: .
dockerfile: Dockerfile
image: gbp-mcp:local
restart: unless-stopped
env_file:
- .env
environment:
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GOOGLE_REDIRECT_URI: ${GOOGLE_REDIRECT_URI:-http://localhost:3456/callback}
volumes:
- ./credentials:/app/credentials
- .env:/app/.env:ro
ports:
- "8765:8000"
```
Point an MCP client that speaks SSE at `http://localhost:8765`. Do not expose port 8765 to the public internet without an access control layer in front of it.
**Local stdio** (for MCP clients that spawn a process):
```bash
npm install
npm run build
```
Example MCP client config:
```json
{
"mcpServers": {
"gbp": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/gbp-mcp",
"env": {
"GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "your-client-secret"
}
}
}
}
```
Prefer reading those values from your environment or a secrets manager rather than pasting them into a committed config file. The process still needs the tokens file at `credentials/gbp-tokens.json` (or `GBP_TOKENS_PATH`).
## Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
| `GOOGLE_CLIENT_ID` | Yes | — | OAuth 2.0 client ID from your Google Cloud project |
| `GOOGLE_CLIENT_SECRET` | Yes | — | OAuth 2.0 client secret |
| `GOOGLE_REDIRECT_URI` | No | `http://localhost:3456/callback` | Must match an authorized redirect URI on the OAuth client |
| `GBP_TOKENS_PATH` | No | `credentials/gbp-tokens.json` | Path to the saved OAuth tokens file |
| `PERF_RATE_PER_MIN` | No | `30` | Local rate guard for Performance API requests |
## Security notes
- Keep OAuth client secrets and tokens out of git. This repo gitignores `.env`, `credentials/`, and `*tokens*.json`.
- Commit only `.env.example` with empty secret values. Never commit a filled-in `.env` or a tokens file.
- Run `npm run auth` on a trusted machine, then mount the resulting tokens file into the container.
- Treat the MCP endpoint as a write-capable API for your business listings. Bind it to localhost or put it behind authentication; do not publish it open to the internet.
## Development
```bash
npm install
npm test
```
`npm test` compiles TypeScript and runs the media-utility unit tests.
## License
[MIT](LICENSE) © 2026 VIV Digital
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues