epinault_elixir_mcp_server

epinault_elixir_mcp_server

by epinault
An MCP server implementation using Elixir and Server-Sent Events (SSE) for secure AI model interactions.

Elixir Implementation of Model Context Protocol Server

Overview

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.

Prerequisites

Before getting started, ensure you have the following installed:

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

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.

Getting Started

  1. Install dependencies:

bash mix deps.get

  1. Start the server:

bash WEATHER_API_KEY="1234567890abcdef" mix run --no-halt

  1. Access the server:

  2. SSE endpoint: http://localhost:4000/sse

  3. Message endpoint: http://localhost:4000/message

Available Tools

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.

Testing with MCP Client

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.

Adding Custom Tools

To add custom tools, update the handle_initialize/2 function to include your tool definitions and implement corresponding handle_call_tool/3 clauses.

About

This project is an example of how to implement an MCP server using Elixir and SSE transport.

Resources

License

Code of Conduct

Activity

Report repository

Releases

No releases published.

Packages

No packages published.

Languages

  • Elixir 100.0%

Features & Capabilities

Categories
mcp_server model_context_protocol elixir sse bandit plug api_integration

Implementation Details

Stats

0 Views
0 Likes
3 GitHub Stars

Repository Info

epinault Organization

Similar Servers

continuedev_continue by continuedev
0
0
0

Recently Viewed