Skip to content

masegraye/mcp_ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published