Skip to content

Commit 965f801

Browse files
hashrocketeervnegrisoloGabriel Reis
committed
Fix MCP server mime types
Co-authored-by: Vinicius Negrisolo <vinicius.negrisolo@hashrocket.com> Co-authored-by: Gabriel Reis <gabriel.reis@hashrocket.com>
1 parent 7ee1650 commit 965f801

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

config/config.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ config :tilex, Tilex.Notifications.Notifiers.Twitter,
117117
token: System.get_env("twitter_access_token"),
118118
token_secret: System.get_env("twitter_access_token_secret")
119119

120+
config :mime, :types, %{
121+
"text/event-stream" => ["stream"]
122+
}
123+
120124
# Import environment specific config. This must remain at the bottom
121125
# of this file so it overrides the configuration defined above.
122126
import_config "#{Mix.env()}.exs"

lib/tilex_web/router.ex

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ defmodule TilexWeb.Router do
4141
plug Tilex.Plug.RateLimiter
4242
end
4343

44+
pipeline :mcp do
45+
plug :accepts, ["json", "stream"]
46+
end
47+
48+
scope "/mcp" do
49+
pipe_through [:mcp]
50+
51+
forward "/",
52+
Anubis.Server.Transport.StreamableHTTP.Plug,
53+
server: Tilex.MCP.Server
54+
end
55+
4456
scope "/api", TilexWeb do
4557
pipe_through [:api]
4658

@@ -113,8 +125,4 @@ defmodule TilexWeb.Router do
113125
forward "/mailbox", Plug.Swoosh.MailboxPreview
114126
end
115127
end
116-
117-
forward "/mcp",
118-
Anubis.Server.Transport.StreamableHTTP.Plug,
119-
server: Tilex.MCP.Server
120128
end

0 commit comments

Comments
 (0)