Skip to main content

file-tools

file-tools

Precise file ops & bounded commands for agents — local or SSH.

GitHub Python Rust MCP Platforms License


What it is

file-tools gives coding agents a small, explicit toolkit for working with files and foreground commands:

Surface Purpose
read Line windows and tails (agent-friendly offsets)
write Full-file create / replace
edit Unique-match literal edits
apply_patch Multi-file structured patches
bash Bounded foreground commands

Same tools, three ways in:

Python API  ·  MCP server  ·  CLI

Work locally or over SSH with the same interface — pick a client, pass cwd, go.

Prefer the host’s built-in Read / Write / Edit / Bash for ordinary local work. Use file-tools when you need SSH-backed work, stricter edit/patch semantics, or an explicit MCP surface.


Why agents use it

  • One workspace at a time — every call takes an explicit cwd (local path or remote path).
  • Local and remote parity — client="local" or client="ssh" on every tool.
  • Safe-by-default SSH — system OpenSSH, keys/agent/~/.ssh/config; explicit passwords stay out of process argv.
  • Bounded file I/O — line windows stream with a configurable transfer cap instead of loading whole files into Python.
  • Conflict-aware writes — atomic replace, version checks, and deterministic patch rollback prevent silent lost updates.
  • Predictable agent contract — 1-based line offsets; negative offset means “tail”.
  • Bounded shell — timeouts, retained head/tail output, no sandbox theatre, no hidden background manager.
  • Host-ready — ships as MCP + plugins for Codex, Claude Code, Grok, and Cursor.

Quick start

Library

uv add mcp-file-tools   # or: pip install mcp-file-tools
# from source (native extension):
uv sync --extra dev && uv run maturin develop --release --uv
from file_tools import read, edit, get_client

client = get_client(client="local", cwd="/path/to/project")
print(read("README.md", offset=1, limit=40, client=client).content)

edit("src/app.py", "old", "new", client=client)

MCP

# from a source checkout (portable launcher)
python scripts/file_tools_mcp.py
# or, with the package installed:
file-tools-mcp

Tools exposed: read · write · edit · apply_patch · bash

CLI

file-tools read README.md --cwd "$PWD" --limit 40
printf 'hello\n' | file-tools write notes.txt --cwd "$PWD"
file-tools bash 'git status --short' --cwd "$PWD"

SSH in one glance

from file_tools import get_client, read

client = get_client(
    client="ssh",
    ssh_host="host.example.com",
    ssh_port=22,
    ssh_user="user",
    cwd="/home/user/project",
)
print(read("README.md", client=client).content)

The Python API, CLI, and MCP tools accept the same client and ssh_xxx parameters for all five tools. ssh_host may be an alias from ~/.ssh/config. Prefer keys/agent over passwords. Repeated MCP calls reuse cached clients and OpenSSH control sockets internally.


Agent plugins

Install from the remote repo krkawzq/file-tools (not a local path).

Host Install
Codex
codex plugin marketplace add krkawzq/file-tools
codex plugin add file-tools@file-tools
Claude Code
claude plugin marketplace add krkawzq/file-tools
claude plugin install file-tools@file-tools
Grok
grok plugin marketplace add krkawzq/file-tools
grok plugin install file-tools --trust
Cursor Publish / install via Cursor marketplace or team catalog using this repo.

Plugins share the same skills and MCP tools; only the host manifest differs.

After installing or updating a plugin, invoke its bundled config-file-tools skill once. It resolves the host's active plugin cache, installs the latest compatible krkawzq/file-tools release wheel and fastmcp into that root's .venv, and verifies MCP discovery. Plugin installs do not require a local Rust toolchain or Maturin build.


Requirements

Python 3.12+
Runtime dep fastmcp (MCP)
Native core Built via Maturin / shipped wheel (Rust)
SSH System OpenSSH client

From source:

uv sync --extra dev
uv run maturin develop --release --uv
uv run pytest

Project map

file-tools/
├── src/file_tools/     # Python API, MCP, CLI
├── src/core-rs/        # Native I/O & algorithms
├── skills/             # Agent skills (shared)
├── scripts/            # Portable MCP launcher
├── .mcp.json           # Project MCP entry
├── .codex-plugin/      # Codex
├── .claude-plugin/     # Claude Code
├── .grok-plugin/       # Grok
└── .cursor-plugin/     # Cursor

License

MIT · krkawzq/file-tools

Metadata

Release files for mcp-file-tools 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-file-tools 0.2.0
File Size Uploaded
mcp_file_tools-0.2.0.tar.gz 91.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mcp-file-tools 0.2.0
File
mcp_file_tools-0.2.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details
mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
mcp_file_tools-0.2.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details

Total release size: 2.2 MB

Release files / mcp_file_tools-0.2.0.tar.gz

Download URL mcp_file_tools-0.2.0.tar.gz
Size 91.7 kB
Tags Source
SHA-256 checksum
How to use checksums
13648b3134aee14a52bf9441e4d3155bb2f15c2d53e77bdced5479d7a36525ff
BLAKE2b-256 checksum
How to use checksums
1515b552dfdfbd36903dd86d9d30ff023154d17a4e79468bf0fb9764a55ec213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / mcp_file_tools-0.2.0-cp312-abi3-win_amd64.whl

Download URL mcp_file_tools-0.2.0-cp312-abi3-win_amd64.whl
Size 445.9 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4efec5f99743bf9e5cebf75635adb142750842d58c4bd2537596cf960699eb78
BLAKE2b-256 checksum
How to use checksums
b18026a05406a105d9d0dc9c3e666fac935a7ba47a5d1c0f8bd7e209b33b1e60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 567.7 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d01a68e1c1ec5d7e6ecb13590ae891cb8a35637d2dd6f8ba9cef99fe1bd6c595
BLAKE2b-256 checksum
How to use checksums
d5c618740699af11b10bd41a84d6dc3bf67c70f376655ab35b2b97fbee711b99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcp_file_tools-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 563.4 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
198c8842dca1cfd8de7ff9ed88447c5799b499c87de0026d56fc5fee432b9341
BLAKE2b-256 checksum
How to use checksums
3e9c80cd8214331fe22b52f1a0ad1b062d17dafe1c1a5b5df297e6bab6878f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / mcp_file_tools-0.2.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL mcp_file_tools-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Size 513.5 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7ba93be3a86b97e5fa9a0480b205ff5a3d93c90333f4aed7ed46435f42fb040d
BLAKE2b-256 checksum
How to use checksums
155a7f31a0155d4614e82153119db80c0941ead55bcd6ed89f3836a1d2bcd258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.3.0

5 release files

This release

0.2.0 This release

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page