GrowthBook MCP Thin
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A thin MCP server for GrowthBook with four tools:
| Tool | Purpose |
|------|---------|
| growthbook_list_skills | List top-level skill entry points (name + description) |
| growthbook_read_skill | Return a listed skill or qualified child workflow (feature-flags or feature-flags/references/flag-create) |
| growthbook_api_read | Authenticated GET passthrough to the GrowthBook API |
| growthbook_api_write | Authenticated POST/PUT/PATCH/DELETE passthrough |
Competence lives in the skills repo and is **bundled at build time**. Capability is split into read vs write API tools (no per-endpoint formatters) so clients can honor readOnlyHint / destructiveHint correctly.
Tools are prefixed with growthbook_ so they stay unambiguous when a client has multiple MCP servers loaded.
Cursor plugin
Install **GrowthBook** from the Cursor Marketplace. The plugin connects Cursor to the hosted server at https://mcp.growthbook.io/mcp; the first tool call opens a GrowthBook sign-in to authorize it. Self-hosted GrowthBook users should configure the server manually as described below.
The plugin is defined by .cursor-plugin/plugin.json and mcp.json. To test changes locally, copy the repo into ~/.cursor/plugins/local/growthbook and run **Developer: Reload Window**.
Install / run
Point your MCP client at the compiled entrypoint:
Or run the published package:
Environment variables
| Variable | Required | Default | Purpose |
|----------|----------|---------|---------|
| GB_API_KEY | Yes for stdio; optional for HTTP OAuth | — | GrowthBook API key or personal access token |
| GB_API_URL | No | https://api.growthbook.io | API base URL (self-hosted) and default OAuth AS issuer |
| GB_MCP_TRANSPORT | No | stdio | stdio or http |
| GB_MCP_PORT | No | 3333 | HTTP listen port (when transport=http) |
| GB_MCP_HOST | No | 127.0.0.1 | HTTP bind host |
| GB_MCP_URL | Yes for HTTP | — | Public MCP base URL stamped into OAuth resource metadata (server refuses to start in HTTP mode without it) |
| GB_MCP_KEEP_ALIVE_TIMEOUT_MS | No | 90000 | Idle keep-alive timeout in HTTP mode. Must exceed the idle timeout of any load balancer in front, or the LB can reuse a connection the server has already closed and the request fails with a 502 |
| OPENAI_APPS_CHALLENGE_TOKEN | No | — | Served as plain text at /.well-known/openai-apps-challenge for OpenAI plugin domain verification (HTTP mode); the route returns 404 when unset |
| GB_OAUTH_ISSUER | No | GB_API_URL | GrowthBook OAuth AS issuer URL |
| GB_HTTP_HEADER_* | No | — | Extra request headers (e.g. GB_HTTP_HEADER_CF_ACCESS_TOKEN) |
| GB_SKILLS_ENABLED | No | true | Set to false / 0 to disable skill tools |
HTTP + OAuth mode
Clients connect to:
- http://127.0.0.1:3333/mcp — full (skills + API read/write)
- http://127.0.0.1:3333/mcp/api — capability-only (growthbook_api_read + growthbook_api_write)
Unauthenticated requests receive 401 with WWW-Authenticate pointing at /.well-known/oauth-protected-resource, which advertises the GrowthBook Authorization Server.
Before handling MCP, the server probes GrowthBook REST (GET /api/v1/) with the bearer. A 401 from that probe (or later from an API tool) yields HTTP 401 with error="invalid_token" so the MCP client can refresh — instead of surfacing "This API key has expired" as a tool error. A 403 is treated as an accepted bearer (permission denied ≠ invalid token) so clients are not forced into a refresh loop.
Capability-only mode
**HTTP (recommended for remote):** point the client at /mcp/api instead of /mcp:
| Path | Tools |
|------|--------|
| /mcp | growthbook_list_skills, growthbook_read_skill, growthbook_api_read, growthbook_api_write (unless GB_SKILLS_ENABLED=false) |