Skip to content

Commit 5161744

Browse files
Update MCP Bundle to Support Filesystem Edit Instead (#446)
1 parent 935ac15 commit 5161744

10 files changed

Lines changed: 310 additions & 357 deletions

File tree

libraries/python/mcp-tunnel/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ When you run MCP Tunnel, it will:
7070
4. Start tunnel processes and display their output with color-coding
7171
5. Generate an assistant configuration file at `~/.mcp-tunnel/assistant-config.yaml`, for use with the Codespace assistant
7272
6. Generate an MCP client configuration file at `~/.mcp-tunnel/mcp-client.json`, for use with MCP clients such as Claude desktop
73-
6. Keep tunnels running until you press Ctrl+C
73+
7. Keep tunnels running until you press Ctrl+C
7474

7575
## Assistant Configuration
7676

@@ -84,6 +84,30 @@ MCP Tunnel generates a configuration file at `~/.mcp-tunnel/mcp-client.json` tha
8484

8585
Read the documentation for your specific MCP client to learn how to apply this configuration.
8686

87+
### Setting Up Your MCP Client Machine
88+
89+
After running `mcp-tunnel`, you'll need to set up your MCP client machine to connect to the tunnels:
90+
91+
1. **Install DevTunnel**: Follow the [installation instructions](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?#install)
92+
93+
2. **Log in with your Microsoft account**:
94+
95+
```bash
96+
devtunnel user login
97+
```
98+
99+
3. **Start port forwarding** (use the tunnel ID from your `mcp-client.json` output):
100+
101+
```bash
102+
devtunnel connect <TUNNEL_ID>
103+
```
104+
105+
4. **Install MCP Proxy**: Follow the [installation instructions](https://github.com/sparfenyuk/mcp-proxy?tab=readme-ov-file#installation)
106+
107+
5. **Update your MCP client configuration** according to the instructions for your specific MCP client
108+
109+
6. **Restart your MCP client** to apply the changes
110+
87111
## Troubleshooting
88112

89113
### DevTunnel CLI Not Found

libraries/python/mcp-tunnel/mcp_tunnel/_main.py

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import threading
66
import time
77
from dataclasses import dataclass, field
8+
from pathlib import Path
89
from typing import IO, Any, NoReturn
910

1011
import yaml
@@ -229,30 +230,34 @@ def write_assistant_config(servers: list[MCPServer], tunnel: MCPTunnel) -> None:
229230
task_completion_estimate: 30
230231
"""
231232

232-
config = {
233-
"tools": {
233+
personal_mcp_servers = []
234+
for server, port in zip(servers, tunnel.ports):
235+
server_config = {
236+
"key": server.name,
234237
"enabled": True,
235-
"personal_mcp_servers": [
236-
{
237-
"key": server.name,
238-
"enabled": True,
239-
"command": port.sse_url,
240-
"args": [
241-
json.dumps({
242-
"tunnel_id": port.tunnel_id,
243-
"port": port.port,
244-
"access_token": tunnel.access_token,
245-
})
246-
],
247-
"prompt": "",
248-
"long_running": False,
249-
"task_completion_estimate": 30,
250-
**server.extra_assistant_config,
251-
}
252-
for server, port in zip(servers, tunnel.ports)
238+
"command": port.sse_url,
239+
"args": [
240+
json.dumps({
241+
"tunnel_id": port.tunnel_id,
242+
"port": port.port,
243+
"access_token": tunnel.access_token,
244+
})
253245
],
246+
"prompt": "",
247+
"long_running": False,
248+
"task_completion_estimate": 30,
249+
**server.extra_assistant_config,
254250
}
255-
}
251+
252+
# Special handling for the filesystem-edit server
253+
if server.name == "mcp-server-filesystem-edit" and sys.platform.startswith("win32"):
254+
temp_root = Path("C:/ProgramData/SemanticWorkbench/OfficeWorkingDirectory")
255+
server_config["roots"] = [{"name": "working_directory", "uri": str(temp_root)}]
256+
cprint(f"Configured filesystem-edit root directory: {temp_root}", "cyan")
257+
258+
personal_mcp_servers.append(server_config)
259+
260+
config = {"tools": {"enabled": True, "personal_mcp_servers": personal_mcp_servers}}
256261

257262
config_path = get_mcp_tunnel_dir() / "assistant-config.yaml"
258263
config_path.write_text(yaml.dump(config, sort_keys=False))
@@ -262,8 +267,7 @@ def write_assistant_config(servers: list[MCPServer], tunnel: MCPTunnel) -> None:
262267
cprint(f"\tDirectory: {config_path.parent}", "green")
263268
cprint(f"\tFile: {config_path}", "green")
264269
cprint("\nNext steps:", "green")
265-
cprint("1. Review the file and replace any placeholder values, if there are any", "green")
266-
cprint("2. Import the file into an assistant to give it access to the MCP servers", "green")
270+
cprint(" Import the assistant-config.yaml file into an assistant to give it access to the MCP servers", "green")
267271

268272

269273
def write_mcp_client_config(servers: list[MCPServer], tunnel: MCPTunnel) -> None:
@@ -286,25 +290,6 @@ def write_mcp_client_config(servers: list[MCPServer], tunnel: MCPTunnel) -> None
286290
mcp_client_path = get_mcp_tunnel_dir() / "mcp-client.json"
287291
mcp_client_path.write_text(json.dumps(mcp_client_config, indent=2))
288292

289-
cprint("\n\nMCP client config", "green")
290-
cprint(f"{'-' * 80}\n", "green")
291-
cprint(f"\tDirectory: {mcp_client_path.parent}", "green")
292-
cprint(f"\tFile: {mcp_client_path}", "green")
293-
cprint("\nNext steps:", "green")
294-
cprint("1. Review the file and replace any placeholder values, if there are any", "green")
295-
cprint("\nOn your MCP client machine:", "green")
296-
cprint(
297-
"1. Install devtunnel https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?#install",
298-
"green",
299-
)
300-
cprint("2. Login with the same Microsoft account:", "green")
301-
cprint(" devtunnel user login")
302-
cprint("3. Start port forwarding:", "green")
303-
cprint(f" devtunnel connect {tunnel.tunnel_id}")
304-
cprint("4. Install mcp-proxy https://github.com/sparfenyuk/mcp-proxy?tab=readme-ov-file#installation", "green")
305-
cprint("5. Update your MCP client config according to the instructions for your MCP client", "green")
306-
cprint("6. Restart your MCP client", "green")
307-
308293

309294
def tunnel_servers(servers: list[MCPServer]) -> None:
310295
tunnel_manager = TunnelManager(servers)

mcp-servers/mcp-server-bundle/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ endif
1515

1616
package: install
1717
ifeq ($(DETECTED_OS),Windows)
18-
$(MAKE) -C ../mcp-server-office package
18+
$(MAKE) -C ../mcp-server-filesystem-edit package
1919
endif
20-
$(MAKE) -C ../mcp-server-filesystem package
2120
uv run pyinstaller pyinstaller.spec
2221

2322
.PHONY: clean-package
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# MCP Server Bundle
22

3-
This project bundles the mcp-server-office, mcp-server-filesystem, and mcp-tunnel tools into a single executable package for easy distribution and use.
3+
This project bundles the mcp-filesystem-edit and mcp-tunnel tools into a single executable package for easy distribution and use.
44

55
## Features
66

7-
- Single executable that starts mcp-server-office, mcp-server-filesystem, and mcp-tunnel
7+
- Single executable that starts mcp-filesystem-edit and mcp-tunnel
88
- Graceful shutdown with Ctrl+C (kills all child processes)
99
- Windows and macOS executable packaging
10-
- macOS version includes only mcp-tunnel and mcp-server-filesystem (no mcp-server-office)
10+
11+
## Usage
12+
13+
1. Run `make package` to build the executable. It will be output into the `dist` directory.

mcp-servers/mcp-server-bundle/mcp_server_bundle/main.py

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def start_servers() -> list[MCPServerProcess]:
4040
mcp_servers: list[MCPServerProcess] = []
4141

4242
for start in [
43-
start_mcp_server_office,
44-
start_mcp_server_vscode,
45-
start_mcp_server_filesystem,
43+
start_mcp_server_filesystem_edit,
4644
]:
4745
mcp_server = start()
4846
if mcp_server is not None:
@@ -74,51 +72,17 @@ def _run_executable(executable_name: str, args: list[str]) -> subprocess.Popen |
7472
return subprocess.Popen([executable_path] + args)
7573

7674

77-
MCP_SERVER_OFFICE_PORT = 25252
75+
MCP_SERVER_FILESYSTEM_EDIT_PORT = 25252
7876

7977

80-
def start_mcp_server_office() -> MCPServerProcess | None:
81-
process = _run_executable("mcp-server-office", ["--transport", "sse", "--port", str(MCP_SERVER_OFFICE_PORT)])
82-
if process is None:
83-
return None
84-
85-
return MCPServerProcess(MCPServer("mcp-server-office", MCP_SERVER_OFFICE_PORT), process)
86-
87-
88-
MCP_SERVER_VSCODE_PORT = 6010
89-
90-
91-
def start_mcp_server_vscode() -> MCPServerProcess | None:
92-
return MCPServerProcess(
93-
MCPServer("mcp-server-vscode", MCP_SERVER_VSCODE_PORT, extra_assistant_config={"enabled": False}), None
94-
)
95-
96-
97-
MCP_SERVER_FILE_SYSTEM_PORT = 59595
98-
99-
100-
def start_mcp_server_filesystem() -> MCPServerProcess | None:
78+
def start_mcp_server_filesystem_edit() -> MCPServerProcess | None:
10179
process = _run_executable(
102-
"mcp-server-filesystem", ["--transport", "sse", "--port", str(MCP_SERVER_FILE_SYSTEM_PORT)]
80+
"mcp-server-filesystem-edit", ["--transport", "sse", "--port", str(MCP_SERVER_FILESYSTEM_EDIT_PORT)]
10381
)
10482
if process is None:
10583
return None
10684

107-
return MCPServerProcess(
108-
MCPServer(
109-
"mcp-server-filesystem",
110-
MCP_SERVER_FILE_SYSTEM_PORT,
111-
extra_assistant_config={
112-
"roots": [
113-
{
114-
"name": "filesystem-root",
115-
"uri": "PUT VALID PATH HERE; ex: c:\\Users\\me\\dir (Windows), /home/me/dir (Linux) or /Users/me/dir (Mac)",
116-
}
117-
]
118-
},
119-
),
120-
process,
121-
)
85+
return MCPServerProcess(MCPServer("mcp-server-filesystem-edit", MCP_SERVER_FILESYSTEM_EDIT_PORT), process)
12286

12387

12488
def start_mcp_tunnel(servers: list[MCPServer]) -> None:

mcp-servers/mcp-server-bundle/pyinstaller.spec

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ block_cipher = None
66

77
is_windows = sys.platform.startswith('win')
88

9-
executable_packages = [
10-
'mcp-server-filesystem',
11-
]
9+
executable_packages = []
1210
if is_windows:
1311
executable_packages += [
14-
'mcp-server-office',
12+
'mcp-server-filesystem-edit',
1513
]
1614

1715
executable_paths = [

mcp-servers/mcp-server-bundle/pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ name = "mcp-server-bundle"
77
version = "0.1.0"
88
description = "Bundle for mcp-server-office and mcp-tunnel"
99
readme = "README.md"
10-
requires-python = ">=3.11"
10+
requires-python = ">=3.11,<3.13"
1111
authors = [{ name = "Semantic Workbench Team" }]
1212
dependencies = [
13-
"mcp-server-office; platform_system == 'Windows'",
14-
"mcp-server-filesystem",
13+
"mcp-server-filesystem-edit",
1514
"mcp-tunnel",
1615
]
1716

1817
[tool.uv.sources]
19-
mcp-server-office = { path = "../mcp-server-office", editable = true }
20-
mcp-server-filesystem= { path = "../mcp-server-filesystem", editable = true }
18+
mcp-server-filesystem-edit = { path = "../mcp-server-filesystem-edit", editable = true }
2119
mcp-tunnel = { path = "../../libraries/python/mcp-tunnel", editable = true }
2220

2321
[project.scripts]

0 commit comments

Comments
 (0)