MCP ExplorerExplorer

Mcp Ex

@masegrayeon 20 days ago
1 MIT
FreeCommunity
AI Systems
MCPEx is an Elixir client for the Model Context Protocol with multiple transport options.

Overview

What is Mcp Ex

mcp_ex is an Elixir client designed for the Model Context Protocol (MCP), enabling communication and interaction with MCP servers.

Use cases

Use cases for mcp_ex include listing and reading resources from an MCP server, invoking tools for specific tasks, and integrating with shell environments for enhanced functionality.

How to use

To use mcp_ex, add it to your dependencies in mix.exs, then create a client instance using either stdio or HTTP transport to interact with an MCP server.

Key features

Key features include full MCP protocol implementation, multiple transport options (stdio, HTTP), resource handling with subscriptions, tool invocation support, prompt template handling, shell environment integration, and support for advertising sampling and roots capabilities.

Where to use

mcp_ex can be used in various fields such as software development, data processing, and any applications requiring interaction with MCP servers.

Content

MCPEx

An Elixir client for the Model Context Protocol (MCP).

Installation

If available in Hex, the package can be installed
by adding mcp_ex to your list of dependencies in mix.exs:

def deps do
  [
    {:mcp_ex, "~> 0.1.0"}
  ]
end

Features

  • Full MCP protocol implementation (version 2025-03-26)
  • Multiple transport options (stdio, HTTP)
  • Resource handling with subscriptions
  • Tool invocation support
  • Prompt template handling
  • Shell environment integration
  • Support for advertising sampling and roots capabilities (note: handlers for these capabilities are not yet implemented)

Usage

# Create a new client connected to a server via stdio
{:ok, client} = MCPEx.Client.start_link(
  transport: :stdio,
  command: "/path/to/server",
  capabilities: []
)

# Or with HTTP transport
{:ok, client} = MCPEx.Client.start_link(
  transport: :http,
  url: "https://example.com/mcp",
  capabilities: []
)

# List available resources
{:ok, %{resources: resources}} = MCPEx.Client.list_resources(client)

# Read a specific resource
{:ok, %{contents: contents}} = MCPEx.Client.read_resource(client, "file:///path/to/resource")

# Call a tool
{:ok, result} = MCPEx.Client.call_tool(client, "get_weather", %{location: "New York"})

Documentation can be generated with ExDoc.

Tools

No tools

Comments