feat: Make mcp able to use http transport

This commit is contained in:
Karim shoair
2025-09-28 04:54:35 +03:00
parent 292208e22d
commit 4a661b4875
2 changed files with 21 additions and 13 deletions
+18 -2
View File
@@ -136,10 +136,26 @@ def install(force): # pragma: no cover
@command(help="Run Scrapling's MCP server (Check the docs for more info).")
def mcp():
@option(
"--http",
type=bool,
default=False,
help="Whether to run the MCP server in streamable-http transport or leave it as stdio (Default: False)",
)
@option(
"--host",
type=str,
default="0.0.0.0",
help="The host to use if streamable-http transport is enabled (Default: '0.0.0.0')",
)
@option(
"--port", type=int, default=8000, help="The port to use if streamable-http transport is enabled (Default: 8000)"
)
def mcp(http, host, port):
from scrapling.core.ai import ScraplingMCPServer
ScraplingMCPServer().serve()
server = ScraplingMCPServer(host, port)
server.run(transport="stdio" if not http else "streamable-http")
@command(help="Interactive scraping console")