Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.alpic.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

When something doesn’t work as expected, neither users nor models have a built-in way to tell you. User Feedback adds a send_feedback tool to your MCP server so models can report when they struggled during usage, and users can send feedback too. The @alpic-ai/insights package injects the feedback tool into your server’s tool list. Alpic stores the feedback for you to review in the dashboard.

1. Install the package

pnpm add @alpic-ai/insights

2. Wire it into your server

import { feedbackMiddleware } from "@alpic-ai/insights";
import { McpServer } from "skybridge/server";

const server = new McpServer({ name: "my-mcp-server", version: "1.0.0" }, { capabilities: {} })
  .mcpMiddleware(feedbackMiddleware())
  .registerTool(/* ... */);
The middleware adds a send_feedback tool to your server at runtime. It is handled entirely by the middleware, you don’t need to register it yourself.

3. How the LLM uses it

The tool instructs the LLM to:
  • Use it only for feedback about your MCP server, not about other MCP Servers.
  • Call it autonomously when it detects a genuine issue (e.g. a tool that failed unexpectedly, an unhelpful response, a missing capability) — no explicit user consent required.
  • Strip any Personally Identifiable Information from the content before sending.
The tool accepts two arguments:
ArgumentRequiredDescription
contentYesThe feedback content, stripped of any PII.
sourceYesWho initiated the feedback: "user" if the user asked to send it, "model" if sent autonomously.

4. Deploy

Deploy your application on Alpic as usual. As soon as the new version is live on the production environment, feedbacks start flowing in.

5. View feedback in the dashboard

In the Alpic dashboard, open your project and click the Insights tab, then Feedbacks. Each entry shows:
  • Content: what the feedback says
  • Source: whether it was sent by the user or the model autonomously
  • Date: when it was submitted

Optional: run a custom handler alongside Alpic

Pass a handler to run your own logic (e.g. forwarding to Slack or your own analytics) on every captured feedback. The handler runs in addition to Alpic’s dashboard delivery, feedback still appears in the Feedbacks page. The handler runs inside your MCP server process:
.mcpMiddleware(
  feedbackMiddleware({
    handler: async ({ content, source }) => {
      await slack.postMessage({ text: `Feedback [${source}]: ${content}` });
    },
  }),
)

Combining with User Intents

feedbackMiddleware and intentMiddleware are independent and can be chained together:
import { feedbackMiddleware, intentMiddleware } from "@alpic-ai/insights";

const server = new McpServer({ name: "my-mcp-server", version: "1.0.0" }, { capabilities: {} })
  .mcpMiddleware(feedbackMiddleware())
  .mcpMiddleware(intentMiddleware())
  .registerTool(/* ... */);
intentMiddleware automatically skips the send_feedback tool so it doesn’t inject a user_intent field into the feedback tool’s schema.