mcp-win-stdio-explorer 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_win_stdio_explorer-0.2.3/.gitignore +60 -0
- mcp_win_stdio_explorer-0.2.3/PKG-INFO +105 -0
- mcp_win_stdio_explorer-0.2.3/README.md +79 -0
- mcp_win_stdio_explorer-0.2.3/pyproject.toml +43 -0
- mcp_win_stdio_explorer-0.2.3/src/mcp_win_stdio/explorer/__init__.py +5 -0
- mcp_win_stdio_explorer-0.2.3/src/mcp_win_stdio/explorer/__main__.py +8 -0
- mcp_win_stdio_explorer-0.2.3/src/mcp_win_stdio/explorer/cli.py +176 -0
- mcp_win_stdio_explorer-0.2.3/src/mcp_win_stdio/explorer/guide.py +68 -0
- mcp_win_stdio_explorer-0.2.3/src/mcp_win_stdio/explorer/server.py +1799 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.Python
|
|
6
|
+
build/
|
|
7
|
+
develop-eggs/
|
|
8
|
+
dist/
|
|
9
|
+
downloads/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
lib/
|
|
13
|
+
lib64/
|
|
14
|
+
parts/
|
|
15
|
+
sdist/
|
|
16
|
+
var/
|
|
17
|
+
wheels/
|
|
18
|
+
share/python-wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
*.manifest
|
|
25
|
+
*.spec
|
|
26
|
+
api.txt
|
|
27
|
+
pip-log.txt
|
|
28
|
+
pip-delete-this-directory.txt
|
|
29
|
+
pypi api.txt
|
|
30
|
+
htmlcov/
|
|
31
|
+
.tox/
|
|
32
|
+
.nox/
|
|
33
|
+
.coverage
|
|
34
|
+
.coverage.*
|
|
35
|
+
.cache
|
|
36
|
+
nosetests.xml
|
|
37
|
+
coverage.xml
|
|
38
|
+
*.cover
|
|
39
|
+
*.py,cover
|
|
40
|
+
.hypothesis/
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
cover/
|
|
43
|
+
|
|
44
|
+
*.mo
|
|
45
|
+
*.pot
|
|
46
|
+
|
|
47
|
+
.env
|
|
48
|
+
.venv
|
|
49
|
+
env/
|
|
50
|
+
venv/
|
|
51
|
+
ENV/
|
|
52
|
+
env.bak/
|
|
53
|
+
venv.bak/
|
|
54
|
+
|
|
55
|
+
.idea/
|
|
56
|
+
.vscode/
|
|
57
|
+
*.swp
|
|
58
|
+
*.swo
|
|
59
|
+
|
|
60
|
+
*.log
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcp-win-stdio-explorer
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Lightweight Model Context Protocol (MCP) server for token-safe workspace exploration: collapsible directory trees, dynamic .gitignore resolution, in-file grep, RapidFuzz fuzzy search, and AST code outline.
|
|
5
|
+
Author-email: indala <indala@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ast,claude,explorer,fuzzy-search,gitignore,grep,llm,mcp,workspace
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: mcp-win-stdio>=0.2.3
|
|
22
|
+
Requires-Dist: mcp>=1.2.0
|
|
23
|
+
Requires-Dist: pathspec>=0.12.0
|
|
24
|
+
Requires-Dist: rapidfuzz>=3.0.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# mcp-win-stdio-explorer
|
|
28
|
+
|
|
29
|
+
Lightweight, token-safe **Model Context Protocol (MCP)** server for directory exploration, `.gitignore` resolution, in-file grep, RapidFuzz fuzzy search, and code symbol extraction.
|
|
30
|
+
|
|
31
|
+
Part of the **`mcp-win-stdio`** Windows-optimized suite.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🚀 Features (11 Tools)
|
|
36
|
+
|
|
37
|
+
- **Token-Safe Directory Navigation**: Depth-controlled tree (`get_directory_tree`) that automatically collapses heavy build directories (`node_modules`, `.next`, `dist`, `.git`) to protect LLM context windows.
|
|
38
|
+
- **Git-Wildmatch Pattern Engine**: Respects workspace `.gitignore` rules with high-performance `pathspec` matching.
|
|
39
|
+
- **Fast Content Search (Grep)**: Regex and plain-text search across file contents with surrounding context lines.
|
|
40
|
+
- **Typo-Tolerant Search**: RapidFuzz fuzzy search to locate files even with incomplete names or abbreviations.
|
|
41
|
+
- **Code Symbol Outlines**: Symbol extractor (`get_code_outline`) extracting classes, functions, arguments, docstrings, and line numbers from Python (AST) and JS/TS without loading entire files into memory.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🛠️ Included Tools (11 Tools)
|
|
46
|
+
|
|
47
|
+
1. `list_dir`: Detailed listing (PowerShell Get-ChildItem style) with file sizes, counts, and heavy folder indicators.
|
|
48
|
+
2. `get_directory_tree`: Depth-controlled tree with automatic heavy folder collapsing.
|
|
49
|
+
3. `find_files`: Advanced glob search honoring `.gitignore` and build caches.
|
|
50
|
+
4. `fuzzy_find`: RapidFuzz typo-tolerant file search.
|
|
51
|
+
5. `grep_search`: Fast text and regex search inside file contents with context lines.
|
|
52
|
+
6. `read_file`: Windowed file reader with line numbers and binary file safeguard.
|
|
53
|
+
7. `read_head_tail`: Quick top N (head) or bottom N (tail) line peek for logs and large files.
|
|
54
|
+
8. `get_code_outline`: Symbol extractor for Python AST and JavaScript/TypeScript symbols.
|
|
55
|
+
9. `get_file_info`: File metadata, line counts, line endings (CRLF vs LF), and hashes.
|
|
56
|
+
10. `workspace_summary`: Folder disk usage, extension breakdown, and Git repo status.
|
|
57
|
+
11. `export_tree_to_file`: Dumps an un-truncated workspace map directly to disk.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📦 Installation
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
pip install mcp-win-stdio-explorer
|
|
65
|
+
```
|
|
66
|
+
*(Installing this package automatically installs `mws` CLI orchestrator)*.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🚀 One-Command Claude Setup
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
mws setup explorer
|
|
74
|
+
# or:
|
|
75
|
+
mws add explorer
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Manual Configuration Example
|
|
79
|
+
In `%APPDATA%\Claude\claude_desktop_config.json`:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"explorer": {
|
|
84
|
+
"command": "python",
|
|
85
|
+
"args": ["-m", "mcp_win_stdio.explorer"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 📖 CLI Commands & Interactive Guide
|
|
94
|
+
|
|
95
|
+
```powershell
|
|
96
|
+
mws explorer guide # Complete tool reference & prompt recipes
|
|
97
|
+
mws explorer doctor # Verify pathspec and rapidfuzz dependencies
|
|
98
|
+
mws explorer setup # Configure Claude Desktop / Claude Code
|
|
99
|
+
mws explorer run # Launch server over stdio
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 📜 License
|
|
105
|
+
MIT License. Copyright (c) 2026 Mohan Kumar Indala.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# mcp-win-stdio-explorer
|
|
2
|
+
|
|
3
|
+
Lightweight, token-safe **Model Context Protocol (MCP)** server for directory exploration, `.gitignore` resolution, in-file grep, RapidFuzz fuzzy search, and code symbol extraction.
|
|
4
|
+
|
|
5
|
+
Part of the **`mcp-win-stdio`** Windows-optimized suite.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Features (11 Tools)
|
|
10
|
+
|
|
11
|
+
- **Token-Safe Directory Navigation**: Depth-controlled tree (`get_directory_tree`) that automatically collapses heavy build directories (`node_modules`, `.next`, `dist`, `.git`) to protect LLM context windows.
|
|
12
|
+
- **Git-Wildmatch Pattern Engine**: Respects workspace `.gitignore` rules with high-performance `pathspec` matching.
|
|
13
|
+
- **Fast Content Search (Grep)**: Regex and plain-text search across file contents with surrounding context lines.
|
|
14
|
+
- **Typo-Tolerant Search**: RapidFuzz fuzzy search to locate files even with incomplete names or abbreviations.
|
|
15
|
+
- **Code Symbol Outlines**: Symbol extractor (`get_code_outline`) extracting classes, functions, arguments, docstrings, and line numbers from Python (AST) and JS/TS without loading entire files into memory.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🛠️ Included Tools (11 Tools)
|
|
20
|
+
|
|
21
|
+
1. `list_dir`: Detailed listing (PowerShell Get-ChildItem style) with file sizes, counts, and heavy folder indicators.
|
|
22
|
+
2. `get_directory_tree`: Depth-controlled tree with automatic heavy folder collapsing.
|
|
23
|
+
3. `find_files`: Advanced glob search honoring `.gitignore` and build caches.
|
|
24
|
+
4. `fuzzy_find`: RapidFuzz typo-tolerant file search.
|
|
25
|
+
5. `grep_search`: Fast text and regex search inside file contents with context lines.
|
|
26
|
+
6. `read_file`: Windowed file reader with line numbers and binary file safeguard.
|
|
27
|
+
7. `read_head_tail`: Quick top N (head) or bottom N (tail) line peek for logs and large files.
|
|
28
|
+
8. `get_code_outline`: Symbol extractor for Python AST and JavaScript/TypeScript symbols.
|
|
29
|
+
9. `get_file_info`: File metadata, line counts, line endings (CRLF vs LF), and hashes.
|
|
30
|
+
10. `workspace_summary`: Folder disk usage, extension breakdown, and Git repo status.
|
|
31
|
+
11. `export_tree_to_file`: Dumps an un-truncated workspace map directly to disk.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📦 Installation
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
pip install mcp-win-stdio-explorer
|
|
39
|
+
```
|
|
40
|
+
*(Installing this package automatically installs `mws` CLI orchestrator)*.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 One-Command Claude Setup
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
mws setup explorer
|
|
48
|
+
# or:
|
|
49
|
+
mws add explorer
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Manual Configuration Example
|
|
53
|
+
In `%APPDATA%\Claude\claude_desktop_config.json`:
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"explorer": {
|
|
58
|
+
"command": "python",
|
|
59
|
+
"args": ["-m", "mcp_win_stdio.explorer"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 📖 CLI Commands & Interactive Guide
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
mws explorer guide # Complete tool reference & prompt recipes
|
|
71
|
+
mws explorer doctor # Verify pathspec and rapidfuzz dependencies
|
|
72
|
+
mws explorer setup # Configure Claude Desktop / Claude Code
|
|
73
|
+
mws explorer run # Launch server over stdio
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 📜 License
|
|
79
|
+
MIT License. Copyright (c) 2026 Mohan Kumar Indala.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcp-win-stdio-explorer"
|
|
7
|
+
version = "0.2.3"
|
|
8
|
+
description = "Lightweight Model Context Protocol (MCP) server for token-safe workspace exploration: collapsible directory trees, dynamic .gitignore resolution, in-file grep, RapidFuzz fuzzy search, and AST code outline."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "indala", email = "indala@example.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "claude", "workspace", "explorer", "grep", "fuzzy-search", "gitignore", "ast", "llm"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Win32 (MS Windows)",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Software Development :: Libraries",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
dependencies = [
|
|
32
|
+
"mcp-win-stdio>=0.2.3",
|
|
33
|
+
"mcp>=1.2.0",
|
|
34
|
+
"pathspec>=0.12.0",
|
|
35
|
+
"rapidfuzz>=3.0.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
mcp-win-stdio-explorer = "mcp_win_stdio.explorer.cli:main"
|
|
40
|
+
mws-explorer = "mcp_win_stdio.explorer.cli:main"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["src/mcp_win_stdio"]
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI entry point for mcp-win-stdio-explorer.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
from mcp_win_stdio.explorer import __version__
|
|
14
|
+
from mcp_win_stdio.explorer.guide import print_guide
|
|
15
|
+
from mcp_win_stdio.explorer.server import mcp
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_claude_desktop_config_path() -> Path | None:
|
|
19
|
+
appdata = os.environ.get("APPDATA")
|
|
20
|
+
if appdata:
|
|
21
|
+
p = Path(appdata) / "Claude" / "claude_desktop_config.json"
|
|
22
|
+
if p.exists():
|
|
23
|
+
return p
|
|
24
|
+
default_p = Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json"
|
|
25
|
+
return default_p if default_p.exists() else None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_claude_cli_config_path() -> Path | None:
|
|
29
|
+
p = Path.home() / ".claude.json"
|
|
30
|
+
return p if p.exists() else None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def cmd_setup(args: argparse.Namespace) -> None:
|
|
34
|
+
"""Setup explorer MCP server in Claude Desktop and Claude Code CLI."""
|
|
35
|
+
client = args.client.lower()
|
|
36
|
+
python_exe = sys.executable.replace("\\", "/")
|
|
37
|
+
cmd_args = ["-m", "mcp_win_stdio.explorer.server"]
|
|
38
|
+
|
|
39
|
+
print(f"\nSetting up 'explorer' MCP server (target: {client})...\n")
|
|
40
|
+
|
|
41
|
+
# 1. Desktop
|
|
42
|
+
if client in ("all", "desktop"):
|
|
43
|
+
desktop_cfg = get_claude_desktop_config_path()
|
|
44
|
+
if desktop_cfg:
|
|
45
|
+
try:
|
|
46
|
+
shutil.copy2(desktop_cfg, desktop_cfg.with_suffix(".json.bak"))
|
|
47
|
+
with open(desktop_cfg, "r", encoding="utf-8") as f:
|
|
48
|
+
data = json.load(f)
|
|
49
|
+
if "mcpServers" not in data:
|
|
50
|
+
data["mcpServers"] = {}
|
|
51
|
+
data["mcpServers"]["explorer"] = {
|
|
52
|
+
"command": python_exe,
|
|
53
|
+
"args": cmd_args,
|
|
54
|
+
}
|
|
55
|
+
with open(desktop_cfg, "w", encoding="utf-8") as f:
|
|
56
|
+
json.dump(data, f, indent=2)
|
|
57
|
+
print(f"[OK] Claude Desktop: Configured 'explorer' in {desktop_cfg}")
|
|
58
|
+
except Exception as e:
|
|
59
|
+
print(f"[ERROR] Claude Desktop: Failed to configure: {e}")
|
|
60
|
+
else:
|
|
61
|
+
print("[WARN] Claude Desktop configuration not found.")
|
|
62
|
+
|
|
63
|
+
# 2. CLI
|
|
64
|
+
if client in ("all", "cli"):
|
|
65
|
+
added_cli = False
|
|
66
|
+
try:
|
|
67
|
+
res = subprocess.run(
|
|
68
|
+
["claude", "mcp", "add", "-s", "user", "explorer", "--", python_exe] + cmd_args,
|
|
69
|
+
capture_output=True,
|
|
70
|
+
text=True,
|
|
71
|
+
timeout=10,
|
|
72
|
+
)
|
|
73
|
+
if res.returncode == 0:
|
|
74
|
+
added_cli = True
|
|
75
|
+
print("[OK] Claude Code CLI: Configured via `claude mcp add`")
|
|
76
|
+
except Exception:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
if not added_cli:
|
|
80
|
+
cli_cfg = get_claude_cli_config_path()
|
|
81
|
+
if cli_cfg:
|
|
82
|
+
try:
|
|
83
|
+
with open(cli_cfg, "r", encoding="utf-8") as f:
|
|
84
|
+
cli_data = json.load(f)
|
|
85
|
+
if "mcpServers" not in cli_data:
|
|
86
|
+
cli_data["mcpServers"] = {}
|
|
87
|
+
cli_data["mcpServers"]["explorer"] = {
|
|
88
|
+
"command": python_exe,
|
|
89
|
+
"args": cmd_args,
|
|
90
|
+
}
|
|
91
|
+
with open(cli_cfg, "w", encoding="utf-8") as f:
|
|
92
|
+
json.dump(cli_data, f, indent=2)
|
|
93
|
+
print(f"[OK] Claude Code CLI: Configured directly in {cli_cfg}")
|
|
94
|
+
except Exception as e:
|
|
95
|
+
print(f"[ERROR] Claude CLI: Failed to configure: {e}")
|
|
96
|
+
|
|
97
|
+
print("\nWorkspace Explorer MCP setup complete! Please restart Claude Desktop if active.\n")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def cmd_remove(args: argparse.Namespace) -> None:
|
|
101
|
+
"""Remove explorer MCP server from Claude Desktop and CLI."""
|
|
102
|
+
desktop_cfg = get_claude_desktop_config_path()
|
|
103
|
+
if desktop_cfg and desktop_cfg.exists():
|
|
104
|
+
try:
|
|
105
|
+
with open(desktop_cfg, "r", encoding="utf-8") as f:
|
|
106
|
+
data = json.load(f)
|
|
107
|
+
if "mcpServers" in data and "explorer" in data["mcpServers"]:
|
|
108
|
+
del data["mcpServers"]["explorer"]
|
|
109
|
+
with open(desktop_cfg, "w", encoding="utf-8") as f:
|
|
110
|
+
json.dump(data, f, indent=2)
|
|
111
|
+
print(f"[OK] Removed 'explorer' from Claude Desktop.")
|
|
112
|
+
except Exception as e:
|
|
113
|
+
print(f"[ERROR] Claude Desktop: {e}")
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
res = subprocess.run(["claude", "mcp", "remove", "-s", "user", "explorer"], capture_output=True, text=True)
|
|
117
|
+
if res.returncode == 0:
|
|
118
|
+
print("[OK] Removed 'explorer' from Claude Code CLI.")
|
|
119
|
+
except Exception:
|
|
120
|
+
pass
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def cmd_run(args: argparse.Namespace) -> None:
|
|
124
|
+
"""Run explorer MCP server over stdio."""
|
|
125
|
+
mcp.run()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def cmd_doctor(args: argparse.Namespace) -> None:
|
|
129
|
+
"""Check Workspace Explorer health and dependencies."""
|
|
130
|
+
print(f"\n=== mcp-win-stdio-explorer Doctor Diagnostic (v{__version__}) ===\n")
|
|
131
|
+
print(f"[OK] Python: {sys.version.split()[0]} ({sys.executable})")
|
|
132
|
+
|
|
133
|
+
for dep in ("mcp", "pathspec", "rapidfuzz"):
|
|
134
|
+
try:
|
|
135
|
+
__import__(dep)
|
|
136
|
+
print(f"[OK] Dependency: {dep:<12}")
|
|
137
|
+
except ImportError:
|
|
138
|
+
print(f"[FAIL] Dependency: {dep:<12} (MISSING)")
|
|
139
|
+
|
|
140
|
+
print("\nDiagnostic complete.\n")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def main() -> None:
|
|
144
|
+
parser = argparse.ArgumentParser(
|
|
145
|
+
prog="mcp-win-stdio-explorer",
|
|
146
|
+
description="Workspace Explorer MCP Server CLI",
|
|
147
|
+
)
|
|
148
|
+
parser.add_argument("--version", "-v", action="version", version=f"%(prog)s {__version__}")
|
|
149
|
+
subparsers = parser.add_subparsers(dest="command", help="Command to execute")
|
|
150
|
+
|
|
151
|
+
sub_setup = subparsers.add_parser("setup", help="Auto-configure into Claude Desktop & CLI")
|
|
152
|
+
sub_setup.add_argument("--client", "-c", choices=["all", "desktop", "cli"], default="all")
|
|
153
|
+
sub_setup.set_defaults(func=cmd_setup)
|
|
154
|
+
|
|
155
|
+
sub_remove = subparsers.add_parser("remove", help="Remove from Claude Desktop & CLI")
|
|
156
|
+
sub_remove.set_defaults(func=cmd_remove)
|
|
157
|
+
|
|
158
|
+
sub_guide = subparsers.add_parser("guide", help="View usage guide and prompt recipes")
|
|
159
|
+
sub_guide.set_defaults(func=lambda args: print_guide())
|
|
160
|
+
|
|
161
|
+
sub_run = subparsers.add_parser("run", help="Run Explorer MCP server over stdio")
|
|
162
|
+
sub_run.set_defaults(func=cmd_run)
|
|
163
|
+
|
|
164
|
+
sub_doctor = subparsers.add_parser("doctor", help="Check dependencies")
|
|
165
|
+
sub_doctor.set_defaults(func=cmd_doctor)
|
|
166
|
+
|
|
167
|
+
args = parser.parse_args()
|
|
168
|
+
if not args.command:
|
|
169
|
+
parser.print_help()
|
|
170
|
+
sys.exit(0)
|
|
171
|
+
|
|
172
|
+
args.func(args)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
if __name__ == "__main__":
|
|
176
|
+
main()
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Interactive and printable guide for the Workspace Explorer MCP server.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
EXPLORER_GUIDE = """
|
|
6
|
+
# ================================================================
|
|
7
|
+
# WORKSPACE EXPLORER MCP - USER & LLM GUIDE
|
|
8
|
+
# ================================================================
|
|
9
|
+
|
|
10
|
+
The Workspace Explorer MCP server provides 11 specialized tools for
|
|
11
|
+
token-safe directory navigation, smart .gitignore awareness,
|
|
12
|
+
in-file grep, RapidFuzz fuzzy search, and code symbol extraction.
|
|
13
|
+
|
|
14
|
+
----------------------------------------------------------------
|
|
15
|
+
1. TOOL SUMMARY
|
|
16
|
+
----------------------------------------------------------------
|
|
17
|
+
* Directory Navigation & Hierarchy:
|
|
18
|
+
- list_dir(path, filter_pattern, sort_by, limit, offset):
|
|
19
|
+
Detailed listing (PowerShell Get-ChildItem style) with sizes,
|
|
20
|
+
child counts, and heavy build directory flags.
|
|
21
|
+
- get_directory_tree(path, max_depth, ignore_mode, collapse_heavy_dirs):
|
|
22
|
+
Depth-controlled tree. Automatically collapses node_modules, .next,
|
|
23
|
+
dist, and .git into informative summary nodes to protect context.
|
|
24
|
+
|
|
25
|
+
* Fast Search:
|
|
26
|
+
- find_files(search_path, pattern, extensions, min/max_size, modified_after):
|
|
27
|
+
Advanced glob search honoring .gitignore and build caches.
|
|
28
|
+
- fuzzy_find(query, search_path, extensions, score_cutoff):
|
|
29
|
+
RapidFuzz typo-tolerant search. Find files by abbreviation (e.g. 'usrctrl').
|
|
30
|
+
- grep_search(query, search_path, is_regex, context_lines, max_matches):
|
|
31
|
+
Search text or regex INSIDE file contents across the workspace.
|
|
32
|
+
|
|
33
|
+
* Token-Safe Reading:
|
|
34
|
+
- read_file(file_path, start_line, end_line, line_numbers, max_lines):
|
|
35
|
+
Windowed file reader with automatic binary detection/protection.
|
|
36
|
+
- read_head_tail(file_path, mode, lines):
|
|
37
|
+
Quick top N (head) or bottom N (tail) line peek for logs/CSVs.
|
|
38
|
+
|
|
39
|
+
* Code Structure & Diagnostics:
|
|
40
|
+
- get_code_outline(file_path):
|
|
41
|
+
Extracts classes, functions, arguments, docstrings, and line numbers
|
|
42
|
+
from Python (AST), JS/TS, and JSON without loading the whole file!
|
|
43
|
+
- get_file_info(path, include_hash):
|
|
44
|
+
Full diagnostics (timestamps, line count, CRLF/LF, MD5/SHA256).
|
|
45
|
+
- workspace_summary(path):
|
|
46
|
+
Folder disk usage, file count breakdown by extension, recent files, Git status.
|
|
47
|
+
- export_tree_to_file(path, output_file_path, format):
|
|
48
|
+
Writes a complete un-truncated workspace map directly to disk.
|
|
49
|
+
|
|
50
|
+
----------------------------------------------------------------
|
|
51
|
+
2. EXAMPLE PROMPTS FOR CLAUDE
|
|
52
|
+
----------------------------------------------------------------
|
|
53
|
+
* Find files with typos:
|
|
54
|
+
"Use fuzzy_find to look for 'reconcil' or 'authctrl' in my repo."
|
|
55
|
+
|
|
56
|
+
* Check outline without token blowup:
|
|
57
|
+
"Use get_code_outline on src/server.py so I can see available methods."
|
|
58
|
+
|
|
59
|
+
* Grep inside code:
|
|
60
|
+
"Use grep_search to find 'SAP_PO' across all .py and .ts files."
|
|
61
|
+
|
|
62
|
+
* Tree view without node_modules bloat:
|
|
63
|
+
"Show me the directory tree of this project with max_depth=2."
|
|
64
|
+
# ================================================================
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
def print_explorer_guide() -> None:
|
|
68
|
+
print(EXPLORER_GUIDE.strip())
|