LazyOwn OpenCode Adapter

May 2, 2026 ยท View on GitHub

OpenAI-compatible function calling adapter for the LazyOwn pentesting framework.

Bridges the LazyOwn MCP server with OpenCode, Kimi, and any OpenAI-compatible client by translating tool schemas and providing a REST interface for tool discovery and execution.

Architecture

OpenCode / Kimi / OpenAI Client
        |
        | HTTP JSON (OpenAI function format)
        v
  LazyOwn OpenCode Adapter (this repo)
        |
        | stdio MCP protocol
        v
  LazyOwn MCP Server (lazyown_mcp.py)
        |
        | Python imports + subprocess
        v
  LazyOwn Framework

Installation

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Configuration

All configuration is parameterizable via CLI arguments or environment variables. No absolute paths are hardcoded.

CLI Arguments

ArgumentDefaultEnvironment VariableDescription
--lazyown-dirLAZYOWN_DIR or /home/grisun0/LazyOwnLAZYOWN_DIRPath to the LazyOwn framework directory.
--host127.0.0.1ADAPTER_HOSTHost to bind the adapter server.
--port9872ADAPTER_PORTPort to bind the adapter server.
--log-levelinfoADAPTER_LOG_LEVELLogging level.

Example

python3 adapter.py --lazyown-dir /opt/LazyOwn --host 0.0.0.0 --port 8080

Endpoints

GET /health

Health check.

curl http://127.0.0.1:9872/health

GET /tools

List all available LazyOwn tools in OpenAI function format.

curl http://127.0.0.1:9872/tools

POST /call

Execute a tool by name with arguments.

curl -X POST http://127.0.0.1:9872/call \
  -H "Content-Type: application/json" \
  -d '{
    "name": "lazyown_set_config",
    "arguments": {
      "key": "rhost",
      "value": "10.10.11.78"
    }
  }'

GET /config

Show current adapter configuration.

curl http://127.0.0.1:9872/config

Using with OpenCode

Since OpenCode supports tool calling natively via HTTP, configure the adapter and then make requests to it using the standard tool calling workflow.

Example workflow:

  1. Start the adapter:

    python3 adapter.py --lazyown-dir /path/to/LazyOwn
    
  2. List available tools:

    curl -s http://127.0.0.1:9872/tools | python3 -m json.tool
    
  3. Call a tool:

    curl -s -X POST http://127.0.0.1:9872/call \
      -H "Content-Type: application/json" \
      -d '{"name": "lazyown_get_config", "arguments": {}}'
    

Files

FileDescription
config.pyImmutable configuration dataclass. All paths are derived from lazyown_dir.
adapter.pyFastAPI application + MCP client + OpenAI function translator.
requirements.txtPython dependencies.

Requirements

  • Python 3.10+
  • LazyOwn framework installed at any path (configured via --lazyown-dir)
  • mcp Python SDK (installed automatically via requirements.txt)

License

Same as LazyOwn.