mcp_methods/lib.rs
1//! ``mcp-methods`` — pure-Rust primitives for building MCP servers.
2//!
3//! Zero PyO3 in this crate's source tree. Python bindings live in the
4//! sibling `mcp-methods-py` crate, which depends on this rlib and adds
5//! a `#[pymodule]` of PyO3 wrappers for the cdylib. Pure-Rust consumers
6//! (kglite, any downstream Rust binary) depend on `mcp-methods`
7//! directly and see no traces of Python in their dep tree or source.
8//!
9//! Public API surface — `use mcp_methods::<module>::<fn>;` from any
10//! Rust crate:
11//! - [`cache::ElementCache`] — drill-down cache for collapsed GitHub
12//! discussion elements (code blocks, comments, patches, overflow).
13//! - [`compact`] — text compaction utilities + adaptive budget-based
14//! JSON discussion compaction.
15//! - [`files::read_file`] — safe file reading with allowed-dir sandbox.
16//! - [`git_refs`] — `org/repo` format validation + reference extraction.
17//! - [`github`] — GitHub REST API client + issue/PR fetching with
18//! smart compaction.
19//! - [`grep`] — ripgrep-powered file + line search.
20//! - [`html::html_to_text`] — lightweight HTML → markdown-flavoured text.
21//! - [`json_grep::ripgrep_json_fields`] — extract fields from JSON text.
22//! - [`list_dir::list_dir`] — tree-formatted directory listing.
23//!
24//! With `feature = "server"` (default-on), additionally:
25//! - [`server`] — rmcp-backed MCP server framework (manifest parsing,
26//! source/github tools, workspace mode, watch mode, etc.).
27
28pub mod cache;
29pub mod compact;
30pub mod files;
31pub mod git_refs;
32pub mod github;
33pub mod grep;
34pub mod html;
35pub mod json_grep;
36pub mod list_dir;
37
38#[cfg(feature = "server")]
39pub mod server;