loading…
Search for a command to run...
loading…
A FastMCP-based server that provides secure sandboxed filesystem operations, API integration tools, and curated reasoning prompts for analysis and productivity
A FastMCP-based server that provides secure sandboxed filesystem operations, API integration tools, and curated reasoning prompts for analysis and productivity tasks.
A FastMCP-based server for the penr-oz project with secure sandboxed filesystem operations. This repository provides tools for reading files and listing directories within a protected sandbox environment.
Create and activate a virtual environment first:
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
For development and testing:
pip install -e ".[dev]"
python server.py # stdio server
fastmcp run server.py # if using the FastMCP CLI
The server provides a curated collection of reusable MCP prompts demonstrating best practices for common reasoning and analysis tasks.
summarize_text(text: str)
extract_tasks(text: str)
analyze_code(code: str, language: str = "python")
write_design_doc(feature_description: str, context: str = "")
refactor_instructions(code: str, issues: str, language: str = "python")
summarize_prompt(text: str) - Deprecated
summarize_text()summarize_text() for new integrationsThe server provides tools for integrating with external HTTP APIs, demonstrating asynchronous operations with comprehensive error handling.
fetch_json(url: str, timeout: float = 10.0)
fetch_json("https://api.github.com/repos/python/cpython")Error Handling:
InvalidURLError: Malformed URLs or unsupported schemesTimeoutError: Request exceeds timeout duration (default: 10s)HTTPError: Server returns error status (4xx, 5xx)JSONDecodeError: Response is not valid JSONAPIError: Other network or request errorsUsage Examples:
# Fetch repository information
await fetch_json("https://api.github.com/repos/python/cpython")
# With custom timeout
await fetch_json("https://api.example.com/data", timeout=5.0)
Out of Scope:
The server provides secure, read-only access to files within a configured sandbox directory (./sandbox/). All file paths are validated to prevent directory traversal attacks.
list_files(path: str = "")
list_files("docs") to list the docs subdirectoryread_text_file(path: str)
read_text_file("welcome.txt")ozfs://{path}
ozfs://docs/guide.md returns the file contents./sandbox/ directory../) are blockedAll tools and resources use Pydantic models for input validation. Invalid inputs return structured error messages before any business logic runs.
ListFilesInput
{"path": "docs"}
path (string, default: "") — Relative path within sandboxReadTextFileInput
{"path": "welcome.txt"}
path (string, required, min length: 1) — Relative path to file within sandboxFetchJsonInput
{"url": "https://api.github.com/repos/python/cpython", "timeout": 10.0}
url (string, required, min length: 1) — HTTP(S) URL to fetchtimeout (float, default: 10.0, range: (0, 300]) — Request timeout in secondsOzfsResourceInput
{"path": "docs/guide.md"}
path (string, required, min length: 1) — File path within sandboxFileEntry
{"name": "welcome.txt", "type": "file", "path": "welcome.txt", "size": 128}
name (string) — File or directory nametype (string) — "file" or "directory"path (string) — Relative path within sandboxsize (int or null) — File size in bytes (null for directories)Invalid inputs return structured errors:
Validation error: 1 issue(s) found
- path: String should have at least 1 character
penr-oz-mcp-server/
|-- pyproject.toml
|-- README.md
|-- server.py
|-- app/
| |-- __init__.py
| |-- api.py # API integration tools (fetch_json)
| |-- config.py # Server configuration and sandbox settings
| |-- errors.py # Centralized validation error handling
| |-- filesystem.py # Filesystem operations with security validation
| |-- models.py # Pydantic models for input/output validation
| |-- tools.py # MCP tools (ping, list_files, read_text_file)
| |-- resources.py # MCP resources (info, ozfs://)
| `-- prompts.py # MCP prompt templates
|-- sandbox/ # Sandboxed filesystem directory
| |-- README.md
| |-- welcome.txt
| |-- docs/
| `-- data/
`-- tests/
|-- test_server_smoke.py
|-- test_filesystem.py # Filesystem security and functionality tests
|-- test_api.py # API integration tests
|-- test_prompts.py # Prompt template tests
`-- test_models.py # Pydantic model and validation tests
app/api.py - API integration tools for external HTTP services (fetch_json)app/config.py - Server metadata, environment flags, and sandbox configurationapp/errors.py - Centralized validation error formatting and extractionapp/filesystem.py - Secure filesystem operations with path validationapp/models.py - Pydantic models for tool/resource input and output validationapp/tools.py - MCP tools (ping, list_files, read_text_file)app/resources.py - MCP resources (info, ozfs://)app/prompts.py - MCP prompt templatesserver.py - Server initialization and component registrationDefine a new tool/resource/prompt in the relevant module, then register it in server.py.
Example registration:
from app.tools import ping
mcp.add_tool(ping)
Run the test suite locally:
pytest
This project uses GitHub Actions to automatically run tests on every push and pull request. The CI workflow tests the codebase against Python 3.10, 3.11, and 3.12 to ensure compatibility across versions.
Tests must pass before pull requests can be merged. You can view the test results in the Actions tab or by clicking the badge at the top of this README.
Run in your terminal:
claude mcp add penr-oz-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.