pjullrich/emcp
Changelog
v0.3.2
Enhancements
- Added
recreate_missing_sessionoption toEMCP.Transport.StreamableHTTP. When set tofalse, the transport returns404for unknown or expired session IDs instead of silently re-creating them. Defaults totrue(existing behaviour).
v0.3.1
Enhancements
- Added origin validation to
EMCP.Transport.StreamableHTTPto prevent DNS rebinding attacks. Enable it withvalidate_origin: trueand configureallowed_originsin the plug opts. It's disabled by default.
v0.3.0
Breaking Changes
-
Replaced global
:emcpapplication config with ause EMCP.Servermacro. Instead of configuring the server inconfig.exs, define a server module:# Before (no longer supported)config :emcp,name: "my-server",version: "1.0",tools: [MyApp.Tools.Echo]# Afterdefmodule MyApp.MCPServer douse EMCP.Server,name: "my-server",version: "1.0",tools: [MyApp.Tools.Echo]end -
Transports now require a
:serveroption pointing to the server module:# HTTPplug EMCP.Transport.StreamableHTTP, server: MyApp.MCPServer# STDIOEMCP.Transport.STDIO.start_link(server: MyApp.MCPServer) -
connis now passed as the first parameter to all behaviour callbacks that handle requests:EMCP.Tool.call/1is nowcall(conn, args)EMCP.Prompt.template/1is nowtemplate(conn, args)EMCP.Resource.read/0is nowread(conn)EMCP.ResourceTemplate.read/1is nowread(conn, uri)EMCP.Server.handle_message/2is nowhandle_message(server, conn, request)
The
connis thePlug.Connstruct when using the HTTP transport, ornilwhen using STDIO. -
EMCP.SessionStoreis now a behaviour. The ETS implementation has moved toEMCP.SessionStore.ETS. Custom backends (e.g. Redis) can be used by implementing theEMCP.SessionStorebehaviour and passing it viause EMCP.Server:defmodule MyApp.MCPServer douse EMCP.Server,name: "my-server",version: "1.0",session_store: MyApp.SessionStore.RedisendThe default is
EMCP.SessionStore.ETS. -
EMCP.Transport.StreamableHTTP.notify/2is nownotify(store, session_id, message). -
EMCP.Transport.StreamableHTTP.broadcast/1is nowbroadcast(store, message). -
Added
EMCP.Sessionstruct withid,last_seen, andpidfields, replacing raw tuples. -
EMCP.Server.new/0has been removed. UseEMCP.Server.new/1or the generatedMyApp.MCPServer.server/0instead.