Sign inSign up

yadayac/reshapr-kit:0.2.0

Multi-platform
Machine learning & AI
Developer tools
Manifest digest

sha256:1aa881553147fd5dc91e1e43b64b9964899470531d293481138dffc6abaeb7e1

Last pushed

1 day by yadayac

Type

Sandbox Kit

Manifest digest

sha256:1aa881553147fd5dc91e1e43b64b9964899470531d293481138dffc6abaeb7e1

yaml
schemaVersion: "3"
displayName: reShapr (local server)
description: Registers a reShapr MCP exposition running on the host with the agent. The exposition API key stays on the host; the sandbox proxy injects it.
sourceUrl: https://github.com/yada/reshapr-sbx-poc
version: 0.2.0
licenses:
    - Apache-2.0
kind: mixin
capabilities:
    - type: com.docker.sandbox/network-policy@1
      config:
        install:
            allow:
                - localhost:${{ kit.args.port }}
        runtime:
            allow:
                - localhost:${{ kit.args.port }}
    - type: com.docker.sandbox/credential@1
      optional: true
      config:
        apiKey:
            inject:
                - domain: localhost
                  format: '%s'
                  header: x-reshapr-key
            name: RESHAPR_API_KEY
            proxyManaged: true
        phase:
            - install
            - runtime
        service: reshapr
      description: API key of the reShapr Configuration Plan. Store it with `sbx secret set reshapr`.
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                command -v claude >/dev/null 2>&1 || exit 0
                claude mcp add reshapr "http://host.docker.internal:${{ kit.args.port }}/mcp/${{ kit.args.exposition }}" \
                  --transport http --scope user \
                  --header "x-reshapr-key: $RESHAPR_API_KEY" || true
              description: Register the reShapr exposition with Claude Code
              env:
                - RESHAPR_API_KEY
              user: agent
            - command: |
                command -v codex >/dev/null 2>&1 || exit 0
                mkdir -p "$HOME/.codex"
                cfg="$HOME/.codex/config.toml"
                touch "$cfg"
                grep -q '^\[mcp_servers.reshapr\]' "$cfg" && exit 0
                cat >> "$cfg" <<EOF

                [mcp_servers.reshapr]
                url = "http://host.docker.internal:${{ kit.args.port }}/mcp/${{ kit.args.exposition }}"
                [mcp_servers.reshapr.http_headers]
                x-reshapr-key = "$RESHAPR_API_KEY"
                EOF
              description: Register the reShapr exposition with Codex
              env:
                - RESHAPR_API_KEY
              user: agent
            - command: |
                command -v copilot >/dev/null 2>&1 || exit 0
                command -v jq >/dev/null 2>&1 || { echo "jq missing: reshapr not registered with Copilot" >&2; exit 0; }
                dir="$HOME/.copilot"; cfg="$dir/mcp-config.json"
                mkdir -p "$dir"
                [ -s "$cfg" ] || echo '{}' > "$cfg"
                tmp="$(mktemp "$dir/mcp-config.json.XXXXXX")"
                jq --arg url "http://host.docker.internal:${{ kit.args.port }}/mcp/${{ kit.args.exposition }}" \
                   --arg key "$RESHAPR_API_KEY" \
                   '.mcpServers = ((.mcpServers // {}) + {reshapr: {type: "http", url: $url, headers: {"x-reshapr-key": $key}, tools: ["*"]}})' \
                   "$cfg" > "$tmp" && chmod 600 "$tmp" && mv -f "$tmp" "$cfg" || rm -f "$tmp"
              description: Register the reShapr exposition with Copilot CLI
              env:
                - RESHAPR_API_KEY
              user: agent
    - type: com.docker.sandbox/agent-context@1
      config:
        content: |
            ## reShapr MCP tools

            An MCP server named `reshapr` is registered. It gives governed access to
            backend APIs: call its tools instead of reaching the APIs directly (direct
            egress to them is blocked). `RESHAPR_API_KEY` holds a placeholder, not the
            real key; the sandbox proxy adds the real one. Responses are already
            trimmed by reShapr, so prefer the tool output over re-fetching.
args:
    exposition:
        default: reshapr/open-meteo-weather-forecast-api-1-0-default
        description: <organization>/<exposition-name> path of the exposition (see `reshapr expo list`).
        pattern: ^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$
        env: RESHAPR_EXPOSITION
    port:
        default: "7777"
        description: Host port of the reShapr server.
        pattern: ^[0-9]{2,5}$
        env: RESHAPR_PORT