@alpic-ai/insights 0.0.0-dev.g814ca49 → 0.0.0-dev.g81c9013
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/dist/index.mjs +29 -6
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,17 @@ import { CallToolRequestSchema, CallToolResultSchema, ListToolsResultSchema } fr
|
|
|
3
3
|
const FEEDBACK_TOOL_NAME = "send_feedback";
|
|
4
4
|
const FEEDBACK_TOOL_DESCRIPTION = "Send feedback about this MCP server to its operators. Use this tool ONLY for feedback about this MCP server itself, never about other tools, services, or the host. You MAY call this tool when you detect a genuine issue with this server (e.g. a tool that failed unexpectedly, an unhelpful response, a missing capability). You MAY also call it when the user explicitly asks to send feedback. Before sending, strip all personally identifiable information (PII) from the content, including names, email addresses, phone numbers, physical addresses, dates of birth, ID numbers, payment information, and any other information that could identify a specific individual. Replace stripped values with generic placeholders (e.g. \"[name]\", \"[email]\").";
|
|
5
5
|
const FEEDBACK_RESPONSE_TEXT = "Feedback received. Thanks!";
|
|
6
|
+
const FEEDBACK_OUTPUT_SCHEMA = {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: { status: {
|
|
9
|
+
type: "string",
|
|
10
|
+
enum: ["received"],
|
|
11
|
+
description: "Confirmation that the feedback was received by the server operators."
|
|
12
|
+
} },
|
|
13
|
+
required: ["status"],
|
|
14
|
+
additionalProperties: false
|
|
15
|
+
};
|
|
16
|
+
const FEEDBACK_STRUCTURED_CONTENT = { status: "received" };
|
|
6
17
|
/**
|
|
7
18
|
* Lets MCP server builders collect qualitative feedback from end users about their
|
|
8
19
|
* tool/server. Injects a `send_feedback` tool at `tools/list` time and intercepts calls
|
|
@@ -35,6 +46,13 @@ function feedbackMiddleware(options) {
|
|
|
35
46
|
}
|
|
36
47
|
},
|
|
37
48
|
required: ["content", "source"]
|
|
49
|
+
},
|
|
50
|
+
outputSchema: FEEDBACK_OUTPUT_SCHEMA,
|
|
51
|
+
annotations: {
|
|
52
|
+
readOnlyHint: false,
|
|
53
|
+
destructiveHint: false,
|
|
54
|
+
openWorldHint: false,
|
|
55
|
+
idempotentHint: true
|
|
38
56
|
}
|
|
39
57
|
});
|
|
40
58
|
return parsed.data;
|
|
@@ -56,6 +74,7 @@ function feedbackMiddleware(options) {
|
|
|
56
74
|
content,
|
|
57
75
|
source
|
|
58
76
|
};
|
|
77
|
+
if (process.env.NODE_ENV !== "production") console.log("[insights] feedback received:", feedback);
|
|
59
78
|
if (options?.handler) try {
|
|
60
79
|
await options.handler(feedback);
|
|
61
80
|
} catch (error) {
|
|
@@ -66,12 +85,16 @@ function feedbackMiddleware(options) {
|
|
|
66
85
|
type: "text",
|
|
67
86
|
text: FEEDBACK_RESPONSE_TEXT
|
|
68
87
|
}],
|
|
88
|
+
structuredContent: FEEDBACK_STRUCTURED_CONTENT,
|
|
69
89
|
_meta: { [metaKeyName]: feedback }
|
|
70
90
|
};
|
|
71
|
-
return {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
return {
|
|
92
|
+
content: [{
|
|
93
|
+
type: "text",
|
|
94
|
+
text: FEEDBACK_RESPONSE_TEXT
|
|
95
|
+
}],
|
|
96
|
+
structuredContent: FEEDBACK_STRUCTURED_CONTENT
|
|
97
|
+
};
|
|
75
98
|
};
|
|
76
99
|
}
|
|
77
100
|
//#endregion
|
|
@@ -98,7 +121,7 @@ const captureFeedback = (server, options) => {
|
|
|
98
121
|
if (marked[INSTALLED_MARKER$1]) return;
|
|
99
122
|
marked[INSTALLED_MARKER$1] = true;
|
|
100
123
|
const middleware = feedbackMiddleware(options);
|
|
101
|
-
const targets = new Set(["tools/list", "tools/call"]);
|
|
124
|
+
const targets = /* @__PURE__ */ new Set(["tools/list", "tools/call"]);
|
|
102
125
|
const wrap = (method, handler) => {
|
|
103
126
|
if (!targets.has(method)) return handler;
|
|
104
127
|
return async (...args) => {
|
|
@@ -243,7 +266,7 @@ const captureIntents = (server, options) => {
|
|
|
243
266
|
if (marked[INSTALLED_MARKER]) return;
|
|
244
267
|
marked[INSTALLED_MARKER] = true;
|
|
245
268
|
const middleware = intentMiddleware(options);
|
|
246
|
-
const targets = new Set(["tools/list", "tools/call"]);
|
|
269
|
+
const targets = /* @__PURE__ */ new Set(["tools/list", "tools/call"]);
|
|
247
270
|
const wrap = (method, handler) => {
|
|
248
271
|
if (!targets.has(method)) return handler;
|
|
249
272
|
return async (...args) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpic-ai/insights",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.g81c9013",
|
|
4
4
|
"description": "User insights middlewares for Alpic-hosted MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@modelcontextprotocol/sdk": ">=1.29.0 <2",
|
|
21
|
-
"skybridge": "
|
|
21
|
+
"skybridge": "^0.36.3 || ^1.0.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"skybridge": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
30
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
31
|
-
"@types/node": "^25.
|
|
31
|
+
"@types/node": "^25.9.4",
|
|
32
32
|
"shx": "^0.4.0",
|
|
33
|
-
"skybridge": "^
|
|
34
|
-
"tsdown": "^0.22.
|
|
33
|
+
"skybridge": "^1.1.1",
|
|
34
|
+
"tsdown": "^0.22.3",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
|
-
"vitest": "^4.1.
|
|
36
|
+
"vitest": "^4.1.9",
|
|
37
37
|
"zod": "^4.4.3"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|