Skip to main content

Installation

npm install writeback-sdk

Usage

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { attach } from 'writeback-sdk';

const server = new McpServer({ name: 'my-server', version: '1.0.0' });

// Add your tools here...

// Attach writeback — adds report_feedback tool automatically
attach(server, { ingestKey: 'wk_your_ingest_key' });
Call attach after creating your server instance and after registering your other tools. The report_feedback tool will appear alongside them.

What it does

attach registers a single tool called report_feedback on your MCP server. When an agent calls it, the report is submitted to your writeback dashboard. The tool accepts these parameters:
ParameterTypeRequiredDescription
outcomestringYesOne of: success, failure, confusing, gave_up, request
detailsstringYesWhat the agent tried and what happened
tool_namestringNoThe specific tool being reported on
sourcestringNoDefaults to your server name

Options

attach(server, {
  ingestKey: 'wk_your_ingest_key', // required
  source: 'my-mcp-server',          // optional — defaults to server name
});

Getting an ingest key

Sign up at dashboard.writeback.dev and create a project. Your ingest key is write-only — safe to hardcode or include in environment variables.
attach(server, {
  ingestKey: process.env.WRITEBACK_INGEST_KEY!,
});