mcp-feedback 0.5.0 → 0.7.0

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.
Files changed (42) hide show
  1. package/README.md +139 -2
  2. package/agentdist.json +40 -0
  3. package/dist/cli.d.ts +5 -0
  4. package/dist/cli.js +26 -3
  5. package/dist/conformance-cases.js +15 -4
  6. package/dist/drizzle.js +1 -0
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +2 -2
  9. package/dist/ingest/cli.d.ts +8 -0
  10. package/dist/ingest/cli.js +270 -0
  11. package/dist/ingest/github.d.ts +40 -0
  12. package/dist/ingest/github.js +80 -0
  13. package/dist/ingest/handler.d.ts +84 -0
  14. package/dist/ingest/handler.js +447 -0
  15. package/dist/ingest/index.d.ts +3 -0
  16. package/dist/ingest/index.js +5 -0
  17. package/dist/ingest/protocol.d.ts +203 -0
  18. package/dist/ingest/protocol.js +78 -0
  19. package/dist/ingest/tokens.d.ts +84 -0
  20. package/dist/ingest/tokens.js +163 -0
  21. package/dist/install.d.ts +3 -0
  22. package/dist/install.js +27 -0
  23. package/dist/reader.js +6 -1
  24. package/dist/register.d.ts +36 -4
  25. package/dist/register.js +45 -21
  26. package/dist/remote.d.ts +66 -0
  27. package/dist/remote.js +399 -0
  28. package/dist/store.d.ts +17 -0
  29. package/dist/store.js +5 -0
  30. package/dist/stores/memory.js +3 -1
  31. package/dist/stores/sql.js +5 -0
  32. package/dist/tools.d.ts +8 -1
  33. package/dist/tools.js +28 -7
  34. package/dist/types.d.ts +4 -0
  35. package/package.json +15 -2
  36. package/skills/add-feedback-to-mcp-server/SKILL.md +179 -0
  37. package/skills/add-feedback-to-mcp-server/references/feedback-section.md +57 -0
  38. package/skills/add-feedback-to-mcp-server/references/remote-ingest.md +84 -0
  39. package/skills/read-feedback/SKILL.md +99 -0
  40. package/skills/read-feedback/references/connecting.md +84 -0
  41. package/skills/set-up-feedback-reading/SKILL.md +60 -0
  42. package/skills/set-up-feedback-reading/references/project-reference.md +48 -0
package/README.md CHANGED
@@ -6,7 +6,15 @@ Drop-in feedback for MCP servers. Add one call to a server built on the official
6
6
  npm install mcp-feedback
7
7
  ```
8
8
 
9
- The language-neutral spec (record schema, tool definitions, store contract, SQL layout) and agent skills live in the [repository](https://github.com/krishchow/feedback).
9
+ The language-neutral spec (record schema, tool definitions, store contract, SQL layout) lives in the [repository](https://github.com/krishchow/feedback).
10
+
11
+ The package also carries agent skills for adding feedback to a server, recording a project's own facts about where its feedback is read, and reading and closing it out. Install them into a repository's agent harnesses (Claude Code, Codex, Cursor and others) with:
12
+
13
+ ```sh
14
+ npx -y mcp-feedback@latest install --local # or --user, for every project
15
+ ```
16
+
17
+ Run it again after upgrading. It only replaces or removes files it wrote, and backs up any you edited first; `uninstall` takes them back out and `status` shows where they are.
10
18
 
11
19
  ## Use
12
20
 
@@ -25,6 +33,112 @@ registerFeedbackReader(adminServer, { store });
25
33
 
26
34
  The reader tools list, fetch and count feedback, and `update_feedback_triage` closes out, dismisses or reopens one or many records with a note. Pass `readOnly: true` to leave that tool out. If you would rather not expose reader tools at all, use the CLI.
27
35
 
36
+ The reader tools show every caller's feedback, so they go on their own endpoint with their own credential, never on the one agents use. The library does no authentication itself; your middleware does, and by setting `req.auth` it also tells the library who is calling:
37
+
38
+ ```ts
39
+ const bearer = (token: string, clientId: string) => (req, res, next) => {
40
+ if (!token || req.get("authorization") !== `Bearer ${token}`) return res.status(401).end();
41
+ req.auth = { token, clientId, scopes: [] }; // the SDK hands this to tools as authInfo
42
+ next();
43
+ };
44
+
45
+ app.post("/mcp", bearer(process.env.AGENT_TOKEN, "myapp-agent"), handleAgentMcp); // registerFeedback
46
+ app.post("/mcp/feedback", bearer(process.env.MAINTAINER_TOKEN, "myapp-maintainer"), handleReader); // registerFeedbackReader
47
+ ```
48
+
49
+ The agent endpoint's `clientId` ends up in each record's `identity`, and the reader endpoint's in `triaged_by`. The repository has a [runnable example](https://github.com/krishchow/feedback/tree/main/examples/express-server).
50
+
51
+ ## Servers that run on their users' machines
52
+
53
+ A stdio server started with `npx`, or any server that runs on each user's machine, has no store its maintainer can read: a SQLite file there is never seen. Send its feedback to a hub you run instead. The hub writes into an ordinary store, which the reader tools and CLI read as above.
54
+
55
+ **1. Keys and a project key**, once, on your machine:
56
+
57
+ ```sh
58
+ mcp-feedback ingest keygen --out ingest-key.json # keep this file private
59
+ mcp-feedback ingest issue-key --project my-server --key ingest-key.json --issuer https://feedback.example.com
60
+ ```
61
+
62
+ The project key is public by design: it ships in your package and can only enrol an installation.
63
+
64
+ **2. The server**, using the project key:
65
+
66
+ ```ts
67
+ import { registerFeedback, feedbackConfirmInstructions } from "mcp-feedback";
68
+ import { feedbackDisabled, remoteStore } from "mcp-feedback/remote";
69
+
70
+ if (!feedbackDisabled()) {
71
+ const store = remoteStore({ endpoint: "https://feedback.example.com", projectKey: "eyJhbGciOiJFZERTQSIs…" });
72
+ registerFeedback(server, { store, requireConfirmation: true, destination: "the my-server maintainers" });
73
+ void store.start(); // renews this machine's token, sends reports that could not go last time
74
+ }
75
+ ```
76
+
77
+ On first use the installation enrols and gets its own token, kept in a per-user state directory. `start()` renews that token whenever the server starts and the token is more than a day old, so a machine in use keeps the same identity indefinitely; it contacts the hub only on a machine that has used feedback before. When the hub cannot be reached, the report is saved there and sent later, and the tool tells the agent where it is waiting; deleting the file cancels it. A report the hub refuses is not kept. `destination` adds a sentence to the tool's description saying where reports go, so the user knows before confirming. Users can turn feedback off with `MCP_FEEDBACK_DISABLED=1`.
78
+
79
+ **Reports as a GitHub user instead of an anonymous installation.** For your own and your team's tools, pass `signIn: "github"` (the hub needs GitHub sign-in turned on; see `hub/README.md`). The first report asks the user, through the agent, to open github.com/login/device and enter a code; the report waits on disk and goes out as soon as they approve. The sign-in is kept in the per-user state directory, shared by every server on the machine that reports to the same hub, and renewed by `start()`, so each machine signs in once. Reports then carry `identity.subject` = `github:<login>`. GitHub's own credential stays on the hub, which asks for no access beyond who the user is and discards it after reading their login.
80
+
81
+ **3. The hub.** One hub serves every server you distribute. Each server's reports are kept under its project name (`server.name`) in one store, and the hub accepts any project your key issued a project key for, so a new server needs a project key and nothing else. `hub/` in the repository has a Dockerfile and deployment notes; or run it directly:
82
+
83
+ ```sh
84
+ MCP_FEEDBACK_READER_TOKEN=… mcp-feedback ingest serve --postgres "$DATABASE_URL" --key ingest-key.json \
85
+ --issuer https://feedback.example.com --port 8787 [--project a --project b] [--trust-proxy] [--revoked revoked.txt]
86
+ ```
87
+
88
+ `--project`, repeated, accepts only the projects listed. With `MCP_FEEDBACK_READER_TOKEN` set, the hub also serves the reader tools for every project at `/mcp`, so one URL and one credential reach all of it:
89
+
90
+ ```sh
91
+ MCP_FEEDBACK_URL=https://feedback.example.com/mcp MCP_FEEDBACK_TOKEN=… mcp-feedback stats # by_server shows each project
92
+ MCP_FEEDBACK_URL=https://feedback.example.com/mcp MCP_FEEDBACK_TOKEN=… mcp-feedback list --server my-server
93
+ ```
94
+
95
+ **No separate host? Mount the hub in a server you already host.** The hub is a request handler, so an HTTP MCP server you already run (or any web app) can be the hub, and its existing store and reader endpoint then hold your stdio servers' feedback too. For an Express app:
96
+
97
+ ```ts
98
+ import { createIngestHandler, toNodeListener } from "mcp-feedback/ingest";
99
+
100
+ const key = JSON.parse(process.env.MCP_FEEDBACK_INGEST_KEY!); // the file `mcp-feedback ingest keygen` wrote
101
+ const ingest = createIngestHandler({
102
+ issuer: "https://app.example.com/api/ingest", // any stable string; tokens name it
103
+ basePath: "/api/ingest", // routes: /api/ingest/v1/enroll, /api/ingest/v1/feedback
104
+ keyring: { keys: [{ kid: key.kid, publicKey: key.publicKey }], signer: { kid: key.kid, privateKey: key.privateKey } },
105
+ store: feedbackStore, // the server's own store: one queue, read through its reader endpoint
106
+ tokenFingerprintKey: process.env.FEEDBACK_FINGERPRINT_KEY,
107
+ });
108
+
109
+ app.use("/api/ingest", toNodeListener(ingest)); // 1. first (with Express, req.ip gives the client address)
110
+ app.use("/api", requireBearer); // 2. the app's own auth, which ingest must not go through
111
+ app.use(express.json()); // 3. body parsing, which would consume the hub's request body
112
+ ```
113
+
114
+ - **Order matters.** Register the hub before the app's authentication middleware, which would refuse installations (they bring their own signed tokens), and before any body parser. Or exempt its path from both.
115
+ - **Pick a path the deployment routes to the app.** If only `/api` reaches the server, mount under `/api/…`, with the same prefix as `basePath`.
116
+ - Installations use the mount point as their endpoint: `remoteStore({ endpoint: "https://app.example.com/api/ingest", … })`. Issue project keys with `--issuer` set to the same `issuer` string.
117
+ - Records the server's own `submit_feedback` writes keep their authenticated caller; records from installations carry an `ingest:*` scope and their project as `server.name`, so readers can tell them apart and use `--server`.
118
+ - Moving to a dedicated hub later means redeploying with the same key and issuer and changing the endpoint in the next release of each server. Installations on old releases keep sending to the old one, so keep it mounted until they have upgraded.
119
+
120
+ Elsewhere (Workers, Deno, Bun), the handler itself is a web-standard `(Request) => Promise<Response>`; use the `projects` option to accept only listed projects or give one a store of its own.
121
+
122
+ Read it like any other store: a reader endpoint over the same store (`registerFeedbackReader`), or `mcp-feedback list --postgres … --server my-server`.
123
+
124
+ **What a signature does and does not prove.** The hub's key signs every token, and the hub only accepts its own signatures, so forged and expired tokens are refused before anything is read. Each record says which kind of token sent it, in `identity.scopes`:
125
+
126
+ | Scope | Sent with | Means |
127
+ | --- | --- | --- |
128
+ | `ingest:install` | The token an installation got by enrolling | Anonymous. Records with the same `identity.subject` come from one installation. Anyone with the package can enrol. |
129
+ | `ingest:issued` | A token naming a person: `github:<login>` after GitHub sign-in, or one you issued with `mcp-feedback ingest issue-token --project my-server --subject alice@example.com` and passed to `remoteStore` as `token` | From that person. |
130
+
131
+ The content of every report is untrusted, whichever token sent it. The hub stamps identity, project, time and status itself and ignores those fields in the request; it limits reports per installation, per issued subject and per project each day; and revoking a `jti` or a subject refuses that token from then on. The protocol is in `spec/ingest.md`.
132
+
133
+ ## The feedback loop
134
+
135
+ 1. **Collect.** Agents call `submit_feedback` when a tool fails them. Each record starts as `new`.
136
+ 2. **Read.** A maintainer, or their agent, reads the queue through the reader tools or the CLI and groups it into problems worth fixing.
137
+ 3. **Work.** Items taken on are marked `triaged` with a note saying what will be done. Triaged means acknowledged and still open.
138
+ 4. **Close.** Once the fix is released and checked, the items are marked `resolved` with the version or PR in the note. What will not be done is `dismissed` with the reason. Either can be reopened.
139
+
140
+ Nothing is ever deleted, and a record's content and submitter cannot be changed. The repository's `read-feedback` skill takes an agent through steps 2 to 4.
141
+
28
142
  ## CLI
29
143
 
30
144
  The CLI reads either through a server's reader endpoint (the reader tools, mounted behind a maintainer credential) or straight from the store.
@@ -47,6 +161,8 @@ mcp-feedback close <id> --dismiss --note "Working as intended"
47
161
  mcp-feedback reopen <id>
48
162
  ```
49
163
 
164
+ `list` prints one page, newest first (`--limit`, 25 by default and 100 at most; `--cursor` takes the `next_cursor` from the page before). `export` prints every matching record, so use it to read a whole queue. `close`, `reopen` and `triage --status <s>` take up to 100 ids. `--note` replaces the record's note, leaving it out keeps the note, and `--clear-note` removes it. With a store, `--table` names a table other than `mcp_feedback`.
165
+
50
166
  `mcp-feedback serve` runs the reader tools as a **stdio MCP server**, in front of any of those sources, so an agent session can read and triage feedback without connecting to a remote HTTP endpoint itself. Messages go to stderr; stdout carries the protocol. Add `--read-only` to leave out triage. For Claude Code:
51
167
 
52
168
  ```sh
@@ -110,6 +226,27 @@ If `attachContext` throws, the feedback is still stored without it and the error
110
226
  | `tokenFingerprintKey` | Secret that makes token fingerprints an HMAC. Recommended; keep it stable and the same on every instance. |
111
227
  | `onError` | Receives storage errors, which are hidden from the agent. |
112
228
 
229
+ `registerFeedbackReader` takes:
230
+
231
+ | Option | Purpose |
232
+ | --- | --- |
233
+ | `store` | The store to read and triage. Give this or `reader`. |
234
+ | `reader` | A `FeedbackReaderClient`, such as the one `connectFeedbackReader` returns, to serve another server's reader endpoint again. |
235
+ | `readOnly` | Leave out `update_feedback_triage`. |
236
+ | `resolveIdentity` | Override who triage is recorded as. |
237
+ | `toolPrefix` | Prefix for tool and prompt names. |
238
+ | `tokenFingerprintKey` | The same key as on the submit side, for a reader whose credential has no client id or subject. |
239
+ | `onError` | Receives storage errors, which are hidden from the agent. |
240
+
241
+ ## Statuses
242
+
243
+ | Status | Meaning |
244
+ | --- | --- |
245
+ | `new` | Filed and not yet looked at. Also what reopening sets. |
246
+ | `triaged` | Acknowledged, perhaps being worked on. Still open. |
247
+ | `resolved` | Fixed or delivered. The note says where. |
248
+ | `dismissed` | Will not be acted on. The note says why. |
249
+
113
250
  ## Stores
114
251
 
115
252
  | Store | Import | Notes |
@@ -129,4 +266,4 @@ const store = defineFeedbackStore({ insert, get, list, updateTriage, stats });
129
266
  await runStoreConformance(store); // rejects on the first failing case
130
267
  ```
131
268
 
132
- The package does not rate-limit submissions; rely on your server's existing limits.
269
+ The package does not rate-limit submissions; rely on your server's existing limits. The ingest hub is the exception: it has daily quotas of its own.
package/agentdist.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://unpkg.com/agentdist@0.1.0/schema/agentdist.schema.json",
3
+ "engine": "v1",
4
+ "name": "mcp-feedback",
5
+ "version": "0.7.0",
6
+ "description": "Agent feedback for MCP servers: skills for adding the mcp-feedback library to a server and updating the server's own skills to use it, for recording a project's own facts about where its feedback is read, and for reading, working through and closing out what was collected, over the mcp-feedback CLI or MCP reader tools.",
7
+ "skills": "./skills",
8
+ "namespace": "none",
9
+ "listing": {
10
+ "displayName": "mcp-feedback",
11
+ "shortDescription": "Collect and act on agent feedback for MCP servers",
12
+ "longDescription": "Adds a feedback loop to MCP servers. Agents using a server file structured feedback about failures, friction and missing capabilities; each report is tied to the authenticated caller and stored in SQLite, Postgres or a store you write. One skill covers integrating the library into a server and updating the server's own skills so agents file good feedback; one records a project's own facts about where its feedback is read; one covers reading, clustering, working through and closing out what was collected.",
13
+ "category": "Developer Tools",
14
+ "keywords": ["mcp", "feedback", "agents", "skills"],
15
+ "defaultPrompts": [
16
+ "Add agent feedback to this MCP server",
17
+ "Set this project up for reading its feedback",
18
+ "Summarize the feedback agents filed this week",
19
+ "Close out the feedback we fixed in the last release"
20
+ ],
21
+ "author": { "name": "krishchow" },
22
+ "homepage": "https://github.com/krishchow/feedback",
23
+ "repository": "https://github.com/krishchow/feedback",
24
+ "license": "MIT"
25
+ },
26
+ "pack": {
27
+ "claude-plugin": {
28
+ "marketplace": {
29
+ "description": "Skills for adding agent feedback to an MCP server and for reading and closing out what agents report."
30
+ }
31
+ },
32
+ "codex-plugin": {
33
+ "capabilities": ["Read", "Write"],
34
+ "marketplace": {
35
+ "pluginDisplayName": "mcp-feedback — agent feedback for MCP servers",
36
+ "policy": { "installation": "AVAILABLE" }
37
+ }
38
+ }
39
+ }
40
+ }
package/dist/cli.d.ts CHANGED
@@ -8,6 +8,11 @@ export interface CliIo {
8
8
  stdin?: Readable;
9
9
  stdout?: Writable;
10
10
  env: Record<string, string | undefined>;
11
+ /** Test seam for install and its siblings: the home and repository they write to. */
12
+ installDirs?: {
13
+ home: string;
14
+ projectRoot: string;
15
+ };
11
16
  /** Test seam: supply the store instead of opening one from flags. */
12
17
  openStore?: () => Promise<FeedbackStore>;
13
18
  }
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // Reader CLI: the same operations as the MCP reader tools, either straight
3
- // against the store or through a server's reader endpoint (--mcp).
3
+ // against the store or through a server's reader endpoint (--mcp). Also `install`
4
+ // and its siblings, which put the agent skills into a project's or the user's harnesses.
4
5
  import { realpathSync } from "node:fs";
5
6
  import { createRequire } from "node:module";
6
7
  import { userInfo } from "node:os";
@@ -22,6 +23,12 @@ Commands:
22
23
  reopen <id...> Set status back to new
23
24
  serve Serve the reader tools as a stdio MCP server, for agent sessions
24
25
  (stdout carries the protocol; messages go to stderr)
26
+ install Install the agent skills into this project (--local) or for you in
27
+ every project (--user); asks which harnesses. Run install --help.
28
+ uninstall Remove what install wrote
29
+ status Where the skills are installed
30
+ ingest <command> Keys, tokens and a hub for collecting feedback from installed copies
31
+ of a server (stdio servers). Run mcp-feedback ingest --help.
25
32
 
26
33
  Source (one is required):
27
34
  --mcp <url> A server's reader endpoint (or MCP_FEEDBACK_URL). Sends
@@ -32,7 +39,7 @@ Source (one is required):
32
39
  --table <name> Table name, default mcp_feedback (with --db or --postgres)
33
40
 
34
41
  Filters (stats, list, export):
35
- --kind <k> --status <s> --severity <s> --subject <s> --tool <name> --tag <t>
42
+ --kind <k> --status <s> --severity <s> --subject <s> --server <name> --tool <name> --tag <t>
36
43
  --since <iso> --until <iso> --ref <key=value> (an id in context.references)
37
44
 
38
45
  Other:
@@ -152,10 +159,24 @@ async function serve(reader, values, io) {
152
159
  await server.close();
153
160
  return 0;
154
161
  }
162
+ /** Handed to agentdist, which installs the agent skills into harnesses. */
163
+ const INSTALL_COMMANDS = ["install", "uninstall", "status", "harnesses"];
155
164
  /** Runs the CLI and resolves the process exit code. */
156
165
  export async function runCli(argv, io) {
157
166
  let reader;
158
167
  try {
168
+ // agentdist parses these itself, with flags of its own.
169
+ if (INSTALL_COMMANDS.includes(argv[0] ?? "")) {
170
+ const { installCli } = await import("./install.js");
171
+ return await installCli(argv, io);
172
+ }
173
+ if (argv[0] === "setup") {
174
+ throw new FeedbackInputError("setup was replaced by install: npx -y mcp-feedback@latest install --local, or --user for every project.");
175
+ }
176
+ if (argv[0] === "ingest") {
177
+ const { runIngestCli } = await import("./ingest/cli.js");
178
+ return await runIngestCli(argv.slice(1), io);
179
+ }
159
180
  let parsed;
160
181
  try {
161
182
  parsed = parseArgs({
@@ -171,6 +192,7 @@ export async function runCli(argv, io) {
171
192
  status: { type: "string" },
172
193
  severity: { type: "string" },
173
194
  subject: { type: "string" },
195
+ server: { type: "string" },
174
196
  tool: { type: "string" },
175
197
  tag: { type: "string" },
176
198
  since: { type: "string" },
@@ -205,6 +227,7 @@ export async function runCli(argv, io) {
205
227
  status,
206
228
  severity: oneOf("severity", values.severity, FEEDBACK_SEVERITIES),
207
229
  subject: values.subject,
230
+ server: values.server,
208
231
  tool: values.tool,
209
232
  tag: values.tag,
210
233
  since: values.since,
@@ -241,7 +264,7 @@ export async function runCli(argv, io) {
241
264
  json(stats);
242
265
  else {
243
266
  io.out(`total: ${stats.total}`);
244
- for (const group of ["by_status", "by_kind", "by_severity", "by_tool"]) {
267
+ for (const group of ["by_server", "by_status", "by_kind", "by_severity", "by_tool"]) {
245
268
  const counts = Object.entries(stats[group]).sort((a, b) => b[1] - a[1]);
246
269
  io.out(`${group.slice(3)}: ${counts.map(([key, count]) => `${key}=${count}`).join(", ") || "-"}`);
247
270
  }
@@ -25,7 +25,7 @@ function record(n, created_at, fields, context = {}) {
25
25
  client_version: "1.0.0",
26
26
  user_agent: null,
27
27
  },
28
- server: { name: "conformance-server", version: "1.0.0" },
28
+ server: fields.server === null ? { name: null, version: null } : { name: fields.server ?? "conformance-server", version: "1.0.0" },
29
29
  status: "new",
30
30
  triage_note: null,
31
31
  triaged_by: null,
@@ -46,8 +46,8 @@ export const conformanceRecords = [
46
46
  server_context: { version: "1.2.3", job: { id: "job-9", state: "failed", attempts: [1, 2] } },
47
47
  }),
48
48
  record(3, "2026-01-03T00:00:00.000Z", { kind: "feature_request", severity: "none", tags: [], subject: "alice", tools: [] }),
49
- record(4, "2026-01-03T00:00:00.000Z", { kind: "friction", severity: "minor", tags: ["docs"], subject: null, tools: ["list_orders"] }),
50
- record(5, "2026-01-04T00:00:00.000Z", { kind: "praise", severity: "none", tags: [], subject: "bob", tools: [] }),
49
+ record(4, "2026-01-03T00:00:00.000Z", { kind: "friction", severity: "minor", tags: ["docs"], subject: null, tools: ["list_orders"], server: null }),
50
+ record(5, "2026-01-04T00:00:00.000Z", { kind: "praise", severity: "none", tags: [], subject: "bob", tools: [], server: "other-server" }),
51
51
  record(6, "2026-01-05T00:00:00.000Z", { kind: "bug", severity: "minor", tags: ["timeout"], subject: "alice", tools: ["create_order"] }, { references: { documentId: "doc-1" } }),
52
52
  ];
53
53
  const ids = (...numbers) => numbers.map(id);
@@ -61,6 +61,8 @@ export const conformanceCases = [
61
61
  { name: "filters by severity", op: "list", filter: { severity: "minor" }, limit: 10, expect_pages: [ids(6, 4)] },
62
62
  { name: "filters by status", op: "list", filter: { status: "resolved" }, limit: 10, expect_pages: [[]] },
63
63
  { name: "filters by subject", op: "list", filter: { subject: "alice" }, limit: 10, expect_pages: [ids(6, 3, 1)] },
64
+ { name: "filters by server", op: "list", filter: { server: "other-server" }, limit: 10, expect_pages: [ids(5)] },
65
+ { name: "a server filter leaves out records with no server", op: "list", filter: { server: "conformance-server" }, limit: 10, expect_pages: [ids(6, 3, 2, 1)] },
64
66
  { name: "filters by tool", op: "list", filter: { tool: "create_order" }, limit: 10, expect_pages: [ids(6, 2, 1)] },
65
67
  { name: "filters by tag", op: "list", filter: { tag: "timeout" }, limit: 10, expect_pages: [ids(6, 2)] },
66
68
  { name: "since is inclusive", op: "list", filter: { since: "2026-01-03T00:00:00.000Z" }, limit: 10, expect_pages: [ids(6, 5, 4, 3)] },
@@ -94,6 +96,7 @@ export const conformanceCases = [
94
96
  by_status: { new: 6 },
95
97
  by_severity: { major: 1, blocker: 1, none: 2, minor: 2 },
96
98
  by_tool: { create_order: 3, list_orders: 2 },
99
+ by_server: { "conformance-server": 4, "other-server": 1 },
97
100
  },
98
101
  },
99
102
  {
@@ -106,6 +109,7 @@ export const conformanceCases = [
106
109
  by_status: { new: 3 },
107
110
  by_severity: { major: 1, none: 1, minor: 1 },
108
111
  by_tool: { create_order: 2 },
112
+ by_server: { "conformance-server": 3 },
109
113
  },
110
114
  },
111
115
  {
@@ -118,13 +122,20 @@ export const conformanceCases = [
118
122
  by_status: { new: 2 },
119
123
  by_severity: { blocker: 1, minor: 1 },
120
124
  by_tool: { create_order: 2, list_orders: 1 },
125
+ by_server: { "conformance-server": 2 },
121
126
  },
122
127
  },
128
+ {
129
+ name: "stats honour a server",
130
+ op: "stats",
131
+ filter: { server: "other-server" },
132
+ expect: { total: 1, by_kind: { praise: 1 }, by_status: { new: 1 }, by_severity: { none: 1 }, by_tool: {}, by_server: { "other-server": 1 } },
133
+ },
123
134
  {
124
135
  name: "stats with no matches is empty",
125
136
  op: "stats",
126
137
  filter: { tag: "nope" },
127
- expect: { total: 0, by_kind: {}, by_status: {}, by_severity: {}, by_tool: {} },
138
+ expect: { total: 0, by_kind: {}, by_status: {}, by_severity: {}, by_tool: {}, by_server: {} },
128
139
  },
129
140
  { name: "rejects a duplicate id", op: "insert_duplicate", id: id(1) },
130
141
  {
package/dist/drizzle.js CHANGED
@@ -37,6 +37,7 @@ export function feedbackTable(name = DEFAULT_TABLE) {
37
37
  index(`${name}_created_idx`).on(table.createdAt.desc().nullsFirst(), table.id.desc().nullsFirst()),
38
38
  index(`${name}_status_idx`).on(table.status),
39
39
  index(`${name}_kind_idx`).on(table.kind),
40
+ index(`${name}_server_idx`).on(table.serverName),
40
41
  ]);
41
42
  }
42
43
  /** The default `mcp_feedback` table. */
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./types.js";
2
- export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNewestFirst, matchesFilter, type FeedbackStore, } from "./store.js";
2
+ export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNewestFirst, matchesFilter, FeedbackDeliveryError, type FeedbackReceipt, type FeedbackSink, type FeedbackStore, } from "./store.js";
3
3
  export { defaultResolveIdentity, fingerprintToken, type ClientImplementation, type FeedbackRequestExtra, type ResolveIdentity, } from "./identity.js";
4
- export { registerFeedback, registerFeedbackReader, DEFAULT_FEEDBACK_LIMITS, type FeedbackLimits, type FeedbackOptions, type FeedbackReaderOptions, } from "./register.js";
4
+ export { registerFeedback, registerFeedbackReader, buildRecord, validateSubmission, DEFAULT_FEEDBACK_LIMITS, type FeedbackSubmission, type FeedbackLimits, type FeedbackOptions, type FeedbackReaderOptions, } from "./register.js";
5
5
  export { FeedbackInputError, listPage, normalizeFilter, triageMany, type TriageOutcome } from "./reader.js";
6
6
  export { feedbackInstructions, feedbackConfirmInstructions, feedbackToolCatalog, feedbackToolCatalogFor, feedbackReaderToolCatalog, } from "./tools.js";
7
7
  export { memoryStore } from "./stores/memory.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./types.js";
2
- export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNewestFirst, matchesFilter, } from "./store.js";
2
+ export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNewestFirst, matchesFilter, FeedbackDeliveryError, } from "./store.js";
3
3
  export { defaultResolveIdentity, fingerprintToken, } from "./identity.js";
4
- export { registerFeedback, registerFeedbackReader, DEFAULT_FEEDBACK_LIMITS, } from "./register.js";
4
+ export { registerFeedback, registerFeedbackReader, buildRecord, validateSubmission, DEFAULT_FEEDBACK_LIMITS, } from "./register.js";
5
5
  export { FeedbackInputError, listPage, normalizeFilter, triageMany } from "./reader.js";
6
6
  export { feedbackInstructions, feedbackConfirmInstructions, feedbackToolCatalog, feedbackToolCatalogFor, feedbackReaderToolCatalog, } from "./tools.js";
7
7
  export { memoryStore } from "./stores/memory.js";
@@ -0,0 +1,8 @@
1
+ export declare const INGEST_USAGE = "mcp-feedback ingest: run a hub that collects feedback from installed copies of a server\n\nUsage: mcp-feedback ingest <command> [options]\n\nCommands:\n keygen --out <file> Make a signing key. Writes it (private) to <file>; prints the public half\n issue-key --project <p> Print a project key: ships in the server package, can only enrol\n issue-token --project <p> --subject <s> [--days <n>]\n Print a token for a person or team you know (default 90 days)\n serve (--db <path> | --postgres <url>) [--project <p>...] [--port <n>] [--host <h>]\n Run the hub (POST /v1/enroll, POST /v1/feedback). Every project\n your key issued a project key for goes into one store, under its\n own name; --project, repeated, accepts only those listed.\n With MCP_FEEDBACK_READER_TOKEN set (32+ characters), also serves\n the reader tools for all projects at POST /mcp, behind that token\n\nOptions (serve reads each from the environment variable shown when the flag is not given):\n --key <file> The signing key MCP_FEEDBACK_INGEST_KEY (a path, or the key file's JSON)\n --issuer <url> The hub's public URL; tokens are MCP_FEEDBACK_INGEST_ISSUER\n only valid there\n --db <path> SQLite file MCP_FEEDBACK_DB\n --postgres <url> Postgres connection URL MCP_FEEDBACK_POSTGRES_URL, then DATABASE_URL\n --table <name> Table, default mcp_feedback MCP_FEEDBACK_TABLE\n --project <p> Accept only these projects (repeat) MCP_FEEDBACK_INGEST_PROJECTS (comma-separated)\n --port <n> Default 8787 PORT\n --host <h> Default 127.0.0.1 MCP_FEEDBACK_INGEST_HOST\n --trust-proxy Client address from X-Forwarded-For MCP_FEEDBACK_INGEST_TRUST_PROXY=1\n --revoked <file> Refuse tokens whose jti or subject is MCP_FEEDBACK_INGEST_REVOKED (comma-separated)\n a line of this file (read at start)\n Reader endpoint at /mcp MCP_FEEDBACK_READER_TOKEN (32+ characters)\n HMAC key for token fingerprints MCP_FEEDBACK_FINGERPRINT_KEY\n GitHub sign-in: OAuth app client id MCP_FEEDBACK_GITHUB_CLIENT_ID (device flow enabled)\n ... only members of these orgs MCP_FEEDBACK_GITHUB_ORGS (comma-separated)\n ... only these GitHub logins MCP_FEEDBACK_GITHUB_USERS (comma-separated)\n --kid <id> With keygen: the key's id (default: generated)\n\nserve also answers GET /healthz, for container health checks.\n";
2
+ interface IngestIo {
3
+ out: (line: string) => void;
4
+ err: (line: string) => void;
5
+ env: Record<string, string | undefined>;
6
+ }
7
+ export declare function runIngestCli(argv: string[], io: IngestIo): Promise<number>;
8
+ export {};