Reference
Application MCP and scaffold API¶
hinoki.ai.mcpapp.expose_as_mcp ¶
expose_as_mcp(
app: Hinoki,
*,
tools: Iterable[str],
access: Access | None,
path: str = "/mcp",
allow_writes: bool = False,
public: bool = False,
allowed_origins: Iterable[str] = (),
) -> list[Callable[..., Any]]
The MCP action to app.include(...), publishing the matching actions.
tools are fnmatch patterns over qualified action names; call this
after the exposed actions are included. access protects the endpoint
(None only with public=True).
The endpoint answers only application/json POSTs and refuses a request
that carries an Origin outside allowed_origins (browsers send one;
agents and CLI clients do not) or Sec-Fetch-Site: cross-site: this keeps
a web page from driving the tools with the user's cookie and covers the MCP
DNS-rebinding rule. Cookie authentication together with allow_writes is
still a risky combination; prefer bearer credentials.
hinoki.ai.mcpapp.ExposureError ¶
Bases: ValueError
The MCP exposure is configured wrongly (raised when it is built).
Project scaffolding is a command-line interface; see command line. For the stdio development server and its tools, see the development MCP guide. Application MCP is mounted separately on selected routes.