Skip to main content
ExuluMCP is a class that mounts Model Context Protocol (MCP) endpoints on an Express application. It turns each IMP agent’s enabled tools into MCP-registered tools, so external MCP clients (Claude Desktop, custom clients, etc.) can call those tools via the standard MCP Streamable HTTP transport. ExuluMCP is used internally by ExuluApp — you do not need to instantiate it directly unless you are building a custom server that manages Express yourself.

Constructor

Creates an ExuluMCP instance. No configuration required at construction time; the MCP server for each agent is created lazily on the first request.

API surface

create

Mounts MCP route handlers on the provided Express application and returns it. The handler is at /mcp/:agent, where :agent is the agent’s ID.
express
Express
required
An initialized Express application.
allTools
ExuluTool[]
required
All registered tools. The handler filters to the agent’s enabled tools at request time.
allProviders
ExuluProvider[]
required
All registered providers. Used to resolve the agent’s model.
allContexts
ExuluContext[]
required
All registered contexts. Used to resolve context-bound tools.
config
ExuluConfig
required
The application config from ExuluApp.
return
Promise<Express>
The same Express instance with MCP routes added.

Endpoints

After create is called, three routes are active: Sessions are tracked by the mcp-session-id header. On the first POST without a session ID (an initialize request), a new session is created and the ID is returned in the response header.

Authentication and access control

Every request to /mcp/:agent is authenticated using the standard IMP authentication stack (API key or session token). Access to the agent is then verified with checkRecordAccess. Unauthenticated or unauthorized requests receive 401 / 404 before any MCP processing occurs.

Built-in prompt tools

In addition to the agent’s enabled tools, two tools are registered on every MCP server:
  • getListOfPromptTemplates — lists prompt templates assigned to the agent (id, name, description).
  • getPromptTemplateDetails — retrieves the full content and metadata of a specific template by ID.

Example

Enable MCP by setting MCP.enabled: true in your config when calling app.create(...). ExuluApp mounts the MCP routes automatically — no direct instantiation of ExuluMCP required.
Once the server is running, MCP endpoints are available at: An MCP client connecting to this server would use the URL: