The Elixir MCP Server is an implementation of the Model Context Protocol (MCP) using Elixir, Bandit, and Plug. MCP is an open protocol that allows AI models to securely interact with local and remote resources through standardized server implementations. This project serves as a basic example of an MCP server using Server-Sent Events (SSE) as the transport protocol.
Before getting started, ensure you have the following installed:
Additionally, you'll need a weather API key, which can be set via the WEATHER_API_KEY
environment variable. The default service uses the free tier of WeatherAPI.
bash
mix deps.get
bash
WEATHER_API_KEY="1234567890abcdef" mix run --no-halt
Access the server:
SSE endpoint: http://localhost:4000/sse
The server comes with the following built-in tools:
list_files
: Lists files in a directory.echo
: Echoes a message back.get_weather
: Retrieves weather information.To test the server, install the NXP Inspector client and follow the instructions to connect to the server. Use SSE as the transport protocol to list available tools and call them. You can also use the ping
tool to keep the connection alive.
To add custom tools, update the handle_initialize/2
function to include your tool definitions and implement corresponding handle_call_tool/3
clauses.
This project is an example of how to implement an MCP server using Elixir and SSE transport.
No releases published.
No packages published.