Skip to content

Python tool for converting files and office documents to Markdown.

Small changes to favor streamable HTTP over deprecated SSE (#1264)

afourney9dc982a3b1ea
diff --git a/packages/markitdown-mcp/README.md b/packages/markitdown-mcp/README.md
index 15584471..4c9cff83 100644
--- a/packages/markitdown-mcp/README.md
+++ b/packages/markitdown-mcp/README.md
@@ -4,7 +4,7 @@
![PyPI - Downloads](https://img.shields.io/pypi/dd/markitdown-mcp)
[![Built by AutoGen Team](https://img.shields.io/badge/Built%20by-AutoGen%20Team-blue)](https://github.com/microsoft/autogen)
-The `markitdown-mcp` package provides a lightweight STDIO, SSE and Streamable HTTP MCP server for calling MarkItDown.
+The `markitdown-mcp` package provides a lightweight STDIO, Streamable HTTP, and SSE MCP server for calling MarkItDown.
It exposes one tool: `convert_to_markdown(uri)`, where uri can be any `http:`, `https:`, `file:`, or `data:` URI.
@@ -25,10 +25,10 @@ To run the MCP server, using STDIO (default) use the following command:
markitdown-mcp
```
-To run the MCP server, using SSE or Streamable HTTP use the following command:
+To run the MCP server, using Streamable HTTP and SSE use the following command:
```bash
-markitdown-mcp --sse --host 127.0.0.1 --port 3001
+markitdown-mcp --http --host 127.0.0.1 --port 3001
```
## Running in Docker
@@ -109,16 +109,16 @@ If using STDIO:
* input `markitdown-mcp` as the command, and
* click `Connect`
-If using SSE:
-* select `SSE` as the transport type,
-* input `http://127.0.0.1:3001/sse` as the URL, and
-* click `Connect`
-
If using Streamable HTTP:
* select `Streamable HTTP` as the transport type,
* input `http://127.0.0.1:3001/mcp` as the URL, and
* click `Connect`
+If using SSE:
+* select `SSE` as the transport type,
+* input `http://127.0.0.1:3001/sse` as the URL, and
+* click `Connect`
+
Finally:
* click the `Tools` tab,
* click `List Tools`,
diff --git a/packages/markitdown-mcp/src/markitdown_mcp/__main__.py b/packages/markitdown-mcp/src/markitdown_mcp/__main__.py
index 4732f5ef..e2f4b164 100644
--- a/packages/markitdown-mcp/src/markitdown_mcp/__main__.py
+++ b/packages/markitdown-mcp/src/markitdown_mcp/__main__.py
@@ -75,12 +75,17 @@ def main():
mcp_server = mcp._mcp_server
- parser = argparse.ArgumentParser(description="Run MCP SSE-based MarkItDown server")
+ parser = argparse.ArgumentParser(description="Run a MarkItDown MCP server")
+ parser.add_argument(
+ "--http",
+ action="store_true",
+ help="Run the server with Streamable HTTP and SSE transport rather than STDIO (default: False)",
+ )
parser.add_argument(
"--sse",
action="store_true",
- help="Run the server with SSE transport rather than STDIO (default: False)",
+ help="(Deprecated) An alias for --http (default: False)",
)
parser.add_argument(
"--host", default=None, help="Host to bind to (default: 127.0.0.1)"
@@ -90,11 +95,15 @@ def main():
)
args = parser.parse_args()
- if not args.sse and (args.host or args.port):
- parser.error("Host and port arguments are only valid when using SSE transport.")
+ use_http = args.http or args.sse
+
+ if not use_http and (args.host or args.port):
+ parser.error(
+ "Host and port arguments are only valid when using streamable HTTP or SSE transport (see: --http)."
+ )
sys.exit(1)
- if args.sse:
+ if use_http:
starlette_app = create_starlette_app(mcp_server, debug=True)
uvicorn.run(
starlette_app,