Skip to main content

Constructor

new Redop({
  // Identity (advertised during MCP initialize)
  name: "my-mcp-server", // machine-readable slug. Default: "redop"
  title: "My MCP Server", // human-readable display name
  version: "1.0.0", // semver string. Default: "0.1.0"
  description: "Does X and Y.",

  // Client UI
  icons: [
    {
      src: "https://example.com/icon.svg",
      mimeType: "image/svg+xml",
      sizes: ["any"],
    },
  ],
  websiteUrl: "https://example.com/docs",

  // Emitted as `instructions` at the top level of InitializeResult.
  // Surfaced to the model at session start — keep concise, it consumes context.
  instructions: "Always call search before fetch.",

  // Schema validation
  schemaAdapter, // optional — auto-detects Zod, TypeBox, Valibot
});

Main methods

  • tool(name, def) registers a tool
  • group(prefix, callback) registers prefixed tool groups
  • use(plugin) merges another Redop instance
  • middleware(fn) registers request-aware middleware
  • onTransform(fn) mutates raw params before parsing
  • onBeforeHandle(fn) observes the request before middleware/handler
  • onAfterHandle(fn) observes successful results after tool-local after
  • onError(fn) observes thrown errors
  • mapResponse(fn) maps successful results before transport output
  • listen(opts) starts the transport

Introspection

  • toolNames returns registered tool names
  • getTool(name) returns the resolved tool metadata
  • serverInfo returns the MCP server identity used during initialize

See also