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

handleRequest

Last update:
May 18, 2026
Initializes the MCP server by reading an incoming JSON-RPC request, forwarding it to the MCP server instance, and writing the serialized response as an HTTP response.

Description

The handleRequest function helps initialize the MCP server. You can only use this function in a CFM, not a CFC. The function:
  1. Reads the incoming JSON-RPC request for MCP (from getHttpRequestData().content or similar).
  2. Forwards the request struct to your MCP server instance (created via MCPServer(config)) to be handled.
  3. Serializes the MCP server's response back to the client and writes it as an HTTP response with application/json content type.
It effectively glues your ColdFusion HTTP endpoint to the MCP server object so external MCP clients (Cursor, Claude Desktop, other CF apps) can call initialize, tools/list, tools/call, prompts/get, resources/read, etc. over HTTP.

Returns

Void

Syntax

handleRequest()
For example:
handleRequest() access="remote" returntype="void" output="false"
handleRequest is implemented in the same file or via a reusable function in a shared CFC.

History

New in ColdFusion 2025.0.08

Parameters

None

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