mcp-feedback 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -27,8 +27,17 @@ The reader tools list, fetch and count feedback, and `update_feedback_triage` cl
27
27
 
28
28
  ## CLI
29
29
 
30
+ The CLI reads either through a server's reader endpoint (the reader tools, mounted behind a maintainer credential) or straight from the store.
31
+
30
32
  ```sh
31
- mcp-feedback stats --db ./feedback.db
33
+ # Through a reader endpoint: needs its URL and credential, no database access.
34
+ export MCP_FEEDBACK_URL=https://example.com/mcp/feedback # or --mcp <url>
35
+ export MCP_FEEDBACK_TOKEN=... # sent as a bearer token
36
+ npx -y mcp-feedback stats
37
+
38
+ # Or straight from the store.
39
+ npx -y mcp-feedback stats --db ./feedback.db # or --postgres <url>
40
+
32
41
  mcp-feedback list --status new --tool create_meme --text
33
42
  mcp-feedback export --since 2026-11-01 > feedback.jsonl
34
43
  mcp-feedback get <id> --text
@@ -37,7 +46,7 @@ mcp-feedback close <id> --dismiss --note "Working as intended"
37
46
  mcp-feedback reopen <id>
38
47
  ```
39
48
 
40
- Use `--postgres <url>` instead of `--db` for Postgres. That needs the `pg` package, so run the copy installed alongside your server (`npm exec mcp-feedback`, or `pnpm --filter <package> exec mcp-feedback` in a monorepo) rather than a fresh `npx` download. `MCP_FEEDBACK_DB` and `MCP_FEEDBACK_POSTGRES_URL` set the store from the environment. Output is JSON unless you pass `--text`. Exit code 2 means bad input; 1 means a failure or an id that was not found.
49
+ `MCP_FEEDBACK_DB` and `MCP_FEEDBACK_POSTGRES_URL` set the store from the environment. With a reader endpoint, pass `--prefix` if the server set a `toolPrefix`; `--by` does not apply, because the server records who triaged from the credential. The same client is available in code as `connectFeedbackReader` from `mcp-feedback/client`. Output is JSON unless you pass `--text`. Exit code 2 means bad input; 1 means a failure or an id that was not found.
41
50
 
42
51
  Append `feedbackInstructions` to your server's `instructions` so agents know when to file. If you publish a tool catalog, merge in `feedbackToolCatalog`.
43
52
 
@@ -61,6 +70,7 @@ registerFeedback(server, {
61
70
  | --- | --- |
62
71
  | `store` | Where records go. Required. |
63
72
  | `resolveIdentity` | Override identity fields for a request. |
73
+ | `requireConfirmation` | Tell agents to file only after the user confirms the exact feedback. Use `feedbackConfirmInstructions` in place of `feedbackInstructions`, and `feedbackToolCatalogFor(options)` for catalogs. |
64
74
  | `requireIdentity` | Refuse submissions with no subject and no token fingerprint. |
65
75
  | `redact` | Scrub a record before it is stored. |
66
76
  | `limits` | Override size limits (see the spec for defaults). |
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- // Reader CLI: the same operations as the MCP reader tools, straight against
3
- // the store, for setups that do not want to expose reader tools over MCP.
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).
4
4
  import { realpathSync } from "node:fs";
5
5
  import { userInfo } from "node:os";
6
6
  import { fileURLToPath } from "node:url";
@@ -20,10 +20,13 @@ Commands:
20
20
  close <id...> Mark resolved (or --dismiss), with an optional --note
21
21
  reopen <id...> Set status back to new
22
22
 
23
- Store (one is required):
23
+ Source (one is required):
24
+ --mcp <url> A server's reader endpoint (or MCP_FEEDBACK_URL). Sends
25
+ MCP_FEEDBACK_TOKEN from the environment as a bearer token.
26
+ --prefix <p> The server's tool prefix, if it set one (with --mcp)
24
27
  --db <path> SQLite file (or MCP_FEEDBACK_DB)
25
- --postgres <url> Postgres connection URL (or MCP_FEEDBACK_POSTGRES_URL; needs the pg package)
26
- --table <name> Table name, default mcp_feedback
28
+ --postgres <url> Postgres connection URL (or MCP_FEEDBACK_POSTGRES_URL)
29
+ --table <name> Table name, default mcp_feedback (with --db or --postgres)
27
30
 
28
31
  Filters (stats, list, export):
29
32
  --kind <k> --status <s> --severity <s> --subject <s> --tool <name> --tag <t>
@@ -36,7 +39,8 @@ Other:
36
39
  --note <text> Triage note
37
40
  --clear-note Remove the triage note
38
41
  --dismiss With close: mark dismissed instead of resolved
39
- --by <name> Recorded as triaged_by (default: your username)
42
+ --by <name> Recorded as triaged_by (default: your username; with --mcp
43
+ the server records the credential's identity instead)
40
44
  --text Human-readable output instead of JSON
41
45
  `;
42
46
  async function openStore(values, env) {
@@ -44,26 +48,66 @@ async function openStore(values, env) {
44
48
  const db = values.db ?? env.MCP_FEEDBACK_DB;
45
49
  const postgres = values.postgres ?? env.MCP_FEEDBACK_POSTGRES_URL;
46
50
  if (db && postgres)
47
- throw new FeedbackInputError("Pass either --db or --postgres, not both.");
51
+ throw new FeedbackInputError("Pass one of --mcp, --db or --postgres.");
48
52
  if (db) {
49
53
  const { sqliteStore } = await import("./stores/sqlite.js");
50
54
  return sqliteStore({ path: db, table });
51
55
  }
52
56
  if (postgres) {
53
- let pg;
54
- try {
55
- const name = "pg";
56
- pg = await import(name);
57
- }
58
- catch {
59
- throw new FeedbackInputError("--postgres needs the pg package: npm install pg");
60
- }
61
- const pool = new (pg.default ?? pg).Pool({ connectionString: postgres });
57
+ const { default: pg } = await import("pg");
58
+ const pool = new pg.Pool({ connectionString: postgres });
62
59
  const { postgresStore } = await import("./stores/postgres.js");
63
60
  // The CLI reads an existing table; it never creates one.
64
61
  return { ...postgresStore({ client: pool, table, migrate: false }), close: () => pool.end() };
65
62
  }
66
- throw new FeedbackInputError("No store given. Pass --db <path> or --postgres <url>.");
63
+ throw new FeedbackInputError("No source given. Pass --mcp <url>, --db <path> or --postgres <url>.");
64
+ }
65
+ /** The same reader operations over a store the CLI opened itself. */
66
+ function storeReader(store, by) {
67
+ return {
68
+ stats: (filter) => store.stats(filter),
69
+ list: (query) => listPage(store, query),
70
+ get: async (id) => {
71
+ const record = await store.get(id);
72
+ if (!record)
73
+ throw new FeedbackInputError(`No feedback with id ${id}.`);
74
+ return record;
75
+ },
76
+ triage: (ids, change) => triageMany(store, ids, { ...change, by }),
77
+ close: async () => store.close?.(),
78
+ };
79
+ }
80
+ async function openReader(values, io) {
81
+ const by = values.by ?? io.env.USER ?? userInfo().username;
82
+ if (io.openStore)
83
+ return storeReader(await io.openStore(), by);
84
+ const url = values.mcp ?? io.env.MCP_FEEDBACK_URL;
85
+ if (!url) {
86
+ if (values.prefix !== undefined)
87
+ throw new FeedbackInputError("--prefix only applies with --mcp.");
88
+ return storeReader(await openStore(values, io.env), by);
89
+ }
90
+ if (values.db !== undefined || values.postgres !== undefined)
91
+ throw new FeedbackInputError("Pass one of --mcp, --db or --postgres.");
92
+ if (values.table !== undefined)
93
+ throw new FeedbackInputError("--table does not apply with --mcp.");
94
+ if (values.by !== undefined)
95
+ throw new FeedbackInputError("--by does not apply with --mcp: the server records who triaged from the credential.");
96
+ const token = io.env.MCP_FEEDBACK_TOKEN;
97
+ const { connectFeedbackReader, FeedbackReaderError } = await import("./client.js");
98
+ try {
99
+ return await connectFeedbackReader({
100
+ url,
101
+ headers: token ? { Authorization: `Bearer ${token}` } : undefined,
102
+ toolPrefix: values.prefix,
103
+ });
104
+ }
105
+ catch (error) {
106
+ if (error instanceof FeedbackReaderError && error.status === 401 && !token) {
107
+ throw new FeedbackReaderError(`${error.message} MCP_FEEDBACK_TOKEN is not set; set it to the endpoint's maintainer credential.`, 401);
108
+ }
109
+ throw error;
110
+ }
67
111
  }
68
112
  function oneOf(label, value, allowed) {
69
113
  if (value === undefined)
@@ -90,7 +134,7 @@ function detail(record) {
90
134
  }
91
135
  /** Runs the CLI and resolves the process exit code. */
92
136
  export async function runCli(argv, io) {
93
- let store;
137
+ let reader;
94
138
  try {
95
139
  let parsed;
96
140
  try {
@@ -98,6 +142,8 @@ export async function runCli(argv, io) {
98
142
  args: argv,
99
143
  allowPositionals: true,
100
144
  options: {
145
+ mcp: { type: "string" },
146
+ prefix: { type: "string" },
101
147
  db: { type: "string" },
102
148
  postgres: { type: "string" },
103
149
  table: { type: "string" },
@@ -145,12 +191,13 @@ export async function runCli(argv, io) {
145
191
  if (!ids.length)
146
192
  throw new FeedbackInputError(`${command} needs at least one id.`);
147
193
  };
148
- const open = async () => (store = await (io.openStore ? io.openStore() : openStore(values, io.env)));
194
+ const open = async () => (reader ??= await openReader(values, io));
149
195
  const triage = async (change) => {
150
196
  needIds();
151
197
  const note = values["clear-note"] ? null : (values.note ?? change.note);
152
- const by = values.by ?? io.env.USER ?? userInfo().username;
153
- const outcome = await triageMany(await open(), ids, { status: change.status, note, by });
198
+ if (change.status === undefined && note === undefined)
199
+ throw new FeedbackInputError("Provide a status, a note, or both.");
200
+ const outcome = await (await open()).triage([...new Set(ids)], { status: change.status, note });
154
201
  if (values.text) {
155
202
  for (const record of outcome.updated)
156
203
  io.out(summaryLine(record));
@@ -181,7 +228,7 @@ export async function runCli(argv, io) {
181
228
  if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > 1000)) {
182
229
  throw new FeedbackInputError("--limit must be a whole number from 1 to 1000.");
183
230
  }
184
- const page = await listPage(await open(), { ...filter, limit, cursor: values.cursor });
231
+ const page = await (await open()).list({ ...filter, limit: limit ?? 25, cursor: values.cursor });
185
232
  if (!values.text)
186
233
  json(page);
187
234
  else {
@@ -195,7 +242,7 @@ export async function runCli(argv, io) {
195
242
  const source = await open();
196
243
  let cursor;
197
244
  do {
198
- const page = await listPage(source, { ...filter, limit: 200, cursor });
245
+ const page = await source.list({ ...filter, limit: 200, cursor });
199
246
  for (const record of page.items)
200
247
  io.out(values.text ? summaryLine(record) : JSON.stringify(record));
201
248
  cursor = page.next_cursor ?? undefined;
@@ -206,8 +253,6 @@ export async function runCli(argv, io) {
206
253
  if (ids.length !== 1)
207
254
  throw new FeedbackInputError("get takes exactly one id.");
208
255
  const record = await (await open()).get(ids[0]);
209
- if (!record)
210
- throw new FeedbackInputError(`No feedback with id ${ids[0]}.`);
211
256
  if (values.text)
212
257
  io.out(detail(record));
213
258
  else
@@ -235,7 +280,7 @@ export async function runCli(argv, io) {
235
280
  return 1;
236
281
  }
237
282
  finally {
238
- await store?.close?.();
283
+ await reader?.close();
239
284
  }
240
285
  }
241
286
  const invoked = process.argv[1] ? realpathSync(process.argv[1]) : "";
@@ -0,0 +1,33 @@
1
+ import type { TriageOutcome } from "./reader.js";
2
+ import type { FeedbackFilter, FeedbackPage, FeedbackRecord, FeedbackStats, FeedbackStatus } from "./types.js";
3
+ /** The reader tools cap a page at this size; larger requests are clamped and continue by cursor. */
4
+ export declare const READER_PAGE_LIMIT = 100;
5
+ /** A failure reaching the reader endpoint or reported by its tools. `status` is the HTTP status, when there was one. */
6
+ export declare class FeedbackReaderError extends Error {
7
+ readonly status?: number | undefined;
8
+ constructor(message: string, status?: number | undefined);
9
+ }
10
+ export interface FeedbackReaderClient {
11
+ stats(filter: FeedbackFilter): Promise<FeedbackStats>;
12
+ list(query: FeedbackFilter & {
13
+ limit: number;
14
+ cursor?: string;
15
+ }): Promise<FeedbackPage>;
16
+ /** Rejects with FeedbackReaderError when the id is unknown. */
17
+ get(id: string): Promise<FeedbackRecord>;
18
+ /** The server records who triaged from the credential, and sets updated_at. */
19
+ triage(ids: string[], change: {
20
+ status?: FeedbackStatus;
21
+ note?: string | null;
22
+ }): Promise<TriageOutcome>;
23
+ close(): Promise<void>;
24
+ }
25
+ export interface FeedbackReaderClientOptions {
26
+ /** Streamable HTTP URL of the endpoint that has the reader tools mounted. */
27
+ url: string | URL;
28
+ /** Sent on every request, e.g. `{ Authorization: "Bearer …" }`. */
29
+ headers?: Record<string, string>;
30
+ /** The server's toolPrefix, if it set one. */
31
+ toolPrefix?: string;
32
+ }
33
+ export declare function connectFeedbackReader(options: FeedbackReaderClientOptions): Promise<FeedbackReaderClient>;
package/dist/client.js ADDED
@@ -0,0 +1,59 @@
1
+ // Reads and triages feedback through a server's reader tools, so maintainers
2
+ // need the reader endpoint's credential rather than database access.
3
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
+ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
5
+ import { READER_TOOLS } from "./tools.js";
6
+ /** The reader tools cap a page at this size; larger requests are clamped and continue by cursor. */
7
+ export const READER_PAGE_LIMIT = 100;
8
+ /** A failure reaching the reader endpoint or reported by its tools. `status` is the HTTP status, when there was one. */
9
+ export class FeedbackReaderError extends Error {
10
+ status;
11
+ constructor(message, status) {
12
+ super(message);
13
+ this.status = status;
14
+ }
15
+ }
16
+ const HTTP_HINTS = {
17
+ 401: "the credential is missing or was refused",
18
+ 403: "the credential is not allowed to use this endpoint",
19
+ 404: "no MCP endpoint at this URL",
20
+ 405: "no MCP endpoint at this URL",
21
+ };
22
+ export async function connectFeedbackReader(options) {
23
+ const url = new URL(options.url);
24
+ const prefix = options.toolPrefix ?? "";
25
+ const client = new Client({ name: "mcp-feedback", version: "1" });
26
+ try {
27
+ await client.connect(new StreamableHTTPClientTransport(url, { requestInit: { headers: options.headers } }));
28
+ }
29
+ catch (error) {
30
+ // The SDK's StreamableHTTPError carries the HTTP status as `code`.
31
+ const status = typeof error.code === "number" ? error.code : undefined;
32
+ const reason = status !== undefined && HTTP_HINTS[status] ? `HTTP ${status}, ${HTTP_HINTS[status]}` : error instanceof Error ? error.message : String(error);
33
+ throw new FeedbackReaderError(`Could not connect to ${url}: ${reason}.`, status);
34
+ }
35
+ const call = async (tool, args) => {
36
+ const name = prefix + tool.name;
37
+ // An unknown tool usually means the server registered the reader tools with a prefix.
38
+ // SDK versions differ on whether that arrives as a thrown error or an error result.
39
+ const fail = (message) => new FeedbackReaderError(/Tool \S+ not found/.test(message) ? `${message}. If the server uses a tool prefix, pass it.` : message);
40
+ let response;
41
+ try {
42
+ response = await client.callTool({ name, arguments: args });
43
+ }
44
+ catch (error) {
45
+ throw fail(error instanceof Error ? error.message : String(error));
46
+ }
47
+ const text = response.content?.find((c) => c.type === "text")?.text;
48
+ if (response.isError)
49
+ throw fail(text ?? `${name} failed.`);
50
+ return (response.structuredContent ?? JSON.parse(text ?? "null"));
51
+ };
52
+ return {
53
+ stats: (filter) => call(READER_TOOLS.stats, { ...filter }),
54
+ list: ({ limit, ...rest }) => call(READER_TOOLS.list, { ...rest, limit: Math.min(limit, READER_PAGE_LIMIT) }),
55
+ get: (id) => call(READER_TOOLS.get, { id }),
56
+ triage: (ids, change) => call(READER_TOOLS.triage, { ids, status: change.status, note: change.note }),
57
+ close: () => client.close(),
58
+ };
59
+ }
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNe
3
3
  export { defaultResolveIdentity, fingerprintToken, type ClientImplementation, type FeedbackRequestExtra, type ResolveIdentity, } from "./identity.js";
4
4
  export { registerFeedback, registerFeedbackReader, DEFAULT_FEEDBACK_LIMITS, type FeedbackLimits, type FeedbackOptions, type FeedbackReaderOptions, } from "./register.js";
5
5
  export { FeedbackInputError, listPage, normalizeFilter, triageMany, type TriageOutcome } from "./reader.js";
6
- export { feedbackInstructions, feedbackToolCatalog, feedbackReaderToolCatalog } from "./tools.js";
6
+ export { feedbackInstructions, feedbackConfirmInstructions, feedbackToolCatalog, feedbackToolCatalogFor, feedbackReaderToolCatalog, } from "./tools.js";
7
7
  export { memoryStore } from "./stores/memory.js";
package/dist/index.js CHANGED
@@ -3,5 +3,5 @@ export { defineFeedbackStore, toolNamesOf, encodeCursor, decodeCursor, compareNe
3
3
  export { defaultResolveIdentity, fingerprintToken, } from "./identity.js";
4
4
  export { registerFeedback, registerFeedbackReader, DEFAULT_FEEDBACK_LIMITS, } from "./register.js";
5
5
  export { FeedbackInputError, listPage, normalizeFilter, triageMany } from "./reader.js";
6
- export { feedbackInstructions, feedbackToolCatalog, feedbackReaderToolCatalog } from "./tools.js";
6
+ export { feedbackInstructions, feedbackConfirmInstructions, feedbackToolCatalog, feedbackToolCatalogFor, feedbackReaderToolCatalog, } from "./tools.js";
7
7
  export { memoryStore } from "./stores/memory.js";
@@ -30,6 +30,11 @@ interface SharedOptions {
30
30
  onError?: (error: unknown, tool: string) => void;
31
31
  }
32
32
  export interface FeedbackOptions extends SharedOptions {
33
+ /**
34
+ * Tell agents to file only after the user confirms the exact feedback. Pair it with
35
+ * `feedbackConfirmInstructions` in the server's instructions.
36
+ */
37
+ requireConfirmation?: boolean;
33
38
  /** Refuse submissions that carry neither a subject nor a token fingerprint. */
34
39
  requireIdentity?: boolean;
35
40
  /** Last chance to scrub a record before it is stored. */
package/dist/register.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { randomBytes } from "node:crypto";
2
2
  import { defaultResolveIdentity, } from "./identity.js";
3
3
  import { FeedbackInputError, listPage, normalizeFilter, triageMany } from "./reader.js";
4
- import { READER_TOOLS, SUBMIT_TOOL, SYNTHESIZE_PROMPT, feedbackStatsShape, getFeedbackShape, listFeedbackShape, submitFeedbackShape, synthesizeFeedbackArgsShape, synthesizePromptText, updateFeedbackTriageShape, } from "./tools.js";
4
+ import { READER_TOOLS, SUBMIT_TOOL, submitToolDescription, SYNTHESIZE_PROMPT, feedbackStatsShape, getFeedbackShape, listFeedbackShape, submitFeedbackShape, synthesizeFeedbackArgsShape, synthesizePromptText, updateFeedbackTriageShape, } from "./tools.js";
5
5
  import { FEEDBACK_SCHEMA_VERSION, } from "./types.js";
6
6
  export const DEFAULT_FEEDBACK_LIMITS = {
7
7
  titleChars: 200,
@@ -30,6 +30,10 @@ function checkLimits(input, limits) {
30
30
  throw new FeedbackInputError(`${label} has ${value.length} entries; the limit is ${limits.maxItems}.`);
31
31
  }
32
32
  };
33
+ for (const field of ["title", "body"]) {
34
+ if (!input[field].trim())
35
+ throw new FeedbackInputError(`${field} is blank. Describe the problem and resubmit.`);
36
+ }
33
37
  text("title", input.title, limits.titleChars);
34
38
  text("body", input.body, limits.bodyChars);
35
39
  items("tags", input.tags);
@@ -86,7 +90,7 @@ export function registerFeedback(server, options) {
86
90
  const name = prefix + SUBMIT_TOOL.name;
87
91
  server.registerTool(name, {
88
92
  title: SUBMIT_TOOL.title,
89
- description: SUBMIT_TOOL.description,
93
+ description: submitToolDescription(options.requireConfirmation),
90
94
  inputSchema: submitFeedbackShape,
91
95
  annotations: SUBMIT_TOOL.annotations,
92
96
  }, (args, extra) => guard(name, async () => {
package/dist/tools.d.ts CHANGED
@@ -18,43 +18,43 @@ export declare const submitFeedbackShape: {
18
18
  is_error: z.ZodOptional<z.ZodBoolean>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  name: string;
21
- error?: string | undefined;
22
21
  arguments_summary?: string | undefined;
22
+ error?: string | undefined;
23
23
  is_error?: boolean | undefined;
24
24
  }, {
25
25
  name: string;
26
- error?: string | undefined;
27
26
  arguments_summary?: string | undefined;
27
+ error?: string | undefined;
28
28
  is_error?: boolean | undefined;
29
29
  }>, "many">>;
30
30
  repro_steps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
31
  excerpt: z.ZodOptional<z.ZodString>;
32
32
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
33
33
  }, "strip", z.ZodTypeAny, {
34
- goal?: string | undefined;
35
34
  expected?: string | undefined;
35
+ goal?: string | undefined;
36
36
  actual?: string | undefined;
37
37
  workaround?: string | undefined;
38
38
  suggestion?: string | undefined;
39
39
  tool_calls?: {
40
40
  name: string;
41
- error?: string | undefined;
42
41
  arguments_summary?: string | undefined;
42
+ error?: string | undefined;
43
43
  is_error?: boolean | undefined;
44
44
  }[] | undefined;
45
45
  repro_steps?: string[] | undefined;
46
46
  excerpt?: string | undefined;
47
47
  metadata?: Record<string, unknown> | undefined;
48
48
  }, {
49
- goal?: string | undefined;
50
49
  expected?: string | undefined;
50
+ goal?: string | undefined;
51
51
  actual?: string | undefined;
52
52
  workaround?: string | undefined;
53
53
  suggestion?: string | undefined;
54
54
  tool_calls?: {
55
55
  name: string;
56
- error?: string | undefined;
57
56
  arguments_summary?: string | undefined;
57
+ error?: string | undefined;
58
58
  is_error?: boolean | undefined;
59
59
  }[] | undefined;
60
60
  repro_steps?: string[] | undefined;
@@ -158,11 +158,24 @@ export declare function synthesizePromptText(prefix: string, args: {
158
158
  }): string;
159
159
  /** Text a host can append to its server `instructions` so agents know when to file feedback. */
160
160
  export declare const feedbackInstructions: string;
161
+ /** Appended to the submit tool's description when the host sets `requireConfirmation`. */
162
+ export declare const CONFIRMATION_REQUIRED: string;
163
+ /** The `feedbackInstructions` counterpart for hosts that set `requireConfirmation`. */
164
+ export declare const feedbackConfirmInstructions: string;
165
+ export declare function submitToolDescription(requireConfirmation?: boolean): string;
161
166
  /** `{ name, description }` entries for hosts that publish a tool catalog. */
162
167
  export declare const feedbackToolCatalog: {
163
168
  name: "submit_feedback";
164
169
  description: string;
165
170
  }[];
171
+ /** The catalog entry exactly as registerFeedback advertises it with these options. */
172
+ export declare function feedbackToolCatalogFor(options?: {
173
+ requireConfirmation?: boolean;
174
+ toolPrefix?: string;
175
+ }): {
176
+ name: string;
177
+ description: string;
178
+ }[];
166
179
  export declare const feedbackReaderToolCatalog: {
167
180
  name: "list_feedback" | "get_feedback" | "update_feedback_triage" | "feedback_stats";
168
181
  description: string;
package/dist/tools.js CHANGED
@@ -133,8 +133,22 @@ export function synthesizePromptText(prefix, args) {
133
133
  export const feedbackInstructions = "If one of this server's tools fails, behaves unexpectedly, is confusing, or cannot do what the user needed, " +
134
134
  "call submit_feedback once you have handled or been blocked on the user's request. Describe the goal, what you " +
135
135
  "expected, what happened and the tool calls involved, without secrets or personal data, and tell the user you filed it.";
136
+ /** Appended to the submit tool's description when the host sets `requireConfirmation`. */
137
+ export const CONFIRMATION_REQUIRED = " Only call it after showing the user the exact feedback you intend to submit and receiving their explicit " +
138
+ "confirmation; a complaint or request is not by itself permission.";
139
+ /** The `feedbackInstructions` counterpart for hosts that set `requireConfirmation`. */
140
+ export const feedbackConfirmInstructions = "If one of this server's tools fails, behaves unexpectedly, is confusing, or cannot do what the user needed, " +
141
+ "offer to file feedback: show the user the exact kind, title, body and context you would submit, and call " +
142
+ "submit_feedback only after they explicitly confirm. Leave out secrets and personal data.";
143
+ export function submitToolDescription(requireConfirmation = false) {
144
+ return SUBMIT_TOOL.description + (requireConfirmation ? CONFIRMATION_REQUIRED : "");
145
+ }
136
146
  /** `{ name, description }` entries for hosts that publish a tool catalog. */
137
147
  export const feedbackToolCatalog = [{ name: SUBMIT_TOOL.name, description: SUBMIT_TOOL.description }];
148
+ /** The catalog entry exactly as registerFeedback advertises it with these options. */
149
+ export function feedbackToolCatalogFor(options = {}) {
150
+ return [{ name: (options.toolPrefix ?? "") + SUBMIT_TOOL.name, description: submitToolDescription(options.requireConfirmation) }];
151
+ }
138
152
  export const feedbackReaderToolCatalog = Object.values(READER_TOOLS).map(({ name, description }) => ({
139
153
  name,
140
154
  description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-feedback",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Drop-in feedback tools for MCP servers: agents submit structured feedback, stamped with the caller's identity, into a pluggable store.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -51,6 +51,10 @@
51
51
  "./drizzle": {
52
52
  "types": "./dist/drizzle.d.ts",
53
53
  "default": "./dist/drizzle.js"
54
+ },
55
+ "./client": {
56
+ "types": "./dist/client.d.ts",
57
+ "default": "./dist/client.js"
54
58
  }
55
59
  },
56
60
  "scripts": {
@@ -63,13 +67,9 @@
63
67
  "peerDependencies": {
64
68
  "@modelcontextprotocol/sdk": "^1.20.0",
65
69
  "drizzle-orm": ">=0.36.0",
66
- "pg": "^8.0.0",
67
70
  "zod": "^3.25.0 || ^4.0.0"
68
71
  },
69
72
  "peerDependenciesMeta": {
70
- "pg": {
71
- "optional": true
72
- },
73
73
  "drizzle-orm": {
74
74
  "optional": true
75
75
  }
@@ -86,5 +86,8 @@
86
86
  "typescript": "^5.9.0",
87
87
  "vitest": "^3.2.0",
88
88
  "zod": "3.25.76"
89
+ },
90
+ "dependencies": {
91
+ "pg": "^8.0.0"
89
92
  }
90
93
  }