MCP ExplorerExplorer

Hermes Mcp

@cloudwalkon 20 days ago
171 MIT
FreeCommunity
AI Systems
#agentic-ai#elixir#mcp#mcp-server
Elixir Model Context Protocol (MCP) SDK

Overview

What is Hermes Mcp

Hermes MCP is a high-performance implementation of the Model Context Protocol (MCP) built in Elixir, designed to leverage Elixir’s concurrency and fault tolerance features.

Use cases

Use cases for Hermes MCP include interactive testing of MCP servers, managing long-running operations with progress notifications, and building robust client applications that require reliable communication.

How to use

To use Hermes MCP, add it to your dependencies in the mix.exs file. You can also install it as a standalone CLI by downloading pre-built binaries or using Mix Archive for Elixir developers.

Key features

Key features include a complete client implementation with protocol lifecycle management, multiple transport options (STDIO and HTTP/SSE), built-in connection supervision, automatic recovery, comprehensive capability negotiation, progress notification support, and a structured logging system.

Where to use

Hermes MCP can be used in various fields where high-performance communication and fault tolerance are required, such as distributed systems, microservices architectures, and real-time applications.

Content

Hermes MCP

hex.pm
docs
ci

A high-performance Model Context Protocol (MCP) implementation in Elixir.

Overview

Hermes MCP is a comprehensive Elixir SDK for the Model Context Protocol, providing complete client and server implementations with Elixir’s exceptional concurrency model and fault tolerance.

Installation

def deps do
  [
    {:hermes_mcp, "~> 0.10.3"}  # x-release-please-version
  ]
end

Quick Start

Server

# Define a server with tools capabilities
defmodule MyApp.MCPServer do
  use Hermes.Server, 
    name: "My Server", 
    version: "1.0.0", 
    capabilities: [:tools]

  def start_link(opts) do
    Hermes.Server.start_link(__MODULE__, :ok, opts)
  end

  component MyApp.MCPServer.EchoTool

  @impl true
  def init(:ok, frame), do: {:ok, frame}
end

# Define your tool
defmodule MyApp.MCPServer.EchoTool do
  @moduledoc "THis tool echoes everything the user says to the LLM"

  use Hermes.Server.Component, type: :tool

  alias Hermes.Server.Response

  schema do
    field :text, {:required, {:string, {:max, 500}}}, description: "The text to be echoed, max of 500 chars"
  end

  @impl true
  def execute(%{text: text}, frame) do
    {:reply, Response.text(Response.tool(), text), frame}
  end
end

# Add to your application supervisor
children = [
  Hermes.Server.Registry,
  {MyApp.MCPServer, transport: :stdio}
]

Client

# Define a client module
defmodule MyApp.AnthropicClient do
  use Hermes.Client,
    name: "MyApp",
    version: "1.0.0",
    protocol_version: "2024-11-05",
    capabilities: [:roots, :sampling]
end

# Add to your application supervisor
children = [
  {MyApp.AnthropicClient, 
   transport: {:stdio, command: "uvx", args: ["mcp-server-anthropic"]}}
]

# Use the client
{:ok, tools} = MyApp.AnthropicClient.list_tools()
{:ok, result} = MyApp.AnthropicClient.call_tool("search", %{query: "elixir"})

Why Hermes?

Named after Hermes, the Greek god of boundaries and communication, this library facilitates seamless interaction between Large Language Models and external tools - serving as a messenger between AI and data sources.

Documentation

For detailed guides and examples, visit the official documentation.

License

MIT License. See LICENSE for details.

Tools

No tools

Comments