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.
Trending in Announcing
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly.
One of i...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Hello,
I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself.
I use Claude Code daily on a pr...
New
Other Trending Topics
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










First 10 of 12 Posts
PJUllrich
Tiny update: The EMCP server now supports
Prompts,Resources, andResourceTemplates. You probably won’t use them because e.g. Claude Code doesn’t expose these functions to you, onlyTools. Still, with these new features in place, the MCP server is now feature-completeengineeringdept
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:
use EMCP.Server, tools: [...]?(I might even get a chance to submit a PR for these…)
PJUllrich
Certainly!
engineeringdept
We use Redis for session storage in our Phoenix app. I’m imagining the library continues to use ETS out of the box, but there’s a defined behaviour that we can implement and swap in, or contribute to the project.
I was also wondering if you had any thoughts about accessing session/connection information in a tool, such as letting an upstream plug assign a user from an auth header, which is then made available to a tool call?
PJUllrich
Ah okay, yes that shouldn’t be too hard to make the session store a behaviour
And for the tools, I could pass the conn into the tool. That way you can assign the user upstream based on e.g. an api key header and reuse it in the tool. How does that sound?
engineeringdept
Yeah, I think that’d be great!
jstimps
Candidly, I would expect the session to have an open-ended (user defined) state that would be passed to the tool. If I choose to assign the Conn to the session state then I would have it available. But passing in the Conn explicitly to the tool would be a bit awkward IMO.
I’m thinking of session state as being similar to GenServer state and the tool call being similar to a handle_call. This is an approach we’ve taken in a proprietary MCP server library and it’s worked well.
BTW, it’s great that you’ve published this. I think it fills a gap in the ecosystem because Tidewave is designed for a specific purpose and Anubis was a steep learning curve for me. Kudos and I wish you luck. I hope to become a user of EMCP one day when the need arises.
PJUllrich
Release v0.3.0
I implemented your feedback and made a bunch of breaking changes, so please read the Changelog when updating.
In essence, these are the changes:
use EMCP.Server, config_here)conninto all Tool/Prompt/Resource/ResourceTemplate callbacks.current_userand use it in the ToolEMCP.SessionStore.ETSby default but you can replace it with your own strategies. Just implement theEMCP.SessionStorebehaviour.Store1,Store2) and pass them to each server withsession_store: Store1andsession_store: Store2Please let me know what you think! I’m slowly converging on a stable API, but I’m using EMCP for pretty simple use-cases, so if your edge case isn’t supported (well), please let me know!
SyntaxSorcerer
Looks interesting. How does this compare to Ash Framework’s UsageRules and Tidewave MCP?
Edit to add: I’m using UsageRules and Tidewave now and want to be sure of where EMCP would fit into my workflow before implementing it.
According to Claude Code:
This sounds interesting but I’d also be curious about context window hit. My understanding is that in many cases skills can be better than MCP because skills generally require less context/fewer tokens to use.
Keen to get some folks’ thoughts on this and potential trade-offs. Thanks!
PJUllrich
Basically, you can think of the (E)MCP server as a loose API for your LLM. The Tidewave MCP for example uses it to get your logs or fetch files from your codebase. But AFAIK you can’t extend it. With EMCP you can write these Tools (API endpoints) yourself. So, think API endpoint but specifically for LLMs.