local_dev_from_filesystem
Set up a local development environment by specifying a filesystem path. Ideal for creating isolated sandboxes to run tests, analyze coverage, and manage Python, Node, Bun projects directly from your local directory.
Instructions
Create a new local development environment from a filesystem path
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Local filesystem path |
Input Schema (JSON Schema)
{
"properties": {
"path": {
"description": "Local filesystem path",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
}
Implementation Reference
- src/mcp_local_dev/server.py:103-120 (handler)Handler for the 'local_dev_from_filesystem' tool: calls create_environment_from_path with the provided path and returns a JSON response containing the environment ID, working directory, creation time, and runtime.elif name == "local_dev_from_filesystem": env = await create_environment_from_path(arguments["path"]) return [ types.TextContent( type="text", text=json.dumps( { "success": True, "data": { "id": env.id, "working_dir": str(env.sandbox.work_dir), "created_at": env.created_at.isoformat(), "runtime": env.runtime_config.name.value, }, } ), ) ]
- src/mcp_local_dev/server.py:35-45 (schema)Tool schema definition including name, description, and input schema requiring a 'path' parameter.types.Tool( name="local_dev_from_filesystem", description="Create a new local development environment from a filesystem path", inputSchema={ "type": "object", "properties": { "path": {"type": "string", "description": "Local filesystem path"} }, "required": ["path"], }, ),
- src/mcp_local_dev/server.py:23-68 (registration)The tool is registered in the global 'tools' list returned by list_tools(), which includes the 'local_dev_from_filesystem' tool.tools = [ types.Tool( name="local_dev_from_github", description="Create a new local development environment from a GitHub repository", inputSchema={ "type": "object", "properties": { "github_url": {"type": "string", "description": "GitHub repository URL"} }, "required": ["github_url"], }, ), types.Tool( name="local_dev_from_filesystem", description="Create a new local development environment from a filesystem path", inputSchema={ "type": "object", "properties": { "path": {"type": "string", "description": "Local filesystem path"} }, "required": ["path"], }, ), types.Tool( name="local_dev_run_tests", description="Auto-detect and run tests in a local development environment", inputSchema={ "type": "object", "properties": { "env_id": {"type": "string", "description": "Environment identifier"} }, "required": ["env_id"], }, ), types.Tool( name="local_dev_cleanup", description="Clean up a local development environment", inputSchema={ "type": "object", "properties": { "env_id": {"type": "string", "description": "Environment identifier"} }, "required": ["env_id"], }, ), ]
- Core helper function invoked by the handler: creates a sandbox, copies the filesystem path contents, detects and installs the runtime, and returns an Environment object.async def create_environment_from_path(path: Path) -> Environment: """Create new environment from filesystem path.""" env_id = b58_fuuid() sandbox = await create_sandbox(f"mcp-{env_id}-") shutil.copytree(path, sandbox.work_dir, dirs_exist_ok=True) os.chmod(sandbox.work_dir, 0o700) os.chmod(sandbox.bin_dir, 0o700) runtime_config = detect_runtime(sandbox) await install_runtime(sandbox, runtime_config) env = Environment( id=env_id, runtime_config=runtime_config, sandbox=sandbox, created_at=datetime.now(timezone.utc), ) _ENVIRONMENTS[env_id] = env return env