I created a MCP server for Hex package versions

I am currently giving Cursor another try to code Elixir apps. Although I am quite happy with how it evolved, I kept getting annoyed by the agent adding outdated packages, which I manually had to set to the latest version from hex.pm.

To solve this, I wrote a tiny MCP server, which allows the editor to retrieve the correct versions before adding packages to the project, and it works quite well:

If you have the same issue and want to give it a try, I deployed it to fly: https://hex-mcp.9elements.com/

Be sure to activate agent mode; at least for me, Cursor seems to ignore this function when in normal chat or composer mode.

13 Likes

This is great. Has me thinking about building an MCP that grabs the full Ecto schema and Elixir types so that cursor is more aware of the type system.

2 Likes

Hmm, not exactly sure what you mean - Grab it just from the files in the project?

If yes, did you try to add specific cursor rules to do this, or increase the allowed context size (although this consumes more premium requests)?

Or do you want to provide this info in a different way / directly from the DB?

One of the reasons Cursor is amazing with TypeScript is the editor itself is typesmart, making the feedback cycle quick.

What I want is Cursor to be aware of is the specific Ecto schemas and their relationships, not just general Cursor rules.

I haven’t had a chance to try this yet but something like this, which would be injected into the Composer chat:

https://www.perplexity.ai/search/which-function-can-i-run-to-se-qM433VKGS7q0ujxwolA1Tg

It would be interesting to see if this would work better than Cursor just checking the code by itself. I am quite happy with how Cursor understands my schema and validations, but this might be due to the ‘Large context’ setting I have enabled, so it might just take more of the schema files into account.

Having an MCP running could, of course, guide the chat/composer; would be worth a try.

1 Like

This is a great help when I am trying to write Elixir code using LLM. I am wondering how hard it would be to write MCP client in Elixir? Either from scratch or wrap another Rust crate (crates.io: Rust Package Registry) using Rustler?

I did not try, but during the discussion of my post on social media, zoedsoupe mentioned their project, which seems to be an Elixir library for building both server and client MCP apps, might be worth a look:

Just to be clear, this is not the package I have built my server on, I used:

https://hexdocs.pm/mcp_sse/

3 Likes

I am experimenting with local MCP server fed with PDF books I own, like Sasa Juric’s Elixir in Action and others. The idea is plug them into editor and use them in a sort of RAG fashion. I’m mostly using Windsurf with Sonnet 3.7 these days.

Anyone else and more experienced running similar setup? I’m still in trial & error stage, so looking for inspiration and trying to avoid reinventing the wheel.

1 Like

@josefrichter I have had exactly this thought.

What are you using for RAG?

I think given that elixir is not as popular as react/js/python, some extra documentation may help. Giving the AI RAG access to locally stored books and HEX Documentation for packages should help it with accuracy.

I am also using Windsurf, and from what I can see, it only supports STDIO MCP.

I think extending one of the Elixir MCP libs to do STDIO would be a good first step. hermes-mcp seems to have STDIO transport as a client so maybe a good starting place to try to add on that?

The other thing is elixir has the great language server, with really good compile time errors and ideally any errors after an AI save should be fed back in as soon as it saves the file.