diff --git a/core/setup_mcp.py b/core/setup_mcp.py deleted file mode 100755 index 49335ba0..00000000 --- a/core/setup_mcp.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env python3 -""" -Setup script for Aden Hive Framework MCP Server - -This script installs the framework and configures the MCP server. -""" - -import json -import logging -import subprocess -import sys -from pathlib import Path - -logger = logging.getLogger(__name__) - - -def setup_logger(): - """Configure logger for CLI usage with colored output.""" - if not logger.handlers: - handler = logging.StreamHandler(sys.stdout) - formatter = logging.Formatter("%(message)s") - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - - -class Colors: - """ANSI color codes for terminal output.""" - - GREEN = "\033[0;32m" - YELLOW = "\033[1;33m" - RED = "\033[0;31m" - BLUE = "\033[0;34m" - NC = "\033[0m" # No Color - - -def log_step(message: str): - """Log a colored step message.""" - logger.info(f"{Colors.YELLOW}{message}{Colors.NC}") - - -def log_success(message: str): - """Log a success message.""" - logger.info(f"{Colors.GREEN}✓ {message}{Colors.NC}") - - -def log_error(message: str): - """Log an error message.""" - logger.error(f"{Colors.RED}✗ {message}{Colors.NC}") - - -def run_command(cmd: list, error_msg: str) -> bool: - """Run a command and return success status.""" - try: - subprocess.run( - cmd, - check=True, - capture_output=True, - text=True, - encoding="utf-8", - ) - return True - except subprocess.CalledProcessError as e: - log_error(error_msg) - logger.error(f"Error output: {e.stderr}") - return False - - -def main(): - """Main setup function.""" - setup_logger() - logger.info("=== Aden Hive Framework MCP Server Setup ===") - logger.info("") - - # Get script directory - script_dir = Path(__file__).parent.absolute() - - # Step 1: Install framework package - log_step("Step 1: Installing framework package...") - if not run_command( - [sys.executable, "-m", "pip", "install", "-e", str(script_dir)], - "Failed to install framework package", - ): - sys.exit(1) - log_success("Framework package installed") - logger.info("") - - # Step 2: Install MCP dependencies - log_step("Step 2: Installing MCP dependencies...") - if not run_command( - [sys.executable, "-m", "pip", "install", "mcp", "fastmcp"], - "Failed to install MCP dependencies", - ): - sys.exit(1) - log_success("MCP dependencies installed") - logger.info("") - - # Step 3: Verify MCP configuration - log_step("Step 3: Verifying MCP server configuration...") - mcp_config_path = script_dir / ".mcp.json" - - if mcp_config_path.exists(): - log_success("MCP configuration found at .mcp.json") - logger.info("Configuration:") - with open(mcp_config_path, encoding="utf-8") as f: - config = json.load(f) - logger.info(json.dumps(config, indent=2)) - else: - log_success("No .mcp.json needed (MCP servers configured at repo root)") - logger.info("") - - # Step 4: Test framework import - log_step("Step 4: Testing framework import...") - try: - subprocess.run( - [sys.executable, "-c", "import framework; print('OK')"], - check=True, - capture_output=True, - text=True, - encoding="utf-8", - ) - log_success("Framework module verified") - except subprocess.CalledProcessError as e: - log_error("Failed to import framework module") - logger.error(f"Error: {e.stderr}") - sys.exit(1) - logger.info("") - - # Success summary - logger.info(f"{Colors.GREEN}=== Setup Complete ==={Colors.NC}") - logger.info("") - logger.info("The framework is now ready to use!") - logger.info("") - logger.info(f"{Colors.BLUE}MCP Configuration location:{Colors.NC}") - logger.info(f" {mcp_config_path}") - logger.info("") - - -if __name__ == "__main__": - main() diff --git a/core/verify_mcp.py b/core/verify_mcp.py deleted file mode 100644 index 6fd65a20..00000000 --- a/core/verify_mcp.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python3 -""" -Verification script for Aden Hive Framework MCP Server - -This script checks if the MCP server is properly installed and configured. -""" - -import json -import logging -import subprocess -import sys -from pathlib import Path - -logger = logging.getLogger(__name__) - - -def setup_logger(): - """Configure logger for CLI usage.""" - if not logger.handlers: - handler = logging.StreamHandler(sys.stdout) - formatter = logging.Formatter("%(message)s") - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.setLevel(logging.INFO) - - -class Colors: - GREEN = "\033[0;32m" - YELLOW = "\033[1;33m" - RED = "\033[0;31m" - BLUE = "\033[0;34m" - NC = "\033[0m" - - -def check(description: str) -> bool: - """Print check description and return a context manager for result.""" - logger.info(f"Checking {description}... ", extra={"end": ""}) - sys.stdout.flush() - return True - - -def success(msg: str = "OK"): - """Log success message.""" - logger.info(f"{Colors.GREEN}✓ {msg}{Colors.NC}") - - -def warning(msg: str): - """Log warning message.""" - logger.warning(f"{Colors.YELLOW}⚠ {msg}{Colors.NC}") - - -def error(msg: str): - """Log error message.""" - logger.error(f"{Colors.RED}✗ {msg}{Colors.NC}") - - -def main(): - """Run verification checks.""" - setup_logger() - logger.info("=== MCP Server Verification ===") - logger.info("") - - script_dir = Path(__file__).parent.absolute() - all_checks_passed = True - - # Check 1: Framework package installed - check("framework package installation") - try: - result = subprocess.run( - [sys.executable, "-c", "import framework; print(framework.__file__)"], - capture_output=True, - text=True, - check=True, - encoding="utf-8", - ) - framework_path = result.stdout.strip() - success(f"installed at {framework_path}") - except subprocess.CalledProcessError: - error("framework package not found") - logger.info(f" Run: uv pip install -e {script_dir}") - all_checks_passed = False - - # Check 2: MCP dependencies - check("MCP dependencies") - missing_deps = [] - for dep in ["mcp", "fastmcp"]: - try: - subprocess.run( - [sys.executable, "-c", f"import {dep}"], - capture_output=True, - check=True, - encoding="utf-8", - ) - except subprocess.CalledProcessError: - missing_deps.append(dep) - - if missing_deps: - error(f"missing: {', '.join(missing_deps)}") - logger.info(f" Run: uv pip install {' '.join(missing_deps)}") - all_checks_passed = False - else: - success("all installed") - - # Check 3: MCP configuration file - check("MCP configuration file") - mcp_config = script_dir / ".mcp.json" - if mcp_config.exists(): - try: - with open(mcp_config, encoding="utf-8") as f: - config = json.load(f) - - if "mcpServers" in config: - success("found and valid") - for name, server_config in config.get("mcpServers", {}).items(): - logger.info(f" Server: {name}") - logger.info(f" Command: {server_config.get('command')}") - logger.info(f" Args: {' '.join(server_config.get('args', []))}") - else: - warning("exists but missing mcpServers config") - all_checks_passed = False - except json.JSONDecodeError: - error("invalid JSON format") - all_checks_passed = False - else: - warning("not found (optional)") - logger.info(f" Location would be: {mcp_config}") - - # Check 4: Framework modules - check("core framework modules") - modules_to_check = [ - "framework.runtime.core", - "framework.graph.executor", - "framework.graph.node", - "framework.builder.query", - "framework.llm", - ] - - failed_modules = [] - for module in modules_to_check: - try: - subprocess.run( - [sys.executable, "-c", f"import {module}"], - capture_output=True, - check=True, - encoding="utf-8", - ) - except subprocess.CalledProcessError: - failed_modules.append(module) - - if failed_modules: - error(f"failed to import: {', '.join(failed_modules)}") - all_checks_passed = False - else: - success(f"all {len(modules_to_check)} modules OK") - - logger.info("") - logger.info("=" * 40) - if all_checks_passed: - logger.info(f"{Colors.GREEN}✓ All checks passed!{Colors.NC}") - logger.info("") - logger.info("Your framework is ready to use.") - else: - logger.info(f"{Colors.RED}✗ Some checks failed{Colors.NC}") - logger.info("") - logger.info("To fix issues, run:") - logger.info(f" uv run python {script_dir / 'setup_mcp.py'}") - logger.info("") - - -if __name__ == "__main__": - main() diff --git a/docs/antigravity-setup.md b/docs/antigravity-setup.md deleted file mode 100644 index 19587571..00000000 --- a/docs/antigravity-setup.md +++ /dev/null @@ -1,201 +0,0 @@ -# Antigravity IDE Setup - -Use the Hive agent framework (MCP servers and skills) inside [Antigravity IDE](https://antigravity.google/) (Google’s AI IDE). - ---- - -## Quick start (3 steps) - -**Repo root** = the folder that contains `core/`, `tools/`, and `.agent/` (where you cloned the project). - -1. **Open a terminal** and go to the hive repo root (e.g. `cd ~/hive`). -2. **Run the setup script** (use `./` so the script runs from this repo; don't use `/scripts/...`): - ```bash - ./scripts/setup-antigravity-mcp.sh - ``` -3. **Restart Antigravity IDE.** You should see **coder-tools** and **tools** as available MCP servers. - -> **Important:** Always restart/refresh Antigravity IDE after running the setup script or making any changes to MCP configuration. The IDE only loads MCP servers on startup. - -Done. For details, prerequisites, and troubleshooting, read on. - ---- - -## What you get after setup - -- **coder-tools** – Create and manage agents (scaffolding via `initialize_and_build_agent`, file I/O, tool discovery). -- **tools** – File operations, web search, and other agent tools. -- **Documentation** – Guided docs for building and testing agents. - ---- - -## Prerequisites - -- [Antigravity IDE](https://antigravity.google/) installed. -- **Python 3.11+** and project dependencies. If you haven’t set up the repo yet, from repo root run: - ```bash - ./quickstart.sh - ``` -- **MCP server dependencies** (one-time). From repo root: - ```bash - cd core && ./setup_mcp.sh - ``` - ---- - -## Full setup (step by step) - -### Step 1: Install MCP dependencies (one-time) - -From the **repo root**: - -```bash -cd core -./setup_mcp.sh -``` - -This installs the framework and MCP packages and checks that the server can start. - -### Step 2: Register MCP servers with Antigravity - -Antigravity reads MCP config from your **user config file** (`~/.gemini/antigravity/mcp_config.json`), not from the project. The easiest way is to run the setup script from the **hive repo folder**: - -```bash -./scripts/setup-antigravity-mcp.sh -``` - -The script finds the repo root, writes `~/.gemini/antigravity/mcp_config.json` with the right paths, and you don't edit any paths by hand. - -> **Important:** Always restart/refresh Antigravity IDE after running the setup script. MCP servers are only loaded on IDE startup. - -The **coder-tools** and **tools** servers should show up after restart. - -**Using Claude Code instead?** Run: - -```bash -./scripts/setup-antigravity-mcp.sh --claude -``` - -That writes `~/.claude/mcp.json` as well. - -**Prefer to do it manually?** See [Manual MCP config](#manual-mcp-config-template) below. You’ll create `~/.gemini/mcp.json` (or `~/.claude/mcp.json`) with absolute paths to your repo’s `core` and `tools` folders. - -### Step 3: Use MCP tools + docs - -Use the `coder-tools` and `tools` MCP servers in Antigravity, and use docs in `docs/` for workflow guidance. - ---- - -## What’s in the repo (`.agent/`) - -``` -.agent/ -├── mcp_config.json # Template for MCP servers (coder-tools, tools) -``` - -The **setup script** writes your **user** config (`~/.gemini/antigravity/mcp_config.json`) using paths from **this repo**. The file in `.agent/` is the template; Antigravity itself uses the file in your home directory. - ---- - -## Troubleshooting - -**MCP servers don’t connect** - -- Run the setup script again from the hive repo root: `./scripts/setup-antigravity-mcp.sh`, then restart Antigravity. -- Make sure Python and deps are installed: from repo root run `./quickstart.sh`. -- Check that the servers can start: from repo root run - `cd tools && uv run coder_tools_server.py --stdio` (Ctrl+C to stop), and in another terminal - `cd tools && uv run mcp_server.py --stdio` (Ctrl+C to stop). - If those fail, fix the errors first (e.g. install deps with `uv sync`). - -**"Module not found" or import errors** - -- Open the **repo root** as the project in the IDE (the folder that has `core/` and `tools/`). -- If you edited `~/.gemini/antigravity/mcp_config.json` by hand, make sure `--directory` paths are **absolute** (e.g. `/Users/you/hive/core` and `/Users/you/hive/tools`). - -**MCP tools don’t show up in the UI** - -- Antigravity may need a restart. Use the files in `docs/` as documentation; the MCP tools (`coder-tools`, `tools`) are the required integration point. - ---- - -## Verification prompt (optional) - -Paste this into Antigravity to check that MCP is set up. It doesn’t use your machine’s paths; anyone can use it. - -``` -Check the Hive + Antigravity integration: - -1. MCP: List available MCP servers/tools. Confirm that "coder-tools" and "tools" (or equivalent) are connected. If not, tell the user to run ./scripts/setup-antigravity-mcp.sh from the hive repo root, then restart Antigravity (see docs/antigravity-setup.md). - -2. Docs: Confirm that the project has `docs/` with setup/developer guides for the workflow. - -3. Result: Reply with PASS (MCP OK), PARTIAL (some MCP tools missing), or FAIL (MCP unavailable), and one line on what to fix if not PASS. -``` - -If you get **PARTIAL** (e.g. MCP not connected), run `./scripts/setup-antigravity-mcp.sh` from the repo root and restart Antigravity. - ---- - -## Manual MCP config template - -Use this only if you don’t want to run the setup script. Replace `/path/to/hive` with your actual repo root (e.g. the output of `pwd` when you’re in the hive folder). - -Save as `~/.gemini/antigravity/mcp_config.json` (Antigravity) or `~/.claude/mcp.json` (Claude Code), then **restart the IDE** to load the new configuration. - -```json -{ - "mcpServers": { - "coder-tools": { - "command": "uv", - "args": ["run", "--directory", "/path/to/hive/tools", "coder_tools_server.py", "--stdio"], - "disabled": false - }, - "tools": { - "command": "uv", - "args": ["run", "--directory", "/path/to/hive/tools", "mcp_server.py", "--stdio"], - "disabled": false - } - } -} -``` - -Make sure `uv` is installed and available in your PATH. Note: Use `--directory` in args instead of `cwd` for Antigravity compatibility. - ---- - -## Verify from the command line (optional) - -From the **repo root**: - -**Check that config exists** - -```bash -test -f .agent/mcp_config.json && echo "OK: mcp_config.json" || echo "MISSING" -``` - -**Check that the config is valid JSON** - -```bash -python3 -c "import json; json.load(open('.agent/mcp_config.json')); print('OK: valid JSON')" -``` - -**Test that MCP servers start** (two terminals) - -```bash -# Terminal 1 -cd tools && uv run coder_tools_server.py --stdio - -# Terminal 2 -cd tools && uv run mcp_server.py --stdio -``` - -If both start without errors, the config is fine. - ---- - -## See also - -- [Cursor IDE support](../README.md#cursor-ide-support) – Same MCP servers and skills for Cursor -- [MCP Integration Guide](../core/MCP_INTEGRATION_GUIDE.md) – How the framework MCP works -- [Environment setup](../ENVIRONMENT_SETUP.md) – Repo and Python setup diff --git a/docs/contributing-lint-setup.md b/docs/contributing-lint-setup.md index 020496ab..f597da0a 100644 --- a/docs/contributing-lint-setup.md +++ b/docs/contributing-lint-setup.md @@ -102,10 +102,6 @@ The repository includes a `.claude/settings.json` hook that automatically runs ` The `.cursorrules` file at the repo root tells Cursor's AI the project's style rules (line length, import order, quote style, etc.) so generated code follows convention. -### Antigravity IDE - -Antigravity IDE (Google's AI-powered IDE) is supported via `.antigravity/mcp_config.json`. See [antigravity-setup.md](antigravity-setup.md) for setup and troubleshooting. - ### Codex CLI Codex CLI (OpenAI, v0.101.0+) is supported via `.codex/config.toml` (MCP server config). This file is tracked in git. Run `codex` in the repo root to use the configured MCP tools. See the [Codex CLI section in the README](../README.md#codex-cli) for details. diff --git a/scripts/setup-antigravity-mcp.sh b/scripts/setup-antigravity-mcp.sh deleted file mode 100755 index 9b8b456e..00000000 --- a/scripts/setup-antigravity-mcp.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# -# setup-antigravity-mcp.sh - Write Antigravity/Claude MCP config with auto-detected paths -# -# Run from anywhere inside the hive repo. Generates ~/.gemini/antigravity/mcp_config.json -# based on .agent/mcp_config.json template, with absolute paths so the IDE can -# connect to tools MCP servers without manual path editing. -# -set -e - -# Find repo root -REPO_ROOT="" -if git rev-parse --show-toplevel &>/dev/null; then - REPO_ROOT="$(git rev-parse --show-toplevel)" -elif [ -f ".agent/mcp_config.json" ]; then - REPO_ROOT="$(pwd)" -else - d="$(pwd)" - while [ -n "$d" ] && [ "$d" != "/" ]; do - [ -f "$d/.agent/mcp_config.json" ] && REPO_ROOT="$d" && break - d="$(dirname "$d")" - done -fi - -if [ -z "$REPO_ROOT" ] || [ ! -d "$REPO_ROOT/core" ] || [ ! -d "$REPO_ROOT/tools" ]; then - echo "Error: Run this script from inside the hive repo (could not find repo root with core/ and tools/)." >&2 - exit 1 -fi - -TEMPLATE="$REPO_ROOT/.agent/mcp_config.json" -if [ ! -f "$TEMPLATE" ]; then - echo "Error: Template not found at $TEMPLATE" >&2 - exit 1 -fi - -CORE_DIR="$(cd "$REPO_ROOT/core" && pwd)" -TOOLS_DIR="$(cd "$REPO_ROOT/tools" && pwd)" - -mkdir -p "$HOME/.gemini/antigravity" - -# Generate config from template with absolute paths -# Replace relative "core" and "tools" with absolute paths in --directory args -sed -e "s|\"--directory\", \"core\"|\"--directory\", \"$CORE_DIR\"|g" \ - -e "s|\"--directory\", \"tools\"|\"--directory\", \"$TOOLS_DIR\"|g" \ - "$TEMPLATE" > "$HOME/.gemini/antigravity/mcp_config.json" - -echo "Wrote $HOME/.gemini/antigravity/mcp_config.json (from $TEMPLATE)" -echo " core -> $CORE_DIR" -echo " tools -> $TOOLS_DIR" - -if [ "$1" = "--claude" ]; then - mkdir -p "$HOME/.claude" - cp "$HOME/.gemini/antigravity/mcp_config.json" "$HOME/.claude/mcp.json" - echo "Wrote $HOME/.claude/mcp.json" -fi - -echo "" -echo "Next: Restart Antigravity IDE so it loads the MCP config." -echo " Then open this repo; tools should appear." -echo "" -echo "For Claude Code, run: $0 --claude"