PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

EMCP - A Model Context Protocol (MCP) Server for Elixir

Hey folks!

I built (yet another) MCP server implementation in Elixir yesterday: EMCP

I wanted to have something super simple that I can easily maintain and bugfix. It uses the official modelcontextprotocol/ruby-sdk library as inspiration and runs in a Plug, so it reuses Bandit’s/Cowboy’s connection handling for keeping the SSE connections alive (I think that’s the same way AnubisMCP, LiveView, and WebSockets do it)

Feedback is very welcome! I’m using this in production, but haven’t load tested it yet.

https://github.com/PJUllrich/emcp

Most Liked

PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

Tiny update: The EMCP server now supports Prompts, Resources, and ResourceTemplates . You probably won’t use them because e.g. Claude Code doesn’t expose these functions to you, only Tools. Still, with these new features in place, the MCP server is now feature-complete :partying_face:

PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

Release v0.3.1 and v0.3.2

I added three new configuration options to the StreamableHTTP plug:

  1. allowed_origins + validate_origin
    • This allows you to restrict MCP calls to certain domains. CLI clients don’t send the Origin header though, so shouldn’t be affected.
  2. recreate_missing_session
    • EMCP recreates expired or unknown sessions by default. This is a trade-off to UX which I’ve motivated further in the Readme. It is not spec-compliant though, so if you want to run in “strict” mode and reject unknown sessions or force clients to re-initialize a session if it expires, you can now do so by adding recreate_missing_session: false to your plug.

See the Changelog here
https://github.com/PJUllrich/emcp/blob/main/CHANGELOG.md

And documentation of these configurations here
https://github.com/PJUllrich/emcp?tab=readme-ov-file#origin-validation

engineeringdept

engineeringdept

This is great! Thanks for building it. It’s a much nicer, simpler implementation than other libraries I’ve seen and looks like it will be easy to extend and maintain. A couple of thoughts for feedback:

  1. A pluggable session store would be great - many Elixir deployments can’t use clustering, so can’t rely on ETS.
  2. It would be nice to have all the config for the server in its own module, rather than global config. This would allow multiple MCP servers to coexist, for example. Perhaps it could use the Ecto Repo pattern of use EMCP.Server, tools: [...] ?

(I might even get a chance to submit a PR for these…)

Where Next?

Popular in Announcing Top

sasajuric
I’d like to announce a small library called boundaries. This is an experimental project which explores the idea of enforcing boundaries ...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
Crowdhailer
The latest release of Ace (0.10.0) includes serving content over HTTP/2. I have started writing a webserver to teach my self more about...
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 10858 107
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement