feat: support remote MCP asset server

Add Streamable HTTP transport for the source-file MCP server with bearer-token auth, configurable HTTP runtime options, and user-level systemd service helpers.

Document remote client setup and cover auth/service behavior with unit tests.
This commit is contained in:
Codex
2026-07-05 11:30:42 +00:00
parent 76a480a0b7
commit 31b0e8dba2
14 changed files with 945 additions and 10 deletions
+22 -1
View File
@@ -494,6 +494,20 @@ def cmd_mcp_server(args: argparse.Namespace) -> int:
argv.extend(["--max-file-bytes", str(args.max_file_bytes)])
if args.expose_paths:
argv.append("--expose-paths")
if args.transport:
argv.extend(["--transport", args.transport])
if args.host:
argv.extend(["--host", args.host])
if args.port is not None:
argv.extend(["--port", str(args.port)])
if args.path:
argv.extend(["--path", args.path])
if args.token_env:
argv.extend(["--token-env", args.token_env])
for allowed_host in args.allowed_hosts or []:
argv.extend(["--allowed-host", allowed_host])
for allowed_origin in args.allowed_origins or []:
argv.extend(["--allowed-origin", allowed_origin])
return mcp_main(argv)
@@ -588,11 +602,18 @@ def build_parser() -> argparse.ArgumentParser:
ftp.add_argument("--visibility", default="internal", help="initial visibility")
ftp.set_defaults(func=cmd_file_index_stage)
mp = sub.add_parser("mcp-server", help="run the stdio MCP server for safe source-file lookup")
mp = sub.add_parser("mcp-server", help="run the MCP server for safe source-file lookup")
_add_file_index_storage_args(mp)
mp.add_argument("--profile", help="bot profile name for ACL checks")
mp.add_argument("--max-file-bytes", type=int, help="maximum resource size, 0 disables the limit")
mp.add_argument("--expose-paths", action="store_true", help="include archive/absolute paths in tool output")
mp.add_argument("--transport", choices=["stdio", "streamable-http"], help="MCP transport")
mp.add_argument("--host", help="HTTP bind host. Used only with --transport streamable-http")
mp.add_argument("--port", type=int, help="HTTP port. Used only with --transport streamable-http")
mp.add_argument("--path", help="Streamable HTTP MCP path")
mp.add_argument("--token-env", help="Environment variable containing the HTTP bearer token")
mp.add_argument("--allowed-host", action="append", dest="allowed_hosts", help="allowed HTTP Host pattern")
mp.add_argument("--allowed-origin", action="append", dest="allowed_origins", help="allowed Origin pattern")
mp.set_defaults(func=cmd_mcp_server)
bp = sub.add_parser("bot-view", help="derive isolated chatbot views from the mother vault")