Files
herolib/lib/mcp
2025-03-31 21:22:05 +02:00
..
...
2025-03-31 21:22:05 +02:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-12 16:36:17 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
2025-03-21 03:26:26 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-31 09:32:58 +02:00
...
2025-03-24 06:44:39 +01:00
...
2025-03-24 06:44:39 +01:00

Model Context Protocol (MCP) Implementation

This module provides a V language implementation of the Model Context Protocol (MCP) specification. MCP is a protocol designed to standardize communication between AI models and their context providers.

Overview

The MCP module implements a server that communicates using the Standard Input/Output (stdio) transport as described in the MCP transport specification. This allows for standardized communication between AI models and tools or applications that provide context to these models.

Key Components

  • Server: The main MCP server struct that handles JSON-RPC requests and responses
  • Model Configuration: Structures representing client and server capabilities according to the MCP specification
  • Handlers: Implementation of MCP protocol handlers, including initialization
  • Factory: Functions to create and configure an MCP server

Features

  • Full implementation of the MCP protocol version 2024-11-05
  • JSON-RPC based communication
  • Support for client-server capability negotiation
  • Logging capabilities
  • Resource management

Usage

To create a new MCP server:

import freeflowuniverse.herolib.schemas.jsonrpc
import freeflowuniverse.herolib.mcp

// Define custom handlers if needed
handlers := {
    'custom_method': my_custom_handler
}

// Create server configuration
config := mcp.ServerConfiguration{
    // Configure server capabilities as needed
}

// Create and start the server
mut server := mcp.new_server(handlers, config)!
server.start()!