mcp

js/cli/mcp.md

fino mcp serves the workspace tools from fino:ai/tools to an MCP client, so an editor, desktop assistant, or another agent can list, read, search, edit, and run commands in one directory through fino. It speaks stdio by default and Streamable HTTP with --http.

fino mcp
fino mcp --root ~/src/project
fino mcp --read-only
fino mcp --no-shell
fino mcp --http --port 3090

stdio

Register it with a client as a stdio server whose command is fino and whose arguments are mcp plus any options. The client starts the process, speaks newline-delimited JSON-RPC on its stdin and stdout, and closes stdin to stop it. Nothing else is written to stdout; startup errors go to stderr.

HTTP

--http serves the same tools as a Streamable HTTP endpoint at /mcp, for clients that connect to a URL rather than start a process, or for several clients sharing one server. The command prints the endpoint and serves until it is interrupted:

fino mcp serving on http://127.0.0.1:3090/mcp
token: 3q2-pZ0Ff…

Every request must send Authorization: Bearer <token>; anything else gets 401. Set FINO_MCP_TOKEN to choose the token, which keeps client configuration stable across restarts and is never printed. When it is unset a random token is generated for this run and printed as above. Requests from a browser page on another origin are refused with 403, and each client gets its own MCP session.

The server binds 127.0.0.1 on port 3090 by default. --port 0 picks a free port, and --host binds another address; anything that can reach that address and holds the token can use the tools, so keep the token secret before binding beyond loopback.

Boundaries

Every tool is bounded to the workspace root, which defaults to the current directory. Reads and writes outside it are refused, including through .., absolute paths, and symbolic links. shell runs /bin/sh under the strict process sandbox with the root writable, read-only system directories, and all network access denied; where strict sandboxing is unavailable it returns an error instead of running unconfined.

Option Effect
--root DIR Bound the tools to DIR instead of the current directory.
--read-only Serve only list_files, read_file, and search_files.
--no-shell Keep the editing tools but omit shell.
--http Serve Streamable HTTP at /mcp instead of stdio.
--port N Port for --http (default 3090, 0 for any free port).
--host ADDR Address for --http to bind (default 127.0.0.1).

The tools run without fino's approval step: MCP clients confirm tool calls themselves and cannot answer a fino approval suspension. Use --read-only or --no-shell when the client should not be able to change files or run commands.

The command is a thin binding over createWorkspaceTools() from fino:ai/tools and mcpServer() from fino:ai/mcp, served with streamTransport() over stdin() and stdout(), or with MCPServer.httpHandler() behind a bearer-token check on serveHttp(). Compose those directly to serve a different tool set.