File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,18 @@ That’s it. Your MCP tool is now available at http://localhost:8000 with a gene
7474
7575🤝 ** To integrate with Open WebUI after launching the server, check our [ docs] ( https://docs.openwebui.com/openapi-servers/open-webui/ ) .**
7676
77+
78+ ### 🌐 Serving Under a Subpath (` --root-path ` )
79+
80+ If you need to serve mcpo behind a reverse proxy or under a subpath (e.g., ` /api/mcpo ` ), use the ` --root-path ` argument:
81+
82+ ``` bash
83+ mcpo --port 8000 --root-path " /api/mcpo" --api-key " top-secret" -- your_mcp_server_command
84+ ```
85+
86+ All routes will be served under the specified root path, e.g. ` http://localhost:8000/api/mcpo/memory ` .
87+
88+
7789### 🔄 Using a Config File
7890
7991You can serve multiple MCP tools via a single config file that follows the [ Claude Desktop] ( https://modelcontextprotocol.io/quickstart/user ) format.
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ def main(
6060 ssl_keyfile : Annotated [
6161 Optional [str ], typer .Option ("--ssl-keyfile" , "-K" , help = "SSL keyfile" )
6262 ] = None ,
63+ root_path : Annotated [
64+ Optional [str ], typer .Option ("--root-path" , help = "Root path" )
65+ ] = "" ,
6366 path_prefix : Annotated [
6467 Optional [str ], typer .Option ("--path-prefix" , help = "URL prefix" )
6568 ] = None ,
@@ -146,6 +149,7 @@ def main(
146149 ssl_certfile = ssl_certfile ,
147150 ssl_keyfile = ssl_keyfile ,
148151 path_prefix = path_prefix ,
152+ root_path = root_path ,
149153 headers = headers ,
150154 hot_reload = hot_reload ,
151155 )
Original file line number Diff line number Diff line change @@ -611,6 +611,7 @@ async def run(
611611 ssl_certfile = kwargs .get ("ssl_certfile" )
612612 ssl_keyfile = kwargs .get ("ssl_keyfile" )
613613 path_prefix = kwargs .get ("path_prefix" ) or "/"
614+ root_path = kwargs .get ("root_path" ) or ""
614615
615616 # Configure logging based on LOG_LEVEL environment variable
616617 log_level = os .getenv ("LOG_LEVEL" , "INFO" ).upper ()
@@ -649,6 +650,7 @@ def filter(self, record):
649650 if ssl_keyfile :
650651 logger .info (f" SSL Key File: { ssl_keyfile } " )
651652 logger .info (f" Path Prefix: { path_prefix } " )
653+ logger .info (f" Root Path: { root_path } " )
652654
653655 # Create shutdown handler
654656 shutdown_handler = GracefulShutdown ()
@@ -657,6 +659,7 @@ def filter(self, record):
657659 title = name ,
658660 description = description ,
659661 version = version ,
662+ root_path = root_path ,
660663 ssl_certfile = ssl_certfile ,
661664 ssl_keyfile = ssl_keyfile ,
662665 lifespan = lifespan ,
You can’t perform that action at this time.
0 commit comments