@posthog/mcp 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/extensions/session.d.ts.map +1 -1
- package/dist/extensions/session.js +5 -5
- package/dist/extensions/session.mjs +5 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +3 -3
- package/src/extensions/session.ts +7 -5
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -7,3 +7,32 @@ SDK usage examples and code snippets live in the official documentation so they
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
9
|
- [MCP analytics docs](https://posthog.com/docs/mcp-analytics)
|
|
10
|
+
|
|
11
|
+
## Developing locally
|
|
12
|
+
|
|
13
|
+
To test local changes in a consumer app (e.g. a dummy MCP server), symlink **both**
|
|
14
|
+
`@posthog/mcp` and its `posthog-node` peer from this monorepo into the app — run from the
|
|
15
|
+
app's directory:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
mkdir -p node_modules/@posthog # in case the app has no other @posthog/-scoped deps yet
|
|
19
|
+
ln -s /absolute/path/to/posthog-js/packages/mcp node_modules/@posthog/mcp
|
|
20
|
+
ln -s /absolute/path/to/posthog-js/packages/node node_modules/posthog-node
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then keep a watch build running and restart the app after each change:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd /absolute/path/to/posthog-js/packages/mcp && pnpm dev # rebuilds dist/ on save
|
|
27
|
+
|
|
28
|
+
# in the app (e.g. dummy mcp), after each rebuild:
|
|
29
|
+
npm start # Node caches dist/ at startup, so restart to pick it up
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **`npm install` in the app replaces both symlinks with published copies** — re-create them if you run it.
|
|
33
|
+
|
|
34
|
+
## Run tests
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd packages/mcp && pnpm test:unit
|
|
38
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/extensions/session.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,EAEb,WAAW,EACZ,MAAM,UAAU,CAAA;AAKjB,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,6BAA6B,GAAG,MAAM,CAoCvG;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAS3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/extensions/session.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,EAEb,WAAW,EACZ,MAAM,UAAU,CAAA;AAKjB,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,6BAA6B,GAAG,MAAM,CAoCvG;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAS3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CAgCb"}
|
|
@@ -73,11 +73,11 @@ function setLastActivity(server) {
|
|
|
73
73
|
(0, external_internal_js_namespaceObject.setServerTrackingData)(server, data);
|
|
74
74
|
}
|
|
75
75
|
function getSessionInfo(server, data, sessionId) {
|
|
76
|
-
let clientInfo
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
let clientInfo;
|
|
77
|
+
clientInfo = data?.sessionInfo.clientName ? {
|
|
78
|
+
name: data.sessionInfo.clientName,
|
|
79
|
+
version: data.sessionInfo.clientVersion
|
|
80
|
+
} : server.getClientVersion();
|
|
81
81
|
const actorInfo = data?.identifiedSessions.get(sessionId ?? data.sessionId);
|
|
82
82
|
const sessionInfo = {
|
|
83
83
|
ipAddress: void 0,
|
|
@@ -41,11 +41,11 @@ function setLastActivity(server) {
|
|
|
41
41
|
setServerTrackingData(server, data);
|
|
42
42
|
}
|
|
43
43
|
function getSessionInfo(server, data, sessionId) {
|
|
44
|
-
let clientInfo
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
let clientInfo;
|
|
45
|
+
clientInfo = data?.sessionInfo.clientName ? {
|
|
46
|
+
name: data.sessionInfo.clientName,
|
|
47
|
+
version: data.sessionInfo.clientVersion
|
|
48
|
+
} : server.getClientVersion();
|
|
49
49
|
const actorInfo = data?.identifiedSessions.get(sessionId ?? data.sessionId);
|
|
50
50
|
const sessionInfo = {
|
|
51
51
|
ipAddress: void 0,
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.5.
|
|
1
|
+
export declare const version = "0.5.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
version: ()=>version
|
|
28
28
|
});
|
|
29
|
-
const version = '0.5.
|
|
29
|
+
const version = '0.5.1';
|
|
30
30
|
exports.version = __webpack_exports__.version;
|
|
31
31
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
32
32
|
"version"
|
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '0.5.
|
|
1
|
+
const version = '0.5.1';
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"module": "dist/index.mjs",
|
|
29
29
|
"types": "dist/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@posthog/core": "^1.38.
|
|
31
|
+
"@posthog/core": "^1.38.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/preset-env": "^7.27.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/node": "^20.0.0",
|
|
40
40
|
"jest": "29.7.0",
|
|
41
41
|
"zod": "^3.25.0",
|
|
42
|
-
"posthog-node": "^5.38.
|
|
42
|
+
"posthog-node": "^5.38.8",
|
|
43
43
|
"@posthog-tooling/tsconfig-base": "1.1.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -89,11 +89,13 @@ export function getSessionInfo(
|
|
|
89
89
|
data: MCPAnalyticsData | undefined,
|
|
90
90
|
sessionId?: string
|
|
91
91
|
): SessionInfo {
|
|
92
|
-
let clientInfo: ServerClientInfoLike | undefined
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
let clientInfo: ServerClientInfoLike | undefined
|
|
93
|
+
if (data?.sessionInfo.clientName) {
|
|
94
|
+
clientInfo = {
|
|
95
|
+
name: data.sessionInfo.clientName,
|
|
96
|
+
version: data.sessionInfo.clientVersion,
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
97
99
|
clientInfo = server.getClientVersion()
|
|
98
100
|
}
|
|
99
101
|
const actorInfo = data?.identifiedSessions.get(sessionId ?? data.sessionId)
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.5.
|
|
1
|
+
export const version = '0.5.1'
|