Skip to content

Commit 0d45984

Browse files
authored
enhancement: ease network transport usage (streamable-http and sse) (#201)
1 parent 4072af9 commit 0d45984

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

entrypoint.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
# 1) Change into the app dir
99
cd /app
1010

11-
# 2) Make sure we use the venvs Python
11+
# 2) Make sure we use the venv's Python
1212
PYTHON_BIN=/app/.venv/bin/python
1313

1414
# 3) Point Python at the src/ directory so it can import deepset_mcp
1515
export PYTHONPATH=/app/src
1616

1717
# 4) Exec your MCP server
18-
exec "$PYTHON_BIN" -m deepset_mcp.main \
19-
--workspace "${DEEPSET_WORKSPACE}" \
20-
--api-key "${DEEPSET_API_KEY}"
18+
# If no command-line arguments are provided, use environment variables as defaults
19+
if [ $# -eq 0 ]; then
20+
exec "$PYTHON_BIN" -m deepset_mcp.main \
21+
--workspace "${DEEPSET_WORKSPACE}" \
22+
--api-key "${DEEPSET_API_KEY}"
23+
else
24+
# Pass through all command-line arguments
25+
exec "$PYTHON_BIN" -m deepset_mcp.main "$@"
26+
fi

src/deepset_mcp/main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ def main(
112112
"Can also be set via OBJECT_STORE_TTL environment variable.",
113113
),
114114
] = 600,
115+
host: Annotated[
116+
str,
117+
typer.Option(
118+
"--host",
119+
help="Host address to bind the server to. Default: 0.0.0.0",
120+
),
121+
] = "0.0.0.0",
122+
port: Annotated[
123+
int | None,
124+
typer.Option(
125+
"--port",
126+
help="Port number to bind the server to. If not specified, uses default port for the transport.",
127+
),
128+
] = None,
115129
) -> None:
116130
"""
117131
Run the Deepset MCP server.
@@ -130,6 +144,8 @@ def main(
130144
:param object_store_backend: Object store backend type ('memory' or 'redis')
131145
:param object_store_redis_url: Redis connection URL (required if backend='redis')
132146
:param object_store_ttl: TTL in seconds for stored objects
147+
:param host: Host address to bind the server to
148+
:param port: Port number to bind the server to
133149
"""
134150
# Handle --list-tools flag early
135151
if list_tools:
@@ -187,6 +203,9 @@ def main(
187203
object_store_redis_url=redis_url,
188204
object_store_ttl=ttl,
189205
)
206+
mcp.settings.host = host
207+
if port is not None:
208+
mcp.settings.port = port
190209

191210
mcp.run(transport=transport.value)
192211

0 commit comments

Comments
 (0)