Skip to main content
Glama
README.md
<div align="center">

# πŸ€– GitHub AI

### Turn plain-language needs into safely discovered developer tools

[![Python](https://img.shields.io/badge/Python-3.12+-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
[![Architecture](https://img.shields.io/badge/Architecture-Clean-8A2BE2?style=for-the-badge)](docs/architecture.md)
[![Security](https://img.shields.io/badge/Security-First-00A86B?style=for-the-badge&logo=shield&logoColor=white)](docs/security-model.md)
[![Tests](https://img.shields.io/badge/Coverage-90%25+-FF6B6B?style=for-the-badge)](tests/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue?style=for-the-badge)](LICENSE)
[![Release](https://img.shields.io/badge/Release-v0.1.0-F59E0B?style=for-the-badge)](#project-status)

**Discover β€’ Evaluate β€’ Acquire β€’ Build β€’ Verify β€’ Run safely**

**v0.1.0** is the first public release: a security-first CLI and [MCP](https://modelcontextprotocol.io) server that lets an AI agent (Claude Code, OpenAI Codex, or any MCP client) discover a tool on GitHub, acquire it as untrusted source, build and behaviorally verify it inside a hardened Docker sandbox, register it in a managed catalog, and run it later under the same isolation. Nothing from GitHub ever executes on your host.

</div>

---

## ✨ The vision

Millions of useful tools live on GitHub, but finding the right repository, judging its quality, installing dependencies, and running unknown code safely still requires specialist knowledge.

**GitHub AI bridges that gap.** It interprets a natural-language request, searches GitHub, ranks suitable projects with clear evidence, securely acquires their source, and prepares them inside hardened isolated environments.

> The long-term goal is simple: make developer tools accessible to everyone while keeping security, provenance, and user control at the center.

## πŸš€ What it does

| Capability | Description |
|:--|:--|
| πŸ’¬ **Understands intent** | Converts plain-language requirements into a structured tool search. |
| πŸ”Ž **Discovers tools** | Searches GitHub through the official API and explainably ranks candidates. |
| πŸ›‘οΈ **Acquires securely** | Pins archives to commits, enforces download limits, validates extraction, and hashes content. |
| πŸ§ͺ **Inspects safely** | Examines source statically without importing or executing repository code. |
| πŸ“¦ **Plans deterministic builds** | Detects runtimes and lockfiles, applies dependency policy, and records auditable build plans. |
| 🐳 **Uses hardened sandboxes** | Creates restricted Docker environments and verifies their effective security controls. |
| πŸ“‹ **Preserves evidence** | Stores lifecycle events, decisions, logs, artifacts, and provenance for later review. |

## 🎨 How it works

```text
πŸ‘€ Plain-language request
          β”‚
          β–Ό
🧠 Interpret requirements
          β”‚
          β–Ό
πŸ” Search and rank GitHub repositories
          β”‚
          β–Ό
πŸ›‘οΈ Acquire and inspect untrusted source
          β”‚
          β–Ό
πŸ“¦ Plan and approve a deterministic build
          β”‚
          β–Ό
🐳 Build and verify inside an isolated sandbox
          β”‚
          β–Ό
βœ… Auditable tool registration and controlled execution
```

## πŸ” Security by design

GitHub repositories are treated as **untrusted code** from the first byte. The project follows a fail-closed model:

- Source code never executes directly on the host.
- Downloads are commit-pinned, size-limited, validated, and deterministically hashed.
- Archive extraction blocks traversal, links, special files, and unsafe paths.
- Build plans require explicit approval and use catalog-owned commands.
- Containers use restricted privileges, isolated workspaces, and verified security settings.
- Network-dependent build steps remain blocked unless an approved controller can enforce policy.
- Logs are bounded and redacted; important actions produce durable audit evidence.
- Secrets are redacted from logs and error payloads (`[REDACTED TOKEN]`); `system_doctor` reports only whether a GitHub token is configured, never its value.
- Execution is admission-controlled: only registered, behaviorally verified tools run, and each run is isolated and cleaned up (no leftover containers or workspaces).
- Idempotent execution requests: identical concurrent requests resolve to one attempt.

**Limits:** Docker containers share the host kernel. v0.1.0 is not a defense against kernel-level escapes; do not point it at a Docker daemon you do not trust.

Read the [security model](docs/security-model.md), [threat model](docs/threat-model.md), and [sandbox policy](docs/sandbox-security-policy.md) for details.

## 🧩 Architecture

The codebase follows clean architecture, keeping core policy independent from frameworks and infrastructure:

```text
CLI β†’ Application handlers β†’ Domain
             ↑
   Infrastructure adapters
```

- **Domain:** lifecycle rules, value objects, policies, and invariants
- **Application:** use cases and ports
- **Infrastructure:** GitHub, SQLite, Docker, filesystem, and runtime adapters
- **Interfaces:** Typer-based command-line experience

See the full [architecture guide](docs/architecture.md).

## ⚑ Quick start

### Requirements

- Python 3.12+
- Docker Engine for sandbox and build operations
- A GitHub token for authenticated discovery

### Installation

```bash
git clone git@github.com:Abdullahzahoor755/github-tool-agent.git
cd github-tool-agent

python3.12 -m venv .venv
.venv/bin/pip install -e '.[dev]'
cp .env.example .env

# Add your GitHub token to .env: GTA_GITHUB__TOKEN=<token>
.venv/bin/tool-agent db upgrade
.venv/bin/tool-agent doctor
```

### End-to-end in five commands

```bash
.venv/bin/tool-agent discover "Find a Go CLI that prints a greeting"
.venv/bin/tool-agent acquisition run https://github.com/<owner>/<repo>
.venv/bin/tool-agent inspect source src_<id>
# build + verify + register (see "Prepare a secure build" below, or the MCP tool build_and_verify_tool)
.venv/bin/tool-agent run cat_<id> -- --help
```

### Discover a tool

```bash
.venv/bin/tool-agent discover "Find a GitHub tool that converts PDF files to Word"
.venv/bin/tool-agent discovery candidates dis_<id>
```

### Acquire and inspect source

```bash
.venv/bin/tool-agent acquisition run https://github.com/example/tool
.venv/bin/tool-agent inspect source src_<id>
```

### Prepare a secure build

```bash
.venv/bin/tool-agent build create tool_<id> --source-artifact-id src_<id>
.venv/bin/tool-agent build plan bld_<id>
.venv/bin/tool-agent build approve bld_<id> --reason "Reviewed recorded plan"
.venv/bin/tool-agent build start bld_<id>
```

Run `.venv/bin/tool-agent --help` to explore all commands.

## πŸ–₯️ CLI usage

| Command | Purpose |
|:--|:--|
| `tool-agent discover "<need>"` | Search GitHub, rank candidates with evidence, and shortlist a repository. Options: `--max-candidates`, `--shortlist-size`, `--preferred-language`, `--license-policy`, `--json`. |
| `tool-agent verify <job_id>` | Behaviorally verify a successful build inside the hardened sandbox. Options: `--capability-category` (for example `CLI_SMOKE`), `--json`. |
| `tool-agent register <report_id> <canonical_name>` | Register a passed verification report in the managed catalog. Options: `--idempotency-key`, `--json`. |
| `tool-agent run <tool_id> -- <args>` | Run a verified catalog tool in the sandbox. Prints exit code, admission decision (`ADMITTED`), and isolation status. |
| `tool-agent catalog list [--json]` | List verified tools (`catalog deduplicate` collapses legacy duplicates). |
| `tool-agent doctor [--json]` | Check configuration, database, migrations, security defaults, and Docker sandbox capabilities. |
| `tool-agent mcp` | Start the MCP server (stdio by default; `--transport streamable-http\|sse`). |

## πŸ”Œ MCP setup (Claude Code and OpenAI Codex)

The MCP server exposes six tools: `discover_github_tools`, `acquire_and_inspect_repo`, `build_and_verify_tool`, `list_verified_tools`, `run_verified_tool`, and `system_doctor`.

Use absolute paths so the server finds the same database and data directory regardless of the client's working directory.

**Claude Code**

```bash
claude mcp add github-tool-agent \
  -e GTA_GITHUB__TOKEN=<token> \
  -e GTA_DATA_DIRECTORY=/abs/path/github-tool-agent/data \
  -e GTA_DATABASE_URL=sqlite:////abs/path/github-tool-agent/data/tool-agent.db \
  -- /abs/path/github-tool-agent/.venv/bin/tool-agent mcp
```

**OpenAI Codex** (`~/.codex/config.toml`)

```toml
[mcp_servers.github-tool-agent]
command = "/abs/path/github-tool-agent/.venv/bin/tool-agent"
args = ["mcp"]

[mcp_servers.github-tool-agent.env]
GTA_GITHUB__TOKEN = "<token>"
GTA_DATA_DIRECTORY = "/abs/path/github-tool-agent/data"
GTA_DATABASE_URL = "sqlite:////abs/path/github-tool-agent/data/tool-agent.db"
```

Codex users also get an orchestration guide at [`.codex/skills/github-tool-agent/SKILL.md`](.codex/skills/github-tool-agent/SKILL.md). Run `tool-agent db upgrade` once before first use, and confirm with the `system_doctor` tool.

## πŸ§ͺ Development

```bash
.venv/bin/pytest
.venv/bin/ruff check .
.venv/bin/ruff format --check .
.venv/bin/mypy
```

The test suite includes unit, integration, architecture, security, malicious-archive, build, sandbox, verification, registration, and runtime-admission coverage.

## πŸ—ΊοΈ Roadmap

**Shipped in v0.1.0**
- [x] Secure repository resolution and acquisition
- [x] Natural-language discovery and explainable ranking
- [x] Static source inspection
- [x] Hardened sandbox lifecycle
- [x] Deterministic build planning and artifact collection
- [x] Behavioral verification, managed catalog, and admission-controlled execution
- [x] MCP server for Claude Code and OpenAI Codex

**v2 roadmap**
- [ ] Stronger isolation through microVM (for example Firecracker) or remote execution backends
- [ ] Policy-controlled network egress for builds that need dependencies
- [ ] Broader runtime and ecosystem support beyond the current build strategies
- [ ] Additional verification capability packs beyond `CLI_SMOKE`
- [ ] Friendly web experience for non-technical users
- [ ] Community-driven trust signals and reusable verification evidence

## 🌱 Project status

**v0.1.0, initial public release.** The core pipeline (`discover β†’ acquire β†’ inspect β†’ build β†’ verify β†’ register β†’ run`) works end to end. Interfaces and storage schemas may change before v1.0. Treat generated results and third-party tools as untrusted until independently reviewed.

## 🀝 Contributing

Ideas, bug reports, security improvements, tests, and documentation contributions are welcome. Please open an issue before proposing a large architectural change.

<div align="center">

---

### Building a safer bridge between human ideas and open-source software πŸŒ‰

If this vision resonates with you, consider giving the project a ⭐.

</div>

## πŸ“„ License

Licensed under the [Apache License 2.0](LICENSE). Copyright (c) 2026 M. Abdullah.