Get the FREE Ultimate OpenClaw Setup Guide →

elixir_mcp_server

An example of how to implement an MCP server using Elixir and SSE transport

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio epinault-elixir_mcp_server mix run --no-halt \
  --env WEATHER_API_KEY="your_weather_api_key_here"

How to use

This MCP server is an Elixir implementation of the Model Context Protocol (MCP). It exposes an SSE-based transport for server-sent events and a message endpoint to interact with a set of built-in tools. The available tools include list_files to enumerate directory contents, echo to return a message, and get_weather to fetch weather information using the weather API key provided via WEATHER_API_KEY. To use the server, run it and connect a compliant MCP client (e.g., the MCP Inspector) via the SSE transport to discover and call the tools. The server exposes two endpoints: /sse for streaming tool capabilities and /message for direct tool invocation and responses.

How to install

Prerequisites:

  • Elixir 1.18 or higher
  • Erlang/OTP 27 or higher

Installation steps:

  1. Install dependencies

    mix deps.get
    
  2. Set required environment variables (example):

    WEATHER_API_KEY="your_weather_api_key_here" mix run --no-halt
    
  3. Start the server

    WEATHER_API_KEY="your_weather_api_key_here" mix run --no-halt
    
  4. Verify endpoints are accessible:

Note: Ensure your WEATHER_API_KEY is valid for the configured weather service (default is WeatherAPI).

Additional notes

Tips: The WEATHER_API_KEY environment variable is required for the get_weather tool. If you modify or add tools, update handle_initialize/2 accordingly and implement corresponding handle_call_tool/3 clauses. If you experience port or endpoint issues, verify your firewall settings and ensure the application binds to the default port 4000. Common issues include missing dependencies or an invalid API key for the weather service. You can test tools via the MCP Inspector client by selecting SSE as the transport and then listing and invoking available tools. If you need to customize tools, you can extend the tool definitions in the Elixir server code and reload.

Related MCP Servers

Sponsor this space

Reach thousands of developers