sftp_helper.mcp module
SFTP Helper: Model Context Protocol (MCP) surface.
A thin adapter that exposes the FastAPI app from sftp_helper.api as MCP
tools, so any MCP-aware host (an agent runtime, an IDE integration, a custom
shell) can call the sftp-helper operations (upload, download, delete, exists,
dir-exists, list, remote-stat, mkdir, normalize-path, strip-path, tempfile,
health) as first-class tools, against the single SFTP target the server was
started with. Strict host-key verification stays on always; credentials are
loaded once at server start and never accepted in a request body, see
sftp_helper.api. /show-credentials stays an HTTP-only route: it is
deliberately left out of the MCP tools, so an agent cannot read the host,
login or key path back.
Uses fastapi-mcp (https://github.com/tadata-org/fastapi_mcp): one wrapper
publishes the whole existing HTTP surface, so the routes are never duplicated.
Install the extra to pull in fastapi-mcp:
pip install "sftp-helper[mcp]"
Then run the server (HTTP API + MCP endpoint at /mcp):
sftp-helper-mcp # console entry point
python -m sftp_helper.mcp # equivalent
- sftp_helper.mcp.main(argv=None)[source]
Console entry point (
sftp-helper-mcp): serve the API + MCP endpoint.Boots the FastAPI app (now serving both the plain HTTP routes and the
/mcpMCP endpoint) with uvicorn in a single worker. Local-first: binds to loopback by default (override with--host/--portorSFTP_HELPER_HOST/SFTP_HELPER_PORT). A click command, so--helpanswers instead of starting the server.