Whatever message this page gives is out now! Go check it out!

MCPServer

Last update:
May 18, 2026
Creates and initializes a ColdFusion-based MCP server from a configuration struct, exposing CFML tools, prompts, and resources via the Model Context Protocol.

Description

The MCPServer(config) function creates and initializes a ColdFusion-based MCP server from a configuration struct. This server exposes CFML tools (CFC methods), prompts (templates), and resources (data like files or documents) via the Model Context Protocol (MCP) so that MCP clients (e.g., ColdFusion apps, Cursor, Claude Desktop) can call them using standard MCP methods like tools/list, tools/call, prompts/get, and resources/read.

Returns

Any
The returned object represents the MCP server and can normally be:
  • Stored in application scope (for example, application.mcpServer) so it can serve JSON-RPC requests.
  • Used internally by your HTTP or STDIO entry points to handle incoming MCP calls (initialize, tools/list, tools/call, prompts/list, resources/read, etc.).

Syntax

MCPServer(struct config)
Called in CFML as:
mcpServer = MCPServer(config);

History

New in ColdFusion 2025.0.08

Parameters

MCPServer configuration struct fields
FieldData typeRequiredDescription
serverInfoStructYes
Identifies the MCP server.
serverInfo = {
  name : "CCF_MCP_Server",
  version : "1.0"
};
  • name: human-readable name of the MCP server.
  • version: the version of the MCP server.
capabilitiesStructYes
Declares what the MCP server supports (tools, prompts, resources, logging, etc.).
capabilities = {
  tools : true,
  prompts : true,
  resources : true
};
  • tools: whether this server exposes tools.
  • prompts: whether it exposes prompts.
  • resources: whether it exposes resources.
  • serverInfo: nested server info, depending on implementation.
toolsArray of structsNo
Lists the CFCs that implement MCP tools. Each entry describes a CF component that contains one or more public functions to be exposed as tools.
tools = [
  { cfc : "mcp.tools.WeatherTools" },
  { cfc : "mcp.tools.HealthcareTools" }
];
  • cfc: the fully-qualified or relative CFC name (path resolvable via CF mappings).
promptsArray of structsNo
Defines prompts that the server exposes for prompts/list and prompts/get.
prompts = [
  {
    name : "generate_discharge_summary",
    title : "Discharge Summary",
    description : "Generate a patient discharge summary.",
    arguments : [ { name : "patientName", required : true } ],
    template : "Generate a detailed discharge summary for patient {patientName}."
  }
];
  • name: prompt name (used in prompts/get).
  • title: user-facing title of all prompts.
  • description: what the prompt does.
  • arguments: array of { name, required } or richer schema.
  • template: prompt text with placeholders (e.g., {patientName}).
resourcesArray of structsNo
Defines resources the MCP server exposes via resources/list and resources/read.
resources = [
  {
    uri : "healthcare://patientdata/P001/ct-scan",
    name : "ct_scan",
    title : "CT Scan - P001",
    description : "Chest CT scan for patient P001",
    mimeType : "application/pdf",
    readResourceHandler = function(req) {
      return fileReadBinary(expandPath("/data/ctscan-P001.pdf"));
    }
  }
];
  • uri: resource identifier (custom scheme or file://).
  • name: short name.
  • title: human-friendly title.
  • description: description.
  • mimeType: MIME type (application/pdf, text/plain, etc.).
  • readResourceHandler: CF function called to produce the content when resources/read is invoked.
cfcCachingBooleanNo
Controls whether CFCs used for tools are cached for performance.
cfcCaching = true
  • true: reuse CFC instances instead of re-instantiating for each call.
  • false: instantiate fresh CFCs per call (slower, but can be useful for debugging or if you need truly stateless behavior).

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page