Qore json Module 1.11.0
Loading...
Searching...
No Matches
McpClient Module

Introduction to the McpClient Module

The McpClient module provides a client implementation for the Model Context Protocol (MCP), allowing Qore applications to connect to MCP servers and interact with tools, resources, and prompts.

The module supports all MCP protocol versions:

  • 2024-11-05 (initial version)
  • 2025-03-26 (March 2025)
  • 2025-06-18 (June 2025 - Enterprise readiness)
  • 2025-11-25 (November 2025 - Tasks, Extensions)

Features

  • Full MCP protocol support with automatic version negotiation
  • Streamable HTTP transport with legacy HTTP + SSE fallback
  • Streamable HTTP GET listener for notifications (enabled by default; legacy SSE fallback)
  • Tools: list and call server tools
  • Resources: list and read server resources
  • Prompts: list and get server prompts with arguments
  • Completion: autocompletion for prompts and resources
  • Logging: receive server log messages
  • Event callbacks for server notifications
  • Session management with Mcp-Session-Id header

Basic Usage

%requires McpClient
# Create client
McpClient client("http://localhost:8080/mcp");
# Initialize connection
hash<auto> server_info = client.initialize({
"name": "MyApp",
"version": "1.0",
});
# List and call tools
list<auto> tools = client.listTools();
hash<auto> result = client.callTool("echo", {"message": "Hello"});
# List and read resources
list<auto> resources = client.listResources();
hash<auto> content = client.readResource("file:///config.json");
# List and get prompts
list<auto> prompts = client.listPrompts();
hash<auto> messages = client.getPrompt("greeting", {"name": "Alice"});
# Close connection
client.close();
the McpClient namespace holds all public definitions in the McpClient module
Definition McpClient.qc.dox.h:2

McpClient Release Notes

McpClient v1.0

  • initial release with full MCP protocol support
  • HTTP + SSE transport
  • tools, resources, prompts, completion support
  • event callbacks for notifications