Peekaboo MCP
Provides read-only access to your entire codebase while restricting AI agents to only modify files in a specific workspace folder, preventing unintended broad changes.
README
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:
- Open your editor in a small, dedicated workspace folder
- 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.
Quick Start
-
Install peekaboo-mcp in your project root:
cd /path/to/your/project npm install peekaboo-mcp -
Configure your AI tool:
For Claude Desktop: Add to
~/Library/Application Support/Claude/claude_desktop_config.json(Mac):{ "mcpServers": { "peekaboo": { "command": "npx", "args": ["peekaboo-mcp"], "cwd": "/path/to/your/project" } } }For Claude Code (CLI):
# One-time setup: Navigate to your project and add peekaboo cd /path/to/your/project claude mcp add peekaboo npx peekaboo-mcp # From now on, just start Claude Code claude # Claude automatically launches peekaboo when it starts! # Optional: Check MCP server status > /mcp # Should show: peekaboo: connected ✓For Cursor.AI: Create
.cursor/mcp.jsonin your home directory or project:{ "mcpServers": { "peekaboo": { "command": "npx", "args": ["-y", "peekaboo-mcp"], "cwd": "/path/to/your/project" } } }Or use Cursor Settings UI:
- Open Command Palette (Ctrl/Cmd + Shift + P)
- Search for "Cursor Settings"
- Navigate to MCP Servers section
- Add peekaboo-mcp with the project path
Important: You don't need to manually launch peekaboo! Claude Desktop, Claude Code, and Cursor all automatically start the MCP server when they need it.
-
Open ONLY the folder you want AI to work on:
Instead of opening your entire project, open just the specific folder you want modified:
# Example: You want AI to work on your React components cursor /path/to/your/project/src/components # Or: You want AI to refactor your API routes cursor /path/to/your/project/api/routesResult: The AI can now:
- ✅ Read your ENTIRE project (understands full context)
- ✅ Only modify files in
/src/components(or whatever folder you opened) - ❌ Cannot touch files outside the opened folder
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
Installation
npm install peekaboo-mcp
Usage
As a standalone server
# Run from your project (automatically detects project root)
npx peekaboo-mcp
# Disable recursive listing
PEEKABOO_RECURSIVE=false npx peekaboo-mcp
# Set custom max depth (default: 10)
PEEKABOO_MAX_DEPTH=5 npx peekaboo-mcp
Note: peekaboo-mcp automatically detects and uses the project root where it's installed. It cannot access files outside of this project for security reasons.
As a module
import { createPeekabooServer, findProjectRoot } from 'peekaboo-mcp';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
// Automatically detect project root
const rootDir = findProjectRoot();
// Default: recursive listing enabled, max depth 10
const server = createPeekabooServer(rootDir);
// Or with custom config
const server = createPeekabooServer(rootDir, {
recursive: false, // Disable recursive listing
maxDepth: 5, // Limit recursion depth
timeout: 60000, // 60 second timeout (default: 30s)
maxFileSize: 5 * 1024 * 1024, // 5MB max file size (default: 10MB)
maxTotalSize: 50 * 1024 * 1024 // 50MB max total size (default: 100MB)
});
const transport = new StdioServerTransport();
await server.connect(transport);
MCP Client Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"peekaboo": {
"command": "npx",
"args": ["peekaboo-mcp"]
}
}
}
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
- List Resources: Returns all files and directories from the root (recursive by default)
- Read Resource: Returns the content of a specific file
Resources are accessed via file:// URIs relative to the configured root.
Tools
-
search_path: Search for files and directories by name pattern
- Supports wildcards:
*(any characters),**(any directories),?(single character) - Examples:
*.ts,src/**/*.js,test-?.md
- Supports wildcards:
-
search_content: Search for content within files
- Optional file pattern filter
- Case-insensitive by default
- Returns matching lines with line numbers
Configuration
Environment variables:
PEEKABOO_RECURSIVE: Enable recursive listing (default: true, set to 'false' to disable)PEEKABOO_MAX_DEPTH: Maximum recursion depth (default: 10)
The root directory is automatically detected based on where peekaboo-mcp is installed and cannot be overridden.
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:
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
- Testing Guide - How to run and write tests
- MCP Response Reference - Expected server responses
- Example Client - Working client implementation
- Troubleshooting - Common issues and solutions
- Contributing - Development guide
FAQ
Q: Can I access files outside my project?
A: No, for security reasons peekaboo-mcp only accesses files within the project where it's installed.
Q: How do I search for files?
A: Use the search_path tool with glob patterns like *.js or src/**/*.ts.
Q: What file types are supported?
A: All text files are supported. Binary files are detected but content reading may be limited.
Q: How do I increase file size limits?
A: Configure the server with custom limits - see the API section above.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。