EMCP
A Model Context Protocol (MCP) Server for Elixir
What is EMCP?
EMCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server for elixir
A Model Context Protocol (MCP) Server for Elixir
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol (MCP) Server for Elixir
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx emcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use EMCP
EMCP is an Elixir library that lets you build MCP servers natively inside Phoenix applications, exposing tools, prompts, and resources to AI clients over a StreamableHTTP or STDIO transport. It integrates with Phoenix Router's forward macro, uses ETS for session management, and supports origin validation for production deployments. Elixir developers use it to make their Phoenix application's business logic directly accessible to Claude and other MCP-compatible AI assistants without writing a separate sidecar process.
Prerequisites
- Elixir 1.15 or later and the Mix build tool
- An existing Phoenix application (or a new one created with 'mix phx.new')
- The EMCP hex package added as a dependency in mix.exs
- An MCP client such as Claude Desktop or Claude Code
Add EMCP to your mix.exs dependencies
Add the emcp package to your project's dependency list. Check hex.pm/packages/emcp for the current version number.
# In mix.exs deps:
{:emcp, "~> 0.1"}Fetch dependencies
Download and compile the EMCP library and its transitive dependencies.
mix deps.getInitialize the session store
Add the ETS session store initialization to your application's start/2 function in lib/my_app/application.ex so sessions persist across requests.
def start(_type, _args) do
EMCP.SessionStore.ETS.init()
# ... rest of your supervision tree
endDefine an MCP server module
Create a module that uses EMCP.Server and declares which tools, prompts, and resources it exposes. Each tool, prompt, and resource is its own module implementing the relevant behaviour.
defmodule MyApp.MCPServer do
use EMCP.Server,
name: "my-app",
version: "1.0.0",
tools: [MyApp.Tools.Echo],
prompts: [MyApp.Prompts.CodeReview],
resources: [MyApp.Resources.Readme]
endMount the transport in your Phoenix router
Add the StreamableHTTP transport outside any pipeline scope so it handles MCP JSON-RPC requests at the /mcp path.
scope "/mcp" do
forward "/", EMCP.Transport.StreamableHTTP, server: MyApp.MCPServer
endConfigure your MCP client
For Claude Code, add the server to .claude/settings.json using the mix run command. For Claude Desktop with a running Phoenix server, use an HTTP transport URL pointing at the /mcp endpoint.
{
"mcpServers": {
"my-app": {
"command": "mix",
"args": ["run", "--no-halt"],
"cwd": "/path/to/your/elixir/project"
}
}
}EMCP Examples
Client configuration
Claude Code configuration that starts your Phoenix app as an MCP server via Mix. For a running web server, use an HTTP transport URL (e.g. http://localhost:4000/mcp) in Claude Desktop instead.
{
"mcpServers": {
"my-app": {
"command": "mix",
"args": ["run", "--no-halt"],
"cwd": "/path/to/your/elixir/project"
}
}
}Prompts to try
Once your Elixir application exposes tools via EMCP, Claude can call them by name through natural language.
- "Call the echo tool with the message 'hello from Claude'"
- "Use the code_review prompt to review this function with focus on performance"
- "List all available tools in the my-app MCP server"
- "Fetch the Readme resource from the server"
- "Call the user_profile resource template for user id 42"Troubleshooting EMCP
MCP client cannot connect — connection refused on the /mcp endpoint
Ensure your Phoenix server is running ('mix phx.server') and that the forward route is mounted outside any authenticated pipeline scope. Check that the port in your client config matches the Phoenix server port (default 4000).
Session errors — 'session not found' when calling tools
Confirm that EMCP.SessionStore.ETS.init() is called in your application's start/2 function before the supervision tree starts. If you set recreate_missing_session to false in the transport config, expired sessions will not be auto-recreated — either set it back to true (the default) or handle re-initialization in your client.
Origin validation rejecting requests in development
The validate_origin option defaults to false. If you enabled it, add your development origin (e.g. 'localhost:4000') to the allowed_origins list in the transport configuration. In production, use bare domain names or full URLs matching the client's Origin header.
Frequently Asked Questions about EMCP
What is EMCP?
EMCP is a Model Context Protocol (MCP) server that model context protocol (mcp) server for elixir It connects AI assistants to external tools and data sources through a standardized interface.
How do I install EMCP?
Follow the installation instructions on the EMCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with EMCP?
EMCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is EMCP free to use?
Yes, EMCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
EMCP Alternatives — Similar Developer Tools Servers
Looking for alternatives to EMCP? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up EMCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use EMCP?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.