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,