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 plus socksio 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.3.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.3.0
File Size Uploaded
mcp_file_tools-0.3.0.tar.gz 92.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mcp-file-tools 0.3.0
File
mcp_file_tools-0.3.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
mcp_file_tools-0.3.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.3.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
mcp_file_tools-0.3.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.3.0.tar.gz

Download URL mcp_file_tools-0.3.0.tar.gz
Size 92.6 kB
Tags Source
SHA-256 checksum
How to use checksums
77903b5226be183eac82bb2971a457d46354b3e33fdaf67de048a9701fdc3cb5
BLAKE2b-256 checksum
How to use checksums
7fd5eeb07cae67e255b7724a590d232633c14f06d365677c61d1cf9fc0ddc394
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.3.0-cp312-abi3-win_amd64.whl

Download URL mcp_file_tools-0.3.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
a3c0a0c731142fe23628ff85c2488d19858027d59f5e7754eea6184b21bdaf39
BLAKE2b-256 checksum
How to use checksums
5de600d1539cb02fdfcc19b51eaab57930b56bd982db1c122bb5165e1279a77b
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.3.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mcp_file_tools-0.3.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 567.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
95a8d29a196a13662506fe19e3381266f04d9dbe1569d922bf3855c6482c3349
BLAKE2b-256 checksum
How to use checksums
bd4d9eab94daa9aaf5836e20331f8a617e5b918f67d2a5f76798f77b41d3db1c
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.3.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mcp_file_tools-0.3.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 564.5 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5c15b79f3ecac67960fe14115d5153dca9b5b71ea695e46f22110f40c1fd3c78
BLAKE2b-256 checksum
How to use checksums
3a3ffa94da426ed6a7e5cb526f5a8cb06b8b9d1c62640b4d91a8126f68524e03
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.3.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL mcp_file_tools-0.3.0-cp312-abi3-macosx_11_0_arm64.whl
Size 515.7 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4113679bfc84de4184ac344775132b43247e3877a2e1cb4ba8c784ffcc970cc1
BLAKE2b-256 checksum
How to use checksums
03c7bafc91a90daee2519ed09c542da125c0f6cb169ad9d1488ff79b33aa2d0f
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

This release

0.3.0 This release

5 release files

0.2.0

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