Skip to main content
Glama

ab_mcp — give an AI a folder, not your whole disk

I kept wanting to let Claude help with a project folder — "what's in here?", "find every TODO", "read me that config" — without giving it the keys to my entire filesystem. So I wrote this.

It's a tiny Model Context Protocol server: it hands an AI assistant a handful of file tools, all locked to one folder you choose. Reading is on by default; writing is off until you say otherwise. The whole thing is a single, readable server.py — so before you trust it, you can actually read it.

Why you might want this: "AI can read my files" and "AI can rewrite my files" are very different levels of trust. This server lets you start with the first and opt into the second only when you mean to.

What it can do

Tool

What it does

list_files(subdir=".")

List files/folders under the root

read_file(path)

Read a text file (size-capped)

read_lines(path, start=1, end=0)

Read a line range — for files too big to read whole

search_files(query, subdir=".", max_results=0)

Case-insensitive text search across files

find_files(pattern="*", subdir=".")

Find files by name/glob, e.g. *.py

file_stats(path=".")

Line/word/char counts, or directory size

write_file(path, content)

Create/overwrite a file — disabled unless AB_MCP_ALLOW_WRITE is set

Every path is confined to the root directory — requests that try to escape it (../../etc/passwd) are rejected.

Related MCP server: File MCP Server

Setup

cd ab_mcp
python -m venv .venv
source .venv/Scripts/activate      # Windows Git Bash
# .venv\Scripts\activate           # Windows PowerShell/cmd
pip install -r requirements.txt

Try it standalone (dev inspector)

mcp dev server.py

This opens the MCP Inspector in your browser so you can click each tool and see output.

Run it directly

python server.py

The server speaks stdio — it waits for an MCP client to connect. That's normal; it won't print anything on its own.

Configuration

Everything is controlled with environment variables — no code edits needed:

Variable

Default

Purpose

AB_MCP_NAME

ab_mcp

Server name advertised to MCP clients

AB_MCP_ROOT

this project folder

The single folder all tools are confined to

AB_MCP_MAX_BYTES

200000

Max file size (bytes) that read_file will read whole

AB_MCP_MAX_RESULTS

50

Default number of search hits before stopping

AB_MCP_LINE_PREVIEW

200

Characters of each matching line shown in search results

AB_MCP_ENCODING

utf-8

Text encoding used to read files

AB_MCP_ALLOW_WRITE

(off)

Set to 1/true/yes to enable the write_file tool

AB_MCP_IGNORE

.venv,venv,__pycache__,.git,node_modules,.idea

Comma-separated folders to skip

Example — point it at any folder, allow larger files, ignore a dist dir:

AB_MCP_ROOT="/path/to/your/folder" \
AB_MCP_MAX_BYTES=500000 \
AB_MCP_IGNORE=".git,dist,build" \
python server.py

Connect it to Claude Desktop

Edit claude_desktop_config.json (%APPDATA%\Claude\claude_desktop_config.json on Windows) and add:

Replace the paths with the absolute path to your own clone:

{
  "mcpServers": {
    "ab_mcp": {
      "command": "C:\\path\\to\\ab_mcp\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\ab_mcp\\server.py"],
      "env": {
        "AB_MCP_ROOT": "C:\\path\\to\\the\\folder\\to\\expose"
      }
    }
  }
}

Restart Claude Desktop. You'll see the ab_mcp tools available in the chat.

Connect it to Claude Code

claude mcp add ab_mcp -- /path/to/ab_mcp/.venv/Scripts/python.exe /path/to/ab_mcp/server.py

License

MIT — see the LICENSE file. Add your name to the copyright line before publishing.

Available Tools

7 tools
file_statsA

Report quick stats for a file (lines/words/chars) or a directory (file count and total size).

Args: path: File or directory relative to the root.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathNo.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and description lacks details on behavior (e.g., read-only, performance, error handling). It only states output types.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is short, front-loaded, and efficient—one line for purpose, one for parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so return values are covered. Description covers core functionality, but lacks edge cases or limitations. Adequate for a simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has no description (0% coverage), but description explains the 'path' parameter as 'file or directory relative to root', adding meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it reports stats for files (lines/words/chars) or directories (file count/total size). It distinguishes from sibling tools like list_files or read_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives context but no explicit guidance on when to use vs. alternatives or when not to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

find_filesA

Find files by name pattern (glob), e.g. ".py" or "test_".

Args: pattern: A glob pattern matched against file names. subdir: Limit the search to this subdirectory. Use "." for everything.

ParametersJSON Schema
NameRequiredDescriptionDefault
patternNo*
subdirNo.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must disclose all behavioral traits. It mentions glob matching and subdirectory limiting but does not clarify if search is recursive, whether hidden files are included, or any edge cases. Lacks depth for a read tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is minimal and efficient: one sentence overview plus parameter list. Every sentence adds value; no fluff. Front-loaded with action and example.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple tool with two parameters and an output schema, the description covers the essential usage. Missing details like recursion depth and hidden file behavior, but output schema handles return values. Adequate for most agents.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description explains both parameters: 'pattern' as a glob pattern, 'subdir' as directory limit with '.' for everything. This adds significant meaning beyond the schema defaults, though could be more precise about pattern scope (e.g., full path vs basename).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool finds files by name pattern using glob, with examples. It distinguishes from siblings like list_files and search_files by focusing on name-based pattern matching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for name-pattern searches but does not explicitly state when to use this tool versus alternatives like search_files or list_files. No exclusion criteria or when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_filesA

List files and folders inside the sandbox root (or a subdirectory).

Args: subdir: Path relative to the root. Use "." for the root itself.

ParametersJSON Schema
NameRequiredDescriptionDefault
subdirNo.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It declares the operation as listing files/folders, which is non-destructive and read-only. The output schema further clarifies the return structure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: one for purpose, one for parameter. No wasted words. Front-loaded with the action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given low complexity, presence of output schema, and sibling tools, the description adequately covers the tool's behavior without missing critical details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description adds meaning: 'subdir: Path relative to the root. Use "." for the root itself.' This clarifies usage beyond the schema type and default.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'List files and folders inside the sandbox root (or a subdirectory).' This distinguishes it from siblings like find_files (recursive search) and read_file (content reading).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the subdir parameter (path relative to root, '.' for root). It provides clear context but does not explicitly state when not to use the tool or mention alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_fileB

Read the contents of a text file inside the sandbox root.

Args: path: File path relative to the root.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description only states the basic action. Lacks disclosure of behavioral traits such as read-only nature, file size limits, encoding assumptions, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: one for purpose, one for parameter. No unnecessary words, but could benefit from a more structured format (e.g., separate sections).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although the tool has an output schema, the description does not clarify what is returned. Lacks details on error cases (e.g., file not found) or encoding, leaving gaps for a simple but complete understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but the description adds that 'path' is relative to the root. This provides minimal additional meaning beyond the schema's type and title.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Read the contents of a text file inside the sandbox root.' This distinguishes it from siblings like file_stats, find_files, list_files, read_lines, search_files, and write_file by specifying reading a text file's contents within a constrained location.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. Does not mention when not to use or provide comparisons to siblings like read_lines or search_files.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_linesA

Read a slice of lines from a text file — useful for files too large for read_file to return whole.

Args: path: File path relative to the root. start: First line to read (1-based). end: Last line to read (inclusive). 0 means "to end of file".

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
startNo
endNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds useful behavioral details (1-based line numbering, end=0 means to end of file), but could explicitly state the operation is read-only (no side effects). Since annotations are missing, the description adequately covers safety implicitly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences plus an Args list—no wasted words. Purpose is front-loaded in the first sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers input parameters fully and provides usage context. Output format is not described, but an output schema exists (not shown) which presumably handles that. Minor gap: no mention that lines are returned as an array.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description provides detailed explanations for all three parameters (path, start, end), including semantics for start (1-based) and end (inclusive, 0 for end). This fully compensates for missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool reads a slice of lines from a text file, and explicitly distinguishes it from the sibling tool read_file by noting it handles files too large for read_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names the alternative (read_file) and specifies when to use this tool (for large files) versus the alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_filesA

Search for a plain-text string across text files (case-insensitive).

Returns matching lines with their file path and line number.

Args: query: The text to search for. subdir: Limit the search to this subdirectory. Use "." for everything. max_results: Stop after this many matching lines. 0 uses the server default.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
subdirNo.
max_resultsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses case-insensitivity and return format, but omits important behaviors: is search recursive? Does it skip binary files? What's the default max_results value and behavior? No annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise and well-structured with separate sections for purpose, returns, and Args. No redundant phrases, though the Args section could be slightly more integrated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, return format, and parameters. Missing details on recursive behavior, default max_results value, and whether binary files or large files are handled. Adequate but not complete for full agent decision-making.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 0% description coverage. Description adds meaning for all three parameters: query (text to search), subdir (limit to subdirectory, '.' for everything), max_results (stop after N lines, 0=server default). Adds significant value beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Search for a plain-text string across text files (case-insensitive)' and describes return format (matching lines with path and line number). Distinguishes from siblings like find_files (file name search).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. Doesn't mention scope (recursive or not), file type handling, or limitations. Lacks context for optimal usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

write_fileA

Create or overwrite a text file inside the sandbox root.

Disabled unless the server was started with AB_MCP_ALLOW_WRITE enabled.

Args: path: File path relative to the root. content: The full text to write.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
contentYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries the burden. It discloses destructive behavior (overwrite) and that it operates on text files in the sandbox root, but lacks details on error handling or behavior when the path does not exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (3 sentences), front-loaded with the purpose, and uses clear bullet-style argument descriptions without unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple write tool with 2 parameters and an output schema, the description covers the core functionality, prerequisite, and parameter semantics. Could be improved by mentioning that content replaces the entire file (not append) or what happens on invalid paths.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds crucial context: 'path' is relative to root, and 'content' is the full text to write. This clarifies usage beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create or overwrite') and the resource ('text file inside the sandbox root'), distinguishing it from sibling tools that read or list files.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides an explicit prerequisite ('Disabled unless the server was started with AB_MCP_ALLOW_WRITE enabled'), but does not compare directly to siblings or specify when to use this tool vs alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 7 tool updatesv0.1.0
    • First observedfile_stats
    • First observedfind_files
    • First observedlist_files
    • First observedread_file
    • First observedread_lines
    • First observedsearch_files
    • First observedwrite_file

TDQS

A4/5.0

Scored across 7 tools

Disambiguation5/5

Each tool has a distinct purpose: file_stats reports statistics, find_files searches by glob, list_files lists directory contents, read_file reads entire file, read_lines reads specific lines, search_files searches for text, and write_file writes content. No two tools overlap in functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern using snake_case: file_stats, find_files, list_files, read_file, read_lines, search_files, write_file. The naming is predictable and uniform.

Tool Count5/5

With 7 tools, the set is well-scoped for a sandbox file system utility. It provides essential operations (read, write, list, search, find, stats) without being overly numerous or sparse.

Completeness4/5

The tool set covers core file operations well, but lacks delete, rename, or move functionality. Given the sandbox context and conditional write, these omissions are minor and do not severely hinder typical workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.
    6 npm
    10
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that enables AI assistants to perform comprehensive file operations including finding, reading, writing, editing, searching, moving, and copying files with security validations.
    7
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A secure, sandboxed file system server that enables reading, writing, searching, and managing files through MCP-compatible AI clients with path traversal protection and size limits.
    -
  • F
    license
    A
    quality
    C
    maintenance
    A read-only MCP server that enables AI assistants to search files, list directories, retrieve system info, and get file metadata on the local file system.
    4
    -