filekeeper-mcp

v0.1.9
filekeeper-mcp Checked 1 day ago Published 25 days ago

MCP server that exposes Filekeeper's filesystem operations to agent hosts.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

workspace_list

List the workspaces registered in the server's home directory. Read-only. The configured default is named separately. Registration is administration done elsewhere; this tool never registers or removes one.

workspace_info

Describe the selected workspace, or one registered workspace by name. Read-only. Reports the workspace name, identifier, registered root, whether the selection is a transient --root rather than a registration, and — for the selected workspace — whether its root is writable right now, so a caller can tell a misconfiguration from a permission failure before attempting a write. It also reports the server's own package ``version``, so a caller can record which build it measured without running the binary. It does not create, select or modify a workspace.

ParameterTypeDescription
workspace

file_read

Read a text file, optionally a bounded line range. Line numbers are 1-based and inclusive. Omitting both returns from the first line. A byte limit smaller than the range truncates honestly: truncated, truncation_reason and next_start_line say where to resume. A UTF-8 byte-order mark is preserved and line endings are returned exactly as stored. Binary content is refused with BINARY_CONTENT_REFUSED unless an encoding is named. Read-only; no history is recorded. With a workspace rooted at the filesystem root, the reported path keeps its leading '/' so it is exactly the absolute path.

ParameterTypeDescription
path *string
encoding
end_line
max_bytes
start_line

file_read_many

Read several text files in one call (at most 32 paths). Each entry reports its own path, ok flag, result or error; one missing file does not hide the others. Line numbers are 1-based and inclusive and apply to every file. The call itself is read-only. More than 32 paths is refused with LIMIT_EXCEEDED rather than silently truncated.

ParameterTypeDescription
paths *array
end_line
max_bytes_per_file
start_line

directory_list

List directory entries under a workspace-relative path. Read-only. Recursion depth and entries are bounded by configuration; a truncated listing says so instead of pretending it is complete. The server refuses max_entries above 1000. Filekeeper's own .filekeeper/ state directory is never listed.

ParameterTypeDescription
glob
max_entries
pathstring
recursiveboolean

file_info

Report metadata for one path, including hash, encoding and newline for text. Read-only. The content_hash is what the guarded mutating tools accept as expected_hash. Symlink metadata describes the link, not its target. With a workspace rooted at the filesystem root, the reported path keeps its leading '/' so it is exactly the absolute path.

ParameterTypeDescription
path *string

file_create

Create a new text file and return operation_id and undo_available. Fails with ALREADY_EXISTS while expected_absent is true (the safe default); set it false to overwrite an existing file, which makes the call destructive. Writes are atomic. Credential-shaped targets are refused with SENSITIVE_PATH_REFUSED unless i_accept_secret_write_risk is true, which records a warning and is itself undoable. dry_run validates every guard and writes nothing, returning operation_id null. Otherwise the operation is recorded and undoable.

ParameterTypeDescription
content *string
path *string
dry_runboolean
encodingstring
expected_absentboolean
i_accept_secret_write_riskboolean

file_write

Replace a whole file with new content and return operation_id and undo_available. The replacement is atomic: a crash leaves the complete previous content. expected_hash guards against clobbering a file that changed since it was read; a mismatch is CONTENT_CONFLICT and nothing is written. The file's encoding and byte-order mark are inherited unless encoding is named. Credential-shaped targets are refused unless i_accept_secret_write_risk is true. dry_run validates and writes nothing. Otherwise the operation is recorded and undoable. Not idempotent: each successful call adds a history record.

ParameterTypeDescription
content *string
path *string
dry_runboolean
encoding
expected_hash
i_accept_secret_write_riskboolean

file_copy

Copy one file inside the workspace and return operation_id and undo_available. An occupied destination is refused unless expected_destination_hash matches its current content. The copy is not atomic across its two paths, but it is recorded as one operation, so undo restores both ends. The destination is subject to the credential-shaped refusal. dry_run writes nothing. Otherwise the operation is undoable.

ParameterTypeDescription
destination *string
source *string
dry_runboolean
expected_destination_hash
i_accept_secret_write_riskboolean

file_move

Move or rename one file inside the workspace and return operation_id and undo_available. An occupied destination is refused unless overwrite is true, which makes the call destructive at the destination. The move is recorded as one operation and undo restores both ends. Credential-shaped destinations are refused. dry_run writes nothing. Otherwise the operation is undoable.

ParameterTypeDescription
destination *string
source *string
dry_runboolean
i_accept_secret_write_riskboolean
overwriteboolean

file_delete

Delete one file and return operation_id and undo_available. Destructive. Deletes exactly the named file: no glob, no recursion, no directory removal, and no widening of the workspace root. expected_hash refuses the delete when the content changed since it was read (CONTENT_CONFLICT). dry_run validates and deletes nothing. Otherwise the operation is recorded, and undo restores the file while nothing else has recreated that path.

ParameterTypeDescription
path *string
dry_runboolean
expected_hash

directory_create

Create one directory and return operation_id and undo_available. Additive: no existing file or directory is replaced. parents controls whether missing ancestors may be created. dry_run validates and creates nothing. Otherwise the operation is recorded, and undo removes the directory only while everything inside it is exactly what the create produced.

ParameterTypeDescription
path *string
dry_runboolean
parentsboolean

directory_delete

Delete one directory and return operation_id and undo_available. Destructive. A non-empty directory requires recursive true and confirm_recursive true; one without the other is refused before anything is touched. The scope is exactly the named subtree inside the selected workspace root — this tool cannot delete outside it, and Filekeeper's own .filekeeper/ state directory is refused. dry_run lists what would be removed and deletes nothing. Otherwise the whole tree is recorded as one operation and is undoable.

ParameterTypeDescription
path *string
confirm_recursiveboolean
dry_runboolean
recursiveboolean

file_replace_text

Replace literal text and return operation_id, undo_available and the match stage. Matching is staged and the result always names the stage: exact first, then normalised (indentation and trailing whitespace tolerated, the replacement re-based onto the matched indentation), then a NO_MATCH refusal carrying the nearest candidate lines. match is required and is either first or all; there is no default policy. match_count reports the matches found, expected_match_count refuses a different number, and expected_content pins the exact text of one region.

ParameterTypeDescription
match *stringreplacement policy: 'first' or 'all'
new *string
old *string
path *string
dry_runboolean
expected_content
expected_hash
expected_match_count
i_accept_secret_write_riskboolean

file_replace_lines

Replace an inclusive 1-based line range and return operation_id and undo_available. Use this for genuinely positional work; file_replace_text is cheaper when the line numbers are not already known. Out-of-range references are refused, never clamped. The file's newline convention and byte-order mark are preserved, and a replacement without a trailing newline does not fuse lines. dry_run returns a unified diff preview and writes nothing. Otherwise the operation is recorded and undoable.

ParameterTypeDescription
end_line *integer
path *string
replacement *string
start_line *integer
dry_runboolean
expected_content
expected_hash

file_insert_lines

Insert text at a defined position and return operation_id and undo_available. line is a 1-based line number. position is before or after that line, or end to append at end of file, which takes no line number; there is no sentinel line number for end of file. Additive: no existing line is replaced. dry_run returns a unified diff preview and writes nothing. Otherwise the operation is recorded and undoable.

ParameterTypeDescription
content *string
path *string
dry_runboolean
expected_content
expected_hash
line
positionstring

file_delete_lines

Delete an inclusive 1-based line range and return operation_id and undo_available. Out-of-range references are refused, never clamped. The file's newline convention and byte-order mark are preserved. dry_run returns a unified diff preview and writes nothing. Otherwise the operation is recorded and undoable.

ParameterTypeDescription
end_line *integer
path *string
start_line *integer
dry_runboolean
expected_content
expected_hash

file_apply_patch

Apply a unified diff and return operation_id and undo_available. Destructive. The whole patch is parsed and every hunk is checked against its file before a byte is written; a failed or ambiguous hunk rejects the patch with PATCH_FAILED and leaves the pre-patch state intact. A hunk applies at its declared line or not at all: one whose preimage matches only elsewhere is refused with preimage_elsewhere and the positions where it does match. A patch is limited to 1048576 bytes here. A multi-file patch is recorded as one logical operation and is undoable, but its application is recoverable, not at…

ParameterTypeDescription
patch *string
dry_runboolean
expected_hash
i_accept_secret_write_riskboolean

history_list

List recorded operations in the selected workspace, newest first. Read-only. path narrows to operations touching that workspace-relative path; actor and task_id are filters, not authority, and never change what a mutation records. limit is capped at 200. Returns operation ids usable with history_get, history_diff and undo_operation. Paths are rendered when read: a workspace rooted at the filesystem root reports target and item paths with their leading '/' so they are absolute.

ParameterTypeDescription
actor
limitinteger
path
task_id

history_get

Show one recorded operation: status, actor, paths, before/after hashes and modes. Read-only. Unknown identifiers are OPERATION_NOT_FOUND. No file content is returned; use history_diff for a before/after diff.

ParameterTypeDescription
operation_id *string

history_diff

Show the recorded before/after unified diff for one operation. Read-only. Returns one entry per affected path with a textual unified diff, or is_binary true for content that has no textual diff. Never returns whole file bodies.

ParameterTypeDescription
operation_id *string

undo_operation

Undo one recorded operation and return the new operation_id and undo_available. Before writing, every affected path is compared with the operation's recorded before and after state. A path that matches neither was changed afterwards: the whole undo is refused with UNDO_CONFLICT and nothing is modified. A recorded move, copy or multi-file patch is undone as one operation. Undoing a create removes the file only while it still matches what was created. The undo is itself recorded; a refusal is recorded as an undo_refused row carrying the conflict code and the blocking paths, and that row is neve…

ParameterTypeDescription
operation_id *string

undo_last

Undo the most recent undoable operation in the selected workspace. Destructive. Same conflict rules as undo_operation: any path changed after the operation refuses the whole undo with UNDO_CONFLICT and modifies nothing. history_skipped entries in the result were above the history size cap and cannot be restored (HISTORY_UNAVAILABLE). The undo is itself recorded.