feat(mcp): add render.rs content policy (text paging, pattern filter, blob spill)

Single content-policy module for MCP resource and tool content, per
plans/mcp-resources-prompts-design.md §4.5 (T3):

- render_text: UTF-8-boundary-safe paging with clamped max_bytes and
  grep-style fancy-regex line filtering (2 lines of context, 1-based
  line-number prefixes, merged hunks); offsets walk the filtered stream.
- render_blob/render_blob_at: streaming base64 decode with a 50 MiB
  ceiling, UTF-8 sniff, sha256-named 0600 spill files under a sanitized
  server dir with a fixed mime->ext allowlist, and best-effort
  oldest-first eviction bounding the spill tree at 512 MiB.

Not yet wired to call sites; module carries #![allow(dead_code)] until
the read/prompt surfaces land.
This commit is contained in:
2026-08-25 11:37:41 -06:00
parent d68f4ecaeb
commit ef88b6a2c8
2 changed files with 766 additions and 0 deletions
+1
View File
@@ -1,6 +1,7 @@
mod auth_client;
pub(crate) mod manage;
pub(crate) mod oauth;
pub(crate) mod render;
mod sse_transport;
use crate::config::AppConfig;