Elixir MCP Server logo

Elixir MCP Server

by epinault

An Elixir implementation of the Model Context Protocol (MCP) server using Elixir with Bandit and Plug. It's a basic example of an MCP server using SSE (Server-Sent Events) as the transport protocol.

View on GitHub

Last updated: N/A

What is Elixir MCP Server?

This is an Elixir implementation of a Model Context Protocol (MCP) server. MCP is an open protocol that enables AI models to securely interact with local and remote resources through standardized server implementations. This server uses SSE as the transport protocol.

How to use Elixir MCP Server?

  1. Install dependencies using mix deps.get. 2. Start the server using WEATHER_API_KEY="1234567890abcdef" mix run --no-halt. 3. Connect to the server's SSE endpoint (http://localhost:4000/sse) or Message endpoint (http://localhost:4000/message) using an MCP client like NXP Inspector.

Key features of Elixir MCP Server

  • Implements the Model Context Protocol

  • Uses Elixir with Bandit and Plug

  • Supports Server-Sent Events (SSE)

  • Provides example tools like list_files, echo, and get_weather

  • Extensible with custom tools

Use cases of Elixir MCP Server

  • Enabling AI models to securely access local files

  • Allowing AI models to interact with external APIs (e.g., weather API)

  • Providing a standardized interface for AI models to access resources

  • Building custom tools for AI model interaction

  • Creating a secure environment for AI model execution

FAQ from Elixir MCP Server

What is the Model Context Protocol (MCP)?

MCP is an open protocol that enables AI models to securely interact with local and remote resources through standardized server implementations.

What is SSE?

SSE stands for Server-Sent Events. It's a transport protocol used for sending real-time updates from a server to a client.

How do I add custom tools?

Update the handle_initialize/2 function to include your tool definitions and implement corresponding handle_call_tool/3 clauses.

What are the prerequisites for running this server?

Elixir 1.18 or higher and Erlang/OTP 27 or higher.

Where can I find an MCP client to test this server?

You can use the NXP Inspector client, available at https://modelcontextprotocol.io/docs/tools/inspector#inspector