Skip to main content

Reusable utility methods for MCP servers

Project description

mcp-methods

Shared Rust-powered utilities for Model Context Protocol servers. Pip-installable Python library AND a native Rust crate AND a generic CLI binary — three distribution shapes, one set of primitives.

Fast file search (ripgrep-backed), GitHub integration with smart compaction, text utilities, and an rmcp-backed MCP server framework with YAML-manifest configuration. The common building blocks needed when writing MCP tool servers.

The Rust library is the source of truth; the Python wheel is a thin pyo3 binding over it. Rust consumers see zero pyo3 in their dep tree.

Install

Python — pip install

pip install mcp-methods
from mcp_methods import ElementCache, ripgrep, list_dir, github_discussions, read_file

The wheel ships the mcp-server CLI on PATH alongside the library — which mcp-server should resolve immediately. Single abi3 wheel per OS; works on Python 3.10 through 3.13 without reinstall.

Rust library — cargo add

[dependencies]
mcp-methods = "0.3"
use mcp_methods::cache::ElementCache;
use mcp_methods::{github, files, grep, list_dir, compact, html};
use mcp_methods::server::{McpServer, ServerOptions, Manifest}; // with default `server` feature

Zero pyo3 in the dep tree. The server feature (default-on) adds the rmcp-backed framework; disable with default-features = false for the bare primitives.

For pre-release coordination — pinning against a specific commit while the framework is iterating quickly — depend on a git rev:

mcp-methods = { git = "https://github.com/kkollsga/mcp-methods.git", rev = "<short SHA>", features = ["server"] }

The downstream kglite-mcp-server uses this pattern to stay locked to the exact framework rev its integration tests pass against.

CLI — cargo install (alternative path)

The CLI ships in the pip wheel by default. If you'd rather skip Python:

cargo install --git https://github.com/kkollsga/mcp-methods mcp-server

Not on crates.io — mcp-server is unpublished on purpose. The Rust library on crates.io is the published surface; the binary ships via the wheel and via git.

Documentation

Full docs at mcp-methods.readthedocs.io (Sphinx + Read the Docs, structured along Diátaxis lines):

  • Getting Started — 15-minute walkthrough from pip install to a running server
  • Core Concepts — manifest, operating modes, trust gates, downstream-binary pattern
  • Guides — writing a manifest, downstream binaries, trust gates, python bindings, watch + workspace modes
  • Reference — manifest schema, Python API, Rust API
  • Explanation — three-crate architecture, advisory-trust pattern, distribution shape

Rust API rustdoc: docs.rs/mcp-methods.

What's included

Primitive Purpose
list_dir Tree-formatted directory listing with depth, glob, .gitignore, annotation
ripgrep_files, ripgrep, ripgrep_lines Ripgrep-powered search (in-process, no subprocess)
read_file Safe file reading with path traversal protection
github_discussions, git_api GitHub issue/PR fetching with smart compaction, REST wrapper
ElementCache Drill-down cache for collapsed elements in GitHub discussions
html_to_text, compact_text, collapse_code_blocks Text utilities
extract_github_refs, detect_git_repo, validate_repo Git/GitHub helpers
mcp_methods.fastmcp Composable tool registrations for FastMCP servers

Plus the server framework in mcp_methods::server::*: McpServer, ServerOptions, Manifest, Workspace, watch_dir, load_env_walk. See the Rust API reference.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mcp_methods-0.3.32-cp310-abi3-win_amd64.whl (6.6 MB view details)

Uploaded CPython 3.10+Windows x86-64

mcp_methods-0.3.32-cp310-abi3-manylinux_2_39_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.39+ x86-64

mcp_methods-0.3.32-cp310-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file mcp_methods-0.3.32-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mcp_methods-0.3.32-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 13cb9dd3c28ae937b216f47186b1dd1aca20a080023695170f0bc11eb9edec37
MD5 66ca8392920b950acaee493c42e443c6
BLAKE2b-256 8eb19c475cb3e4f9de85c7bbe2273326d7726e7cbe8b60ab489d715efe4c7f9d

See more details on using hashes here.

File details

Details for the file mcp_methods-0.3.32-cp310-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for mcp_methods-0.3.32-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 23cd0d835edf4e9dd54b4009a60aea443fb8885739594ff041596e65ff032544
MD5 644b4f88a4ae42ee9b224b58d88ad454
BLAKE2b-256 b66a5a3f215096d7d89b7ea2777591068e193e8bf08ff98fe675513394780222

See more details on using hashes here.

File details

Details for the file mcp_methods-0.3.32-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcp_methods-0.3.32-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b88eca23364ebe339b5caa57b0e5c685ae23bb22cf89cad7031aa252aa4568c
MD5 6f2805f25d7b02dd3f0dda5a6fecdc06
BLAKE2b-256 37debea092f4152d6f327673fe15e5b4c659a7571ff064cf9314792b38848e47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page