# OpenClaw MCP Server for GLaDOS This MCP (Model Context Protocol) server exposes OpenClaw capabilities to GLaDOS, allowing GLaDOS to call OpenClaw tools and agents. ## What is MCP? MCP is a protocol for connecting AI assistants to tools and data sources. GLaDOS uses MCP to discover and call external tools dynamically. ## Installation 1. Install MCP package: ```bash pip install mcp ``` 2. Verify GLaDOS MCP support: ```bash python -c "from glados.mcp import MCPManager; print('OK')" ``` ## Tools Available The OpenClaw MCP server exposes these tools to GLaDOS: - `read_file(path)` — Read file contents - `write_file(path, content, append=False)` — Write files - `exec_command(command, timeout=30)` — Run shell commands - `list_workspace_files(directory=".", pattern="*")` — List files - `web_search(query, count=5)` — Search the web - `spawn_subagent(task, model="default", timeout=120)` — Spawn OpenClaw sub-agents - `send_discord_message(channel_id, message)` — Send Discord messages - `get_openclaw_status()` — Get OpenClaw gateway status ## Configuration Add to your GLaDOS `config.yaml`: ```yaml Glados: # ... your existing config ... mcp_servers: - name: "openclaw" transport: "stdio" command: "python" args: - "C:\Users\admin\.openclaw\workspace\discord-voice-bot\openclaw_mcp_server.py" - "stdio" allowed_tools: null # Allow all tools, or specify a list ``` ## How It Works 1. GLaDOS starts and connects to the OpenClaw MCP server via stdio 2. OpenClaw server registers its tools with GLaDOS 3. When you talk to GLaDOS, it can call OpenClaw tools 4. Results are spoken back to you ## Example Interactions **You:** "GLaDOS, what's in my workspace?" **GLaDOS:** *calls `list_workspace_files()`* "You have several Python files. Would you like me to read one?" **You:** "Check the weather" **GLaDOS:** *calls OpenClaw web search* "It's currently 72 degrees and sunny. Not that you go outside much." **You:** "Fix the bug in main.py" **GLaDOS:** *calls `read_file()`, analyzes, calls `write_file()`* "Fixed your sloppy code. You're welcome." ## Running Standalone Test the MCP server independently: ```bash # Stdio mode (for GLaDOS integration) python openclaw_mcp_server.py stdio # HTTP mode (for external connections) python openclaw_mcp_server.py http --port 8081 ``` ## Troubleshooting **GLaDOS doesn't see the tools:** - Check GLaDOS logs for MCP connection errors - Verify the path to `openclaw_mcp_server.py` is correct - Ensure `mcp` package is installed in the same Python environment as GLaDOS **Tools fail to execute:** - Check OpenClaw gateway is running - Verify Discord token in `config.yaml` (for messaging tools) - Review server logs for detailed errors **Permission errors:** - The MCP server runs with the same permissions as GLaDOS - File operations are restricted to the OpenClaw workspace