Documentation Index
Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt
Use this file to discover all available pages before exploring further.
Redop is the main class for building MCP servers. Use the constructor for server metadata and top-level behavior, then register tools, resources, prompts, hooks, middleware, and plugins.
Constructor
new Redop({
serverInfo: {
name: "my-mcp-server",
title: "My MCP Server",
version: "0.1.0",
description: "Does X and Y.",
websiteUrl: "https://example.com/docs",
instructions: "Always call search before fetch.",
icons: [
{
src: "https://example.com/icon.svg",
mimeType: "image/svg+xml",
},
],
},
capabilities: {
tools: true,
resources: true,
prompts: true,
},
});
Constructor options
| Option | Purpose |
|---|
serverInfo | Grouped MCP-facing metadata returned during initialize. |
capabilities | Enable or disable advertised MCP capabilities. |
serverInfo fields
| Field | Purpose |
|---|
name | Machine-readable server name. Defaults to "redop". |
title | Optional human-readable display name. |
version | Version returned during initialize. Defaults to "0.1.0". |
description | Short server description for supporting client UIs. |
icons | Optional icon metadata from the MCP implementation schema. |
websiteUrl | Optional canonical site or docs URL. |
instructions | Optional usage guidance returned as top-level initialize.instructions. |
Icon shape
icons accepts an array of objects with this shape:
{
src: "https://example.com/icon.svg",
mimeType: "image/svg+xml",
sizes: ["any"],
theme: "light",
}
Notes:
src is required and should usually be an https: URL or data: URI.
mimeType is optional, but common values are image/png, image/jpeg, image/jpg, image/svg+xml, and image/webp.
sizes supports values like ["48x48"], ["48x48", "96x96"], or ["any"] for scalable icons.
theme can be "light" or "dark".
- Clients should treat icon URLs and bytes as untrusted input and apply normal fetch/render safety checks.
Deprecated top-level fields
Redop still accepts top-level name, title, version, description, icons, websiteUrl, and instructions, but they are deprecated. Put new docs and new app code under serverInfo.
Main methods
| Method | Purpose |
|---|
tool(name, def) | Register an MCP tool. |
resource(uri, def) | Register a static or template resource. |
prompt(name, def) | Register an MCP prompt. |
derive(fn) | Add reusable request context before hooks and handlers run. |
use(plugin) | Merge another Redop instance as a feature module or plugin. |
middleware(fn) | Register global middleware. |
onTransform(fn) | Mutate raw params before schema parsing. |
onParse(fn) | Replace parsed input before before-hooks and middleware. |
onBeforeHandle(fn) | Observe each tool, resource, or prompt request before middleware and handlers. |
onAfterHandle(fn) | Observe successful results after local after hooks and before the response is written. |
onAfterResponse(fn) | Observe tool, resource, and prompt executions after the response is written. |
onError(fn) | Observe thrown errors from middleware or handlers. |
notifyResourceChanged(uri) | Push resources/updated notifications to subscribed clients. |
listen() / listen(3000) / listen(opts) | Start the HTTP or stdio transport. |
Introspection
toolNames returns registered tool names
resourceUris returns registered resource URIs
promptNames returns registered prompt names
getTool(name) returns the resolved tool metadata
getResource(uri) returns the resolved resource metadata
getPrompt(name) returns the resolved prompt metadata
serverInfo returns the MCP server identity used during initialize
Composition pattern
Use .use(...) as the main way to compose a larger server.
In practice, that usually means:
- create one
Redop instance per feature folder
- register that feature’s tools, resources, prompts, hooks, or middleware there
- import those modules into the root server
- attach them with
.use(...)
Related pages