Connects to a named MCP server declared in .cfconfig.json under mcpServers, using the same shape an editor's client config uses so a block can be pasted across without translation. Returns a client handle identical to the one from mcpConnect(). Resolving a name requires serve mode with a loaded configuration; in a CLI run with no configuration loaded, use mcpConnect() with an explicit command or url instead.
mcpClient( name )
→ returns any
Declare servers once in .cfconfig.json and reference them by name.
// .cfconfig.json
// {
// "mcpServers": {
// "files": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"] },
// "remote": { "url": "https://example.com/mcp" }
// }
// }
client = mcpClient( "files" );
tools = client.tools();
client.close();
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.