Expand description
mcp-methods — pure-Rust primitives for building MCP servers.
Zero PyO3 in this crate’s source tree. Python bindings live in the
sibling mcp-methods-py crate, which depends on this rlib and adds
a #[pymodule] of PyO3 wrappers for the cdylib. Pure-Rust consumers
(kglite, any downstream Rust binary) depend on mcp-methods
directly and see no traces of Python in their dep tree or source.
Public API surface — use mcp_methods::<module>::<fn>; from any
Rust crate:
cache::ElementCache— drill-down cache for collapsed GitHub discussion elements (code blocks, comments, patches, overflow).compact— text compaction utilities + adaptive budget-based JSON discussion compaction.files::read_file— safe file reading with allowed-dir sandbox.git_refs—org/repoformat validation + reference extraction.github— GitHub REST API client + issue/PR fetching with smart compaction.grep— ripgrep-powered file + line search.html::html_to_text— lightweight HTML → markdown-flavoured text.json_grep::ripgrep_json_fields— extract fields from JSON text.list_dir::list_dir— tree-formatted directory listing.
With feature = "server" (default-on), additionally:
server— rmcp-backed MCP server framework (manifest parsing, source/github tools, workspace mode, watch mode, etc.).
Modules§
- cache
- compact
- files
- Safe file reading with allowed-dir sandbox + optional grep / section / row / line-range slicing.
- git_
refs - github
- grep
- ripgrep-powered file + line search.
- html
- json_
grep - Walk a parsed JSON structure, grep within string values.
- list_
dir - Tree-formatted directory listing with optional per-entry annotation.
- server
- Reusable building blocks for Rust-native MCP servers.