Small changes to favor streamable HTTP over deprecated SSE (#1264)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||

|

|
||||||
[](https://github.com/microsoft/autogen)
|
[](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.
|
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
|
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
|
```bash
|
||||||
markitdown-mcp --sse --host 127.0.0.1 --port 3001
|
markitdown-mcp --http --host 127.0.0.1 --port 3001
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running in Docker
|
## Running in Docker
|
||||||
@@ -109,16 +109,16 @@ If using STDIO:
|
|||||||
* input `markitdown-mcp` as the command, and
|
* input `markitdown-mcp` as the command, and
|
||||||
* click `Connect`
|
* 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:
|
If using Streamable HTTP:
|
||||||
* select `Streamable HTTP` as the transport type,
|
* select `Streamable HTTP` as the transport type,
|
||||||
* input `http://127.0.0.1:3001/mcp` as the URL, and
|
* input `http://127.0.0.1:3001/mcp` as the URL, and
|
||||||
* click `Connect`
|
* 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:
|
Finally:
|
||||||
* click the `Tools` tab,
|
* click the `Tools` tab,
|
||||||
* click `List Tools`,
|
* click `List Tools`,
|
||||||
|
|||||||
@@ -75,12 +75,17 @@ def main():
|
|||||||
|
|
||||||
mcp_server = mcp._mcp_server
|
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(
|
parser.add_argument(
|
||||||
"--sse",
|
"--sse",
|
||||||
action="store_true",
|
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(
|
parser.add_argument(
|
||||||
"--host", default=None, help="Host to bind to (default: 127.0.0.1)"
|
"--host", default=None, help="Host to bind to (default: 127.0.0.1)"
|
||||||
@@ -90,11 +95,15 @@ def main():
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if not args.sse and (args.host or args.port):
|
use_http = args.http or args.sse
|
||||||
parser.error("Host and port arguments are only valid when using SSE transport.")
|
|
||||||
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.sse:
|
if use_http:
|
||||||
starlette_app = create_starlette_app(mcp_server, debug=True)
|
starlette_app = create_starlette_app(mcp_server, debug=True)
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
starlette_app,
|
starlette_app,
|
||||||
|
|||||||
Reference in New Issue
Block a user