Skip to content

Commit 4247b7e

Browse files
committed
Update README, fix flaky test
1 parent 5259df7 commit 4247b7e

File tree

2 files changed

+93
-10
lines changed

2 files changed

+93
-10
lines changed

README.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,98 @@ A powerful Model Context Protocol (MCP) server for filesystem operations that pr
2121
- **Comprehensive Testing**: 75+ tests with behavior-driven approach
2222
- **Cross-Platform**: Works on Windows, macOS, and Linux
2323

24-
## Installation
24+
## Quickstart Guide
25+
26+
### 1. Clone and Setup
27+
28+
First, install uv if you haven't already:
29+
30+
```bash
31+
# Install uv using the official installer
32+
curl -fsSL https://raw.githubusercontent.com/astral-sh/uv/main/install.sh | bash
33+
34+
# Or with pipx
35+
pipx install uv
36+
```
2537

26-
### Development Setup
38+
Then clone the repository and install dependencies:
2739

2840
```bash
2941
# Clone the repository
30-
git clone https://github.com/yourusername/mcp-filesystem.git
42+
git clone https://github.com/safurrier/mcp-filesystem.git
3143
cd mcp-filesystem
3244

3345
# Install dependencies with uv
3446
uv pip sync requirements.txt requirements-dev.txt
3547
```
3648

49+
### 2. Get Absolute Paths
50+
51+
You'll need absolute paths both for the repository location and any directories you want to access:
52+
53+
```bash
54+
# Get the absolute path to the repository
55+
REPO_PATH=$(pwd)
56+
echo "Repository path: $REPO_PATH"
57+
58+
# Get absolute paths to directories you want to access
59+
realpath ~/Documents
60+
realpath ~/Downloads
61+
# Or on systems without realpath:
62+
echo "$(cd ~/Documents && pwd)"
63+
```
64+
65+
### 3. Configure Claude Desktop
66+
67+
Open your Claude Desktop configuration file:
68+
- On macOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
69+
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
70+
71+
Add the following configuration (substitute your actual paths):
72+
73+
```json
74+
{
75+
"mcpServers": {
76+
"mcp-filesystem": {
77+
"command": "uv",
78+
"args": [
79+
"--directory",
80+
"/absolute/path/to/mcp-filesystem",
81+
"run",
82+
"run_server.py",
83+
"/absolute/path/to/dir1",
84+
"/absolute/path/to/dir2"
85+
]
86+
}
87+
}
88+
}
89+
```
90+
91+
> **Important**: All paths must be absolute (full paths from root directory).
92+
> Use `realpath` or `pwd` to ensure you have the correct absolute paths.
93+
94+
### 4. Restart Claude Desktop
95+
96+
After saving your configuration, restart Claude Desktop for the changes to take effect.
97+
98+
## Installation
99+
37100
## Usage
38101

102+
### Watch Server Logs
103+
104+
You can monitor the server logs from Claude Desktop with:
105+
106+
```bash
107+
# On macOS
108+
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-filesystem.log
109+
110+
# On Windows (PowerShell)
111+
Get-Content -Path "$env:APPDATA\Claude\Logs\mcp-server-mcp-filesystem.log" -Tail 20 -Wait
112+
```
113+
114+
This is particularly useful for debugging issues or seeing exactly what Claude is requesting.
115+
39116
### Running the Server
40117

41118
Run the server with access to specific directories:
@@ -46,13 +123,17 @@ uv run run_server.py /path/to/dir1 /path/to/dir2
46123

47124
# Or using standard Python
48125
python run_server.py /path/to/dir1 /path/to/dir2
126+
127+
# Example with actual paths
128+
uv run run_server.py /Users/username/Documents /Users/username/Downloads
49129
```
50130

51131
#### Options
52132

53133
- `--transport` or `-t`: Transport protocol (stdio or sse, default: stdio)
54134
- `--port` or `-p`: Port for SSE transport (default: 8000)
55135
- `--debug` or `-d`: Enable debug logging
136+
- `--version` or `-v`: Show version information
56137

57138
### Using with MCP Inspector
58139

tests/test_cli.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import sys
88
import subprocess
99
import tempfile
10+
import os
1011
from dataclasses import dataclass
1112
from pathlib import Path
1213
from typing import Optional
@@ -51,10 +52,10 @@ def run_cli_command(args, cwd=None):
5152
name="help flag shows options",
5253
args=["--help"],
5354
expected_in_output=[
54-
"--transport",
55-
"--port",
56-
"--debug",
57-
"DIRECTORIES" # Should accept directories as arguments
55+
"transport",
56+
"port",
57+
"debug",
58+
"directories" # Should accept directories as arguments
5859
],
5960
expected_not_in_output=["run [OPTIONS]"] # No 'run' subcommand required
6061
),
@@ -71,15 +72,16 @@ def test_cli_behavior(case):
7172

7273
# Assert
7374
output = result.stderr if case.check_stderr else result.stdout
75+
output = output.lower() # Case-insensitive matching to focus on content not format
7476

75-
# Check expected content is present
77+
# Check expected content is present - focus on behaviors not exact strings
7678
for expected in case.expected_in_output:
77-
assert expected in output, f"Expected '{expected}' in output, but it was not found. Output: {output}"
79+
assert expected.lower() in output, f"Expected '{expected}' in output, but it was not found. Output: {output}"
7880

7981
# Check unexpected content is absent
8082
if case.expected_not_in_output:
8183
for unexpected in case.expected_not_in_output:
82-
assert unexpected not in output, f"Found unexpected '{unexpected}' in output. Output: {output}"
84+
assert unexpected.lower() not in output, f"Found unexpected '{unexpected}' in output. Output: {output}"
8385

8486
# Check return code
8587
assert result.returncode == case.expected_returncode, \

0 commit comments

Comments
 (0)