# A read-only FastMCP STDIO check

On October 15, 2026, we used FastMCP 4.1.0 and Python 3.12.13 on Windows 11. The server and client ran locally over STDIO. There was no HTTP endpoint, model, authentication provider, account or real document. The input was a fixed fictional handbook:

| ID | Exact synthetic response |
| --- | --- |
| `PUBLIC-SETUP` | `Setup window: 48 h. Voltage: 280 V.` |
| `PUBLIC-RETURN` | `Return window: 14 days. Keep the original receipt.` |

Before running, we expected one required `doc_id: str` argument; a valid ID would return only its own text, an unknown ID would be reported as not found, `PRIVATE-PAYROLL` would be denied by our example's explicit rule, and a missing argument would fail validation. We also checked that the server subprocess exited after the client disconnected. These are the [recorded results](results.csv).

The server behavior was deliberately small:

```python
from fastmcp import FastMCP

mcp = FastMCP("Synthetic Handbook")
DOCUMENTS = {
    "PUBLIC-SETUP": "Setup window: 48 h. Voltage: 280 V.",
    "PUBLIC-RETURN": "Return window: 14 days. Keep the original receipt.",
}

@mcp.tool
def lookup_doc(doc_id: str) -> dict[str, str]:
    if doc_id == "PRIVATE-PAYROLL":
        return {"status": "denied", "doc_id": doc_id}
    if doc_id not in DOCUMENTS:
        return {"status": "not_found", "doc_id": doc_id}
    return {"status": "found", "doc_id": doc_id, "text": DOCUMENTS[doc_id]}

if __name__ == "__main__":
    mcp.run()
```

A FastMCP `Client` used `PythonStdioTransport(server_path, keep_alive=False)`, then called `list_tools()` and `call_tool()` for each case. Setting `keep_alive=False` mattered for the subprocess-exit check: the transport otherwise keeps a process available between client sessions by default in the tested version. The private ID refusal above is our example logic, **not** a FastMCP filesystem sandbox, identity check or organization policy. Missing-argument validation is framework behavior. No remote deployment, OAuth, data leakage test or model-side tool selection was measured.

References: [FastMCP client transports](https://gofastmcp.com/clients/client), [tool calls](https://gofastmcp.com/clients/tools), [authentication scope](https://gofastmcp.com/servers/auth/authentication), [code license](https://github.com/PrefectHQ/fastmcp/blob/main/LICENSE).

Reproduction note: on October 16, 2026, a fresh isolated environment installed the same pinned dependencies offline and reproduced all six checks. Fresh installation/command/exit-code logs are archived separately; the October 15 records were not backfilled.

## 中文方法说明

2026 年 10 月 15 日，我们在 Windows 11、Python 3.12.13 的独立环境中，用 FastMCP 4.1.0 实际启动本地 STDIO 服务端和客户端。没有 HTTP 端点、身份提供方、模型、用户账户或真实文档。2026 年 10 月 16 日从相同锁文件离线重建环境，六项检查结果一致；新一轮的命令、进程退出码和原始日志单独归档，原记录不改写。

服务端使用上方的完整 Python 示例。它仅包含两条虚构资料：`PUBLIC-SETUP` 返回 `Setup window: 48 h. Voltage: 280 V.`，`PUBLIC-RETURN` 返回 `Return window: 14 days. Keep the original receipt.`。客户端通过 `PythonStdioTransport(server_path, keep_alive=False)` 连接，先执行 `list_tools()`，再用 `call_tool()` 检查以下情形。

| 检查 | 预期与实际观察 |
| --- | --- |
| 工具发现 | 找到 `lookup_doc`，必填参数为 `doc_id: str` |
| 合法 ID | `PUBLIC-SETUP` 只返回它自己的固定文字 |
| 未知 ID | `NO-SUCH-ID` 返回 `not_found`，无资料正文 |
| 示例业务拒绝 | `PRIVATE-PAYROLL` 返回 `denied`，无资料正文；这是普通工具结果，`is_error=false` |
| 缺参 | 空参数对象触发 `ToolError`，指出缺少 `doc_id` |
| 断开与退出 | 客户端结束后观察子进程退出；这里显式关闭 `keep_alive`，不将默认保持进程行为说成框架故障 |

[六项结果表](results.csv)区分业务拒绝和协议/参数错误。拒绝条件是我们在示例中写的 `if` 规则，不是 FastMCP 自动建立的身份授权、文件系统白名单或沙箱。缺参校验属于本次观察到的框架行为。

本试验没有验证远程部署、HTTP/OAuth、真实文件泄漏、生产隔离、模型是否正确选择工具，也未替用户完成 Codex/Claude 客户端配置。不能把一个只读合成例子宣传为完整安全验收。
