Whatever message this page gives is out now! Go check it out!
onApplicationStart() in Application.cfconApplicationStart().cfm) or per-session logic; that will lead to repeated setup work and inconsistent state.
// Application.cfc (simplified)
component {
this.name = "MyMCPApp";
this.applicationTimeout = createTimeSpan(0, 2, 0, 0);
function onApplicationStart() {
initMcpServer();
return true;
}
private void function initMcpServer() {
// Define resources, prompts, tools, etc.
var resources = [
{
uri: "file:///var/app/logs/app.log",
name: "Application Logs",
mimeType: "text/plain"
}
];
application.mcpServer = mcpServerBuilder()
.serverInfo("my-server", "1.0.0")
.capabilities({
tools : true,
prompts : true,
resources : true
})
.tools([
{ cfc: "mcp.tools.HealthcheckTools" },
{ cfc: "mcp.tools.ReportingTools" }
])
.prompts([
{ name: "explain_error", template: "Explain this error: {{message}}" }
])
.resources(resources)
.cfcCaching(true)
.build();
}
}
tools: true if you expose tools/list and tools/callprompts: true if you expose prompts/list / prompts/getresources: true if you expose resources/list / resources/read
private void function initMcpServer() {
try {
// ... as above
application.mcpServer = mcpServerBuilder()
// config...
.build();
} catch (any e) {
// Log and rethrow or mark application as unhealthy
writeLog(
file = "mcp",
type = "error",
text = "MCP server initialization failed: #e.message# #e.detail#"
);
// Optional: rethrow or set a flag
application.mcpServerInitError = e;
}
}
application.mcpServer (or an error flag) before attempting to use the server.