From f58599a77467b5764bc32cf2bfa804551f52e72d Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 10 May 2026 16:03:17 -0400 Subject: [PATCH] feat(mcp): add mcp_paths.toml for multi-project access - Add mcp_paths.toml with extra_dirs for C:/projects/gencpp - Update mcp_server.py to read allowed_paths from mcp_paths.toml --- mcp_paths.toml | 4 ++++ scripts/mcp_server.py | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 mcp_paths.toml diff --git a/mcp_paths.toml b/mcp_paths.toml new file mode 100644 index 0000000..b6469ed --- /dev/null +++ b/mcp_paths.toml @@ -0,0 +1,4 @@ +[allowed_paths] +extra_dirs = [ + "C:/projects/gencpp", +] diff --git a/scripts/mcp_server.py b/scripts/mcp_server.py index 27bb65f..9bfcd28 100644 --- a/scripts/mcp_server.py +++ b/scripts/mcp_server.py @@ -79,9 +79,18 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]: return [TextContent(type="text", text=f"ERROR: {e}")] async def main() -> None: -# Configure mcp_client with the project root so py_* tools are not ACCESS DENIED project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) - mcp_client.configure([], extra_base_dirs=[project_root]) + + extra_dirs = [project_root] + mcp_paths_toml = os.path.join(project_root, "mcp_paths.toml") + if os.path.exists(mcp_paths_toml): + import tomllib + with open(mcp_paths_toml, "rb") as f: + config = tomllib.load(f) + allowed = config.get("allowed_paths", {}).get("extra_dirs", []) + extra_dirs.extend(allowed) + + mcp_client.configure([], extra_base_dirs=extra_dirs) async with stdio_server() as (read_stream, write_stream): await server.run( read_stream,