Fix guide · updated 2026-11-20
MCP server 405 Method Not Allowed: why your MCP URL refuses the request
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}
Your MCP client, a connector or curl gets HTTP 405 Method Not Allowed from an MCP server's address. A 405 means the server got the request at that address but won't take that HTTP method there. We reproduced each case below on local servers built with the official TypeScript SDK (1.29) and Python SDK (1.30.0), and read the SDKs' code (November 2026). Two things tell you which case you're in: the method your client sent, and the Allow header in the reply.
Read the reply first
Send the request yourself and look at the headers:
curl -i https://your-server.example.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"my-script","version":"1"}}}'
- A 200 here, and a 405 only when something sends a
GET: the server works. See the first section below. Allow: GET, HEADon thisPOST: the address is the old transport's event stream, or a web page.Allow: POSTon aGET: you opened the old transport's message address instead of its stream.Allow: GET, POST, DELETE: your client usedPUTorPATCH, which MCP doesn't use.- An HTML page in the body: the request never reached the MCP server.
A GET on a stateless server: normal
MCP messages go by POST. A GET on the same address asks the server for an optional stream of messages it may want to push later. The spec lets a server say no with a 405, and the TypeScript SDK's stateless example does exactly that: it answers every GET and DELETE with 405 and {"jsonrpc":"2.0","error":{"code":-32000,"message":"Method not allowed."},"id":null}. Many servers are copied from that example.
So a browser tab, an uptime monitor or a health check that opens the address gets a 405 while the server is fine. Point monitors at a separate health route, or have them send the initialize request above.
A client should read that 405 as "no stream" and keep using POST. Not every client did in 2026: from version 2.1.84, Claude Code failed to connect to some stateless servers that answer GET with 405 (anthropics/claude-code issue #39790, March); a reconnect loop with servers that offer no GET stream came in with 2.1.147 and was fixed in 2.1.153; and Claude Desktop showed a "Client server capabilities not available" error on that 405 in July (#78193). In August a Claude Code maintainer checked 2.1.233 against such a server: it gets the 405, falls back to POST only, and lists and calls tools with no error. If a client won't connect to a server that passes the curl above, update the client first.
In our test, the SDK transports themselves don't refuse GET: a stateless TypeScript (1.29) or Python (1.30.0) server answered it with 200 and an open event stream. The 405 comes from the example's own route, so whether you see it depends on the server's code, not on MCP.
A POST to an old /sse address
Before March 2025, remote MCP servers used two addresses: the client opened a stream with GET /sse, the server sent back a second address like /messages/?session_id=…, and every message went by POST to that one. A current client posts straight to the address you give it, so pointing it at /sse gets a 405.
In our test (Python SDK 1.30.0, FastMCP's sse_app): POST /sse got 405 Method Not Allowed with Allow: GET, HEAD; GET /messages/ got a 405 with Allow: POST; and POST /mcp got a 404, because that server only speaks the old transport.
The fix: use the server's current address if it has one (FastMCP serves it at /mcp from streamable_http_app), or tell your client the address is SSE. In Claude Code: claude mcp add --transport sse my-server https://your-server.example.com/sse. If it's your server, serve the current transport next to the old one, so both kinds of client work.
The address serves a web page
Open the address in a browser. If you see your website, a sign-in page or your host's "page not found", the request never reaches the MCP server. A web server that only serves pages answers a POST with 405: nginx sends an HTML page titled 405 Not Allowed, and Caddy's file server sends 405 with Allow: GET, HEAD. We saw both this week on live MCP addresses listed in the official registry.
The usual causes: the site's catch-all route answers before the MCP route, the reverse proxy has no rule for that path, or the address in the registry or the connector settings points at the website instead of the server (example.com/mcp where the server is mcp.example.com/mcp, or the reverse). Fix the route or the address, then run the curl above until initialize gets a 200.
A redirect turned your POST into a GET
When an address answers 301 or 302 (http to https, a trailing slash, a moved domain), many HTTP clients follow it with a GET. The MCP server then sees a GET and answers 405, or opens a stream that never answers your message.
In our test, curl's -L followed a 301 in front of a Python server with a GET. With -X POST it kept the method but dropped the body, and the server answered 400 with Parse error: Expecting value: line 1 column 1 (char 0). A 307 or 308 keeps both: FastMCP answers POST /mcp/ with a 307 to /mcp, and that works.
The fix: give your client the final address, exactly (https, host, path, with or without the slash as the server wants it). Run curl with -i and without -L: a Location header is the address to use. If it's your server, make any redirect a 308.
DELETE or PUT
A client sends DELETE to end its session. A server without sessions may refuse, and that's allowed: the Python SDK 1.30.0 in stateless mode answers 405 with Method Not Allowed: Session termination not supported. A client should ignore it. PUT and PATCH aren't part of MCP: both SDKs answer them with 405 and Allow: GET, POST, DELETE.
Give your AI tool this prompt:
Our MCP client gets "405 Method Not Allowed" from an MCP server URL. Check, in this order: (1) Every MCP message must be an HTTP POST to the server's streamable HTTP endpoint, with Content-Type: application/json and Accept: application/json, text/event-stream. (2) If the URL ends in /sse, it's the old HTTP+SSE transport: either use the server's streamable HTTP endpoint or switch our client to the SSE transport for this server. (3) If a GET to the URL returns an HTML page, the path isn't routed to the MCP server: fix the route or the URL. (4) If the URL answers a 301 or 302, use the final URL from the Location header so the POST isn't turned into a GET. (5) Treat a 405 on GET (the optional server-to-client stream) or on DELETE (ending a session) as normal and carry on with POST. Don't change anything else.
Not quite your error?
406 Not Acceptable: Client must accept both application/json and text/event-stream: see MCP 406 Not Acceptable.404withSession not found, or400 Bad Request: Missing session ID: see MCP server "Session not found" (404) after initialize. AGETwithout a session ID gets that 400 from a server that uses sessions.404onPOST /mcpwhile/sseexists: the server only speaks the old transport (see the /sse section above).
Still stuck?
Run the curl above with -v and read the first lines of the reply: the status, Allow, Location and Content-Type. A Location means a redirect, HTML means the wrong route, and the Allow list tells you which methods that address takes. If curl gets a 200 and your client still gets a 405, the client is sending something else: turn on its debug log and compare the method and the address it uses.