@getguru/fullstory-mcp 0.0.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 ADDED
@@ -0,0 +1,15 @@
1
+ # @getguru/fullstory-mcp
2
+
3
+ FullStory MCP server for session replays, users, segments, and events.
4
+
5
+ ## Install
6
+
7
+ Use the MCP with npx (no global install):
8
+
9
+ ```bash
10
+ npx @getguru/fullstory-mcp
11
+ ```
12
+
13
+ Configure your MCP client (e.g. Cursor) to run: **command** `npx`, **args** `@getguru/fullstory-mcp`.
14
+
15
+ Set `FULLSTORY_API_KEY` in the client’s env (or in your shell). Use an Admin or Architect key from FullStory Settings > API Keys; format is `{datacenter}.{token}` (e.g. `na1.xxxx`).
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ const FULLSTORY_API_BASE = "https://api.fullstory.com";
6
+ /** API key from process env; set via MCP client config (e.g. Cursor MCP env) or .env. */
7
+ function getApiKey() {
8
+ const key = process.env.FULLSTORY_API_KEY;
9
+ return key?.trim();
10
+ }
11
+ async function fullstoryFetch(path, init) {
12
+ const apiKey = getApiKey();
13
+ if (!apiKey) {
14
+ throw new Error("FULLSTORY_API_KEY is not set. Set it in the environment or .env (Admin or Architect key from FullStory Settings > API Keys).");
15
+ }
16
+ const url = path.startsWith("http") ? path : `${FULLSTORY_API_BASE}${path}`;
17
+ return fetch(url, {
18
+ ...init,
19
+ headers: {
20
+ Authorization: `Basic ${Buffer.from(apiKey + ":").toString("base64")}`,
21
+ "Content-Type": "application/json",
22
+ Accept: "application/json",
23
+ ...init?.headers,
24
+ },
25
+ });
26
+ }
27
+ const server = new Server({
28
+ name: "fullstory-mcp",
29
+ version: "0.0.1",
30
+ }, {
31
+ capabilities: {
32
+ tools: {},
33
+ },
34
+ });
35
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
36
+ return {
37
+ tools: [
38
+ {
39
+ name: "fullstory_sessions_for_user",
40
+ description: "List FullStory session replay URLs for a user by email or UID. Returns session IDs and FsUrl links for replay.",
41
+ inputSchema: {
42
+ type: "object",
43
+ properties: {
44
+ email: {
45
+ type: "string",
46
+ description: "User's email address (use either email or uid, not both)",
47
+ },
48
+ uid: {
49
+ type: "string",
50
+ description: "User's application UID (use either email or uid, not both)",
51
+ },
52
+ limit: {
53
+ type: "number",
54
+ description: "Max sessions to return (default 20)",
55
+ default: 20,
56
+ },
57
+ },
58
+ },
59
+ },
60
+ {
61
+ name: "fullstory_session_events",
62
+ description: "Get raw event data for a FullStory session by session ID. Useful for programmatic analysis of what happened.",
63
+ inputSchema: {
64
+ type: "object",
65
+ properties: {
66
+ session_id: {
67
+ type: "string",
68
+ description: "FullStory session ID (numeric or from a session URL)",
69
+ },
70
+ },
71
+ required: ["session_id"],
72
+ },
73
+ },
74
+ ],
75
+ };
76
+ });
77
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
78
+ const { name, arguments: args } = request.params;
79
+ const raw = args ?? {};
80
+ if (name === "fullstory_sessions_for_user") {
81
+ const email = raw.email;
82
+ const uid = raw.uid;
83
+ const limit = raw.limit ?? 20;
84
+ if (!email && !uid) {
85
+ return {
86
+ content: [
87
+ {
88
+ type: "text",
89
+ text: "Error: provide either 'email' or 'uid'.",
90
+ },
91
+ ],
92
+ isError: true,
93
+ };
94
+ }
95
+ const params = new URLSearchParams();
96
+ if (email)
97
+ params.set("email", email);
98
+ if (uid)
99
+ params.set("uid", uid);
100
+ params.set("limit", String(limit));
101
+ const res = await fullstoryFetch(`/sessions/v2?${params.toString()}`);
102
+ const text = await res.text();
103
+ if (!res.ok) {
104
+ return {
105
+ content: [{ type: "text", text: `FullStory API error (${res.status}): ${text}` }],
106
+ isError: true,
107
+ };
108
+ }
109
+ const data = JSON.parse(text);
110
+ const table = "| # | Session URL | Created | User ID |\n|---|-------------|---------|--------|\n" +
111
+ data
112
+ .slice(0, 20)
113
+ .map((s, i) => `| ${i + 1} | ${s.FsUrl ?? "-"} | ${s.CreatedTime ?? "-"} | ${s.UserId ?? "-"} |`)
114
+ .join("\n");
115
+ return {
116
+ content: [{ type: "text", text: table || "No sessions found." }],
117
+ };
118
+ }
119
+ if (name === "fullstory_session_events") {
120
+ const sessionId = raw.session_id;
121
+ if (!sessionId) {
122
+ return {
123
+ content: [{ type: "text", text: "Error: 'session_id' is required." }],
124
+ isError: true,
125
+ };
126
+ }
127
+ const res = await fullstoryFetch(`/v2/sessions/${encodeURIComponent(sessionId)}/events`);
128
+ const text = await res.text();
129
+ if (!res.ok) {
130
+ return {
131
+ content: [{ type: "text", text: `FullStory API error (${res.status}): ${text}` }],
132
+ isError: true,
133
+ };
134
+ }
135
+ return {
136
+ content: [{ type: "text", text: text || "[]" }],
137
+ };
138
+ }
139
+ return {
140
+ content: [{ type: "text", text: `Unknown tool: ${name}` }],
141
+ isError: true,
142
+ };
143
+ });
144
+ async function main() {
145
+ const transport = new StdioServerTransport();
146
+ await server.connect(transport);
147
+ }
148
+ main().catch((err) => {
149
+ console.error(err);
150
+ process.exit(1);
151
+ });
152
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;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ory-mcp",
3
+ "version": "0.0.1",
4
+ "description": "FullStory MCP server for session replays, users, segments, and events",
5
+ "type": "module",
6
+ "bin": { "fullstory-mcp": "./dist/index.js" },
7
+ "publishConfig": { "access": "public" },
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "clean": "rm -rf dist"
11
+ },
12
+ "dependencies": {
13
+ "@modelcontextprotocol/sdk": "^1.26.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^22.0.0",
17
+ "typescript": "^5.5.0",
18
+ "zod": "^3.23.0"
19
+ },
20
+ "peerDependencies": {
21
+ "zod": "^3.25 || ^4.0"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "engines": {
27
+ "node": ">=18"
28
+ }
29
+ }