Skip to content

Commit 63cbbd9

Browse files
authored
Updated warning about binding to non-local interfaces. (#1653)
1 parent a6c8ac4 commit 63cbbd9

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

packages/markitdown-mcp/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# MarkItDown-MCP
22

3+
> [!IMPORTANT]
4+
> The MarkItDown-MCP package is meant for **local use**, with local trusted agents. In particular, when running the MCP server with Streamable HTTP or SSE, it binds to `localhost` by default, and is not exposed to other machines on the network or Internet. In this configuration, it is meant to be a direct alternative to the STDIO transport, which may be more convenient in some cases. DO NOT bind the server to other interfaces unless you understand the [security implications](#security-considerations) of doing so.
5+
6+
37
[![PyPI](https://img.shields.io/pypi/v/markitdown-mcp.svg)](https://pypi.org/project/markitdown-mcp/)
48
![PyPI - Downloads](https://img.shields.io/pypi/dd/markitdown-mcp)
59
[![Built by AutoGen Team](https://img.shields.io/badge/Built%20by-AutoGen%20Team-blue)](https://github.com/microsoft/autogen)
@@ -18,14 +22,14 @@ pip install markitdown-mcp
1822

1923
## Usage
2024

21-
To run the MCP server, using STDIO (default) use the following command:
25+
To run the MCP server, using STDIO (default), use the following command:
2226

2327

2428
```bash
2529
markitdown-mcp
2630
```
2731

28-
To run the MCP server, using Streamable HTTP and SSE use the following command:
32+
To run the MCP server, using Streamable HTTP and SSE, use the following command:
2933

3034
```bash
3135
markitdown-mcp --http --host 127.0.0.1 --port 3001
@@ -96,7 +100,7 @@ If you want to mount a directory, adjust it accordingly:
96100

97101
## Debugging
98102

99-
To debug the MCP server you can use the `mcpinspector` tool.
103+
To debug the MCP server you can use the `MCP Inspector` tool.
100104

101105
```bash
102106
npx @modelcontextprotocol/inspector
@@ -127,7 +131,7 @@ Finally:
127131

128132
## Security Considerations
129133

130-
The server does not support authentication, and runs with the privileges of the user running it. For this reason, when running in SSE or Streamable HTTP mode, it is recommended to run the server bound to `localhost` (default).
134+
The server does not support authentication, and runs with the privileges of the user running it. For this reason, when running in SSE or Streamable HTTP mode, the server binds by default to `localhost`. Even still, it is important to recognize that the server can be accessed by any process or users on the same local machine, and that the `convert_to_markdown` tool can be used to read any file that the server's user has access to, or any data from the network. If you require additional security, consider running the server in a sandboxed environment, such as a virtual machine or container, and ensure that the user permissions are properly configured to limit access to sensitive files and network segments. Above all, DO NOT bind the server to other interfaces (non-localhost) unless you understand the security implications of doing so.
131135

132136
## Trademarks
133137

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: 2024-present Adam Fourney <adamfo@microsoft.com>
22
#
33
# SPDX-License-Identifier: MIT
4-
__version__ = "0.0.1a4"
4+
__version__ = "0.0.1a5"

packages/markitdown-mcp/src/markitdown_mcp/__main__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,23 @@ def main():
113113
sys.exit(1)
114114

115115
if use_http:
116+
host = args.host if args.host else "127.0.0.1"
117+
if args.host and args.host not in ("127.0.0.1", "localhost"):
118+
print(
119+
"\n"
120+
"WARNING: The server is being bound to a non-localhost interface "
121+
f"({host}).\n"
122+
"This exposes the server to other machines on the network or Internet.\n"
123+
"The server has NO authentication and runs with your user's privileges.\n"
124+
"Any process or user that can reach this interface can read files and\n"
125+
"fetch network resources accessible to this user.\n"
126+
"Only proceed if you understand the security implications.\n",
127+
file=sys.stderr,
128+
)
116129
starlette_app = create_starlette_app(mcp_server, debug=True)
117130
uvicorn.run(
118131
starlette_app,
119-
host=args.host if args.host else "127.0.0.1",
132+
host=host,
120133
port=args.port if args.port else 3001,
121134
)
122135
else:

0 commit comments

Comments
 (0)