Labsco
davstr1 logo

peekaboo-mcp

from davstr1

A minimal MCP server providing read-only access to the file system.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

peekaboo-mcp

Minimal Model Context Protocol (MCP) server for read-only file system access.

The Problem

Claude Code (or any AI coding agent) often makes broader changes than intended. You ask it to fix a simple bug, and it refactors half your codebase. This happens because Claude Code has full read/write access to everything in your project directory.

The Solution

Peekaboo-mcp lets you isolate what Claude Code (or any AI agent) can modify while still giving it visibility into your entire codebase. Simply:

  1. Open your editor in a small, dedicated workspace folder
  2. Let peekaboo-mcp provide read-only access to your actual project.

Now Claude Code can see all the context it needs but can only modify files in your controlled workspace.

Features

  • List directory contents recursively by default
  • Read file contents with MIME type detection
  • Search files by name pattern (glob support)
  • Search content within files
  • Strict read-only access (no write/edit/delete operations)
  • Path traversal protection
  • Automatic project root detection (accesses only the project where installed)
  • Configurable recursion depth
  • Resource management (timeouts, file size limits)
  • Comprehensive test coverage

Security

  • All file access is strictly read-only
  • Automatic project root detection prevents access outside the installed project
  • Path traversal above the project root is blocked
  • No write, edit, or delete operations are supported
  • No user-configurable root directory (prevents manipulation by LLMs or malicious actors)

API

Resources

  1. List Resources: Returns all files and directories from the root (recursive by default)
  2. Read Resource: Returns the content of a specific file

Resources are accessed via file:// URIs relative to the configured root.

Tools

  1. search_path: Search for files and directories by name pattern

    • Supports wildcards: * (any characters), ** (any directories), ? (single character)
    • Examples: *.ts, src/**/*.js, test-?.md
  2. search_content: Search for content within files

    • Optional file pattern filter
    • Case-insensitive by default
    • Returns matching lines with line numbers

Resource Limits

Default limits (configurable via ServerConfig):

  • Timeout: 30 seconds per operation
  • Max file size: 10MB per file
  • Max total size: 100MB for directory listings

Operations that exceed these limits will fail with appropriate error messages.

Testing

Run the test suite:

Copy & paste โ€” that's it
npm test

See docs/TESTING.md for detailed testing information.

Example Client

See examples/test-client.js for a complete example of using peekaboo-mcp with the MCP SDK.

Documentation