Skip to content

Commit 59fa010

Browse files
authored
Revise README for MCP server relocation
Updated README to reflect the relocation of the MCP server to the PostHog Monorepo and removed manual and Docker installation instructions.
1 parent 8057dcc commit 59fa010

File tree

1 file changed

+2
-173
lines changed

1 file changed

+2
-173
lines changed

README.md

Lines changed: 2 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# PostHog MCP
22

3+
The MCP server has been moved into the PostHog Monorepo - you can find it (here)[https://github.com/PostHog/posthog/tree/master/products/mcp]
4+
35
Documentation: https://posthog.com/docs/model-context-protocol
46

57
## Use the MCP Server
@@ -11,176 +13,3 @@ You can install the MCP server automatically into Cursor, Claude, Claude Code, V
1113
```
1214
npx @posthog/wizard@latest mcp add
1315
```
14-
15-
### Manual install
16-
17-
1. Obtain a personal API key using the MCP Server preset [here](https://app.posthog.com/settings/user-api-keys?preset=mcp_server).
18-
19-
2. Add the MCP configuration to your desktop client (e.g. Cursor, Windsurf, Claude Desktop) and add your personal API key
20-
21-
```json
22-
{
23-
"mcpServers": {
24-
"posthog": {
25-
"command": "npx",
26-
"args": [
27-
"-y",
28-
"mcp-remote@latest",
29-
"https://mcp.posthog.com/mcp", // You can replace this with https://mcp.posthog.com/sse if your client does not support Streamable HTTP
30-
"--header",
31-
"Authorization:${POSTHOG_AUTH_HEADER}"
32-
],
33-
"env": {
34-
"POSTHOG_AUTH_HEADER": "Bearer {INSERT_YOUR_PERSONAL_API_KEY_HERE}"
35-
}
36-
}
37-
}
38-
}
39-
```
40-
41-
### Docker install
42-
43-
If you prefer to use Docker instead of running npx directly:
44-
45-
1. Build the Docker image:
46-
```bash
47-
pnpm docker:build
48-
# or
49-
docker build -t posthog-mcp .
50-
```
51-
52-
2. Configure your MCP client with Docker:
53-
```json
54-
{
55-
"mcpServers": {
56-
"posthog": {
57-
"type": "stdio",
58-
"command": "docker",
59-
"args": [
60-
"run",
61-
"-i",
62-
"--rm",
63-
"--env",
64-
"POSTHOG_AUTH_HEADER=${POSTHOG_AUTH_HEADER}",
65-
"--env",
66-
"POSTHOG_REMOTE_MCP_URL=${POSTHOG_REMOTE_MCP_URL:-https://mcp.posthog.com/mcp}",
67-
"posthog-mcp"
68-
],
69-
"env": {
70-
"POSTHOG_AUTH_HEADER": "Bearer {INSERT_YOUR_PERSONAL_API_KEY_HERE}",
71-
"POSTHOG_REMOTE_MCP_URL": "https://mcp.posthog.com/mcp"
72-
}
73-
}
74-
}
75-
}
76-
```
77-
78-
3. Test Docker with MCP Inspector:
79-
```bash
80-
pnpm docker:inspector
81-
# or
82-
npx @modelcontextprotocol/inspector docker run -i --rm --env POSTHOG_AUTH_HEADER=${POSTHOG_AUTH_HEADER} posthog-mcp
83-
```
84-
85-
**Environment Variables:**
86-
- `POSTHOG_AUTH_HEADER`: Your PostHog API token (required)
87-
- `POSTHOG_REMOTE_MCP_URL`: The MCP server URL (optional, defaults to `https://mcp.posthog.com/mcp`)
88-
89-
This approach allows you to use the PostHog MCP server without needing Node.js or npm installed locally.
90-
91-
### Example Prompts
92-
- What feature flags do I have active?
93-
- Add a new feature flag for our homepage redesign
94-
- What are my most common errors?
95-
- Show me my LLM costs this week
96-
97-
### Feature Filtering
98-
99-
You can limit which tools are available by adding query parameters to the MCP URL:
100-
101-
```
102-
https://mcp.posthog.com/mcp?features=flags,workspace
103-
```
104-
105-
Available features:
106-
- `workspace` - Organization and project management
107-
- `error-tracking` - [Error monitoring and debugging](https://posthog.com/docs/errors)
108-
- `dashboards` - [Dashboard creation and management](https://posthog.com/docs/product-analytics/dashboards)
109-
- `insights` - [Analytics insights and SQL queries](https://posthog.com/docs/product-analytics/insights)
110-
- `experiments` - [A/B testing experiments](https://posthog.com/docs/experiments)
111-
- `flags` - [Feature flag management](https://posthog.com/docs/feature-flags)
112-
- `llm-analytics` - [LLM usage and cost tracking](https://posthog.com/docs/llm-analytics)
113-
- `docs` - PostHog documentation search
114-
115-
To view which tools are available per feature, see our [documentation](https://posthog.com/docs/model-context-protocol) or alternatively check out `schema/tool-definitions.json`,
116-
117-
### Data processing
118-
119-
The MCP server is hosted on a Cloudflare worker which can be located outside of the EU / US, for this reason the MCP server does not store any sensitive data outside of your cloud region.
120-
121-
### Using self-hosted instances
122-
123-
If you're using a self-hosted instance of PostHog, you can specify a custom base URL by adding the `POSTHOG_BASE_URL` [environment variable](https://developers.cloudflare.com/workers/configuration/environment-variables) when running the MCP server locally or on your own infrastructure, e.g. `POSTHOG_BASE_URL=https://posthog.example.com`
124-
125-
# Development
126-
127-
To run the MCP server locally, run the following command:
128-
129-
```
130-
pnpm run dev
131-
```
132-
133-
And replace `https://mcp.posthog.com/mcp` with `http://localhost:8787/mcp` in the MCP configuration.
134-
135-
## Project Structure
136-
137-
This repository is organized to support multiple language implementations:
138-
139-
- `typescript/` - TypeScript implementation of the MCP server & tools
140-
- `schema/` - Shared schema files generated from TypeScript
141-
142-
### Development Commands
143-
144-
- `pnpm run dev` - Start development server
145-
- `pnpm run schema:build:json` - Generate JSON schema for other language implementations
146-
- `pnpm run lint && pnpm run format` - Format and lint code
147-
148-
### Adding New Tools
149-
150-
See the [tools documentation](typescript/src/tools/README.md) for a guide on adding new tools to the MCP server.
151-
152-
### Environment variables
153-
154-
- Create `.dev.vars` in the root
155-
- Add Inkeep API key to enable `docs-search` tool (see `Inkeep API key - mcp`)
156-
157-
```
158-
INKEEP_API_KEY="..."
159-
```
160-
161-
162-
### Configuring the Model Context Protocol Inspector
163-
164-
During development you can directly inspect the MCP tool call results using the [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector).
165-
166-
You can run it using the following command:
167-
168-
```bash
169-
npx @modelcontextprotocol/inspector npx -y mcp-remote@latest http://localhost:8787/mcp --header "\"Authorization: Bearer {INSERT_YOUR_PERSONAL_API_KEY_HERE}\""
170-
```
171-
172-
Alternatively, you can use the following configuration in the MCP Inspector:
173-
174-
Use transport type `STDIO`.
175-
176-
**Command:**
177-
178-
```
179-
npx
180-
```
181-
182-
**Arguments:**
183-
184-
```
185-
-y mcp-remote@latest http://localhost:8787/mcp --header "Authorization: Bearer {INSERT_YOUR_PERSONAL_API_KEY_HERE}"
186-
```

0 commit comments

Comments
 (0)