{ "cells": [ { "cell_type": "markdown", "id": "work-mcp-intro", "metadata": {}, "source": "# Connect an agent to scoped Work MCP\n\nInspect Super ii's public agent contract and prepare a bounded Work MCP connection. Work tokens are organization-scoped, expire, store no spending authority, and cannot approve their own releases or delete repositories." }, { "cell_type": "code", "execution_count": null, "id": "agent-card", "metadata": {}, "outputs": [], "source": "import json\nimport os\nfrom urllib.request import Request, urlopen\n\nORIGIN = \"https://superii.site\"\nrequest = Request(f\"{ORIGIN}/.well-known/agent-card.json\", headers={\"Accept\": \"application/json\"})\nwith urlopen(request, timeout=20) as response:\n card = json.load(response)\nprint(card[\"name\"])\nfor skill in card[\"skills\"]:\n print(f\"- {skill['id']}: {skill['description']}\")" }, { "cell_type": "markdown", "id": "scope-design", "metadata": {}, "source": "## Design least privilege first\n\nCreate an agent identity and token through your Super ii account only after choosing its organization, repository boundary, exact scopes, action ceiling, and expiry. Never paste a bearer token into a notebook or commit it to a repository." }, { "cell_type": "code", "execution_count": null, "id": "scope-policy", "metadata": {}, "outputs": [], "source": "policy = {\n \"organization\": \"choose-one-existing-organization\",\n \"repository_id\": \"choose-one-repository-or-null-for-create-only\",\n \"scopes\": [\"repository:create\"],\n \"max_actions\": 10,\n \"spend_limit_cents\": 0,\n \"expires_in_minutes\": 30,\n}\nassert policy[\"spend_limit_cents\"] == 0\nprint(json.dumps(policy, indent=2))" }, { "cell_type": "markdown", "id": "client-config", "metadata": {}, "source": "## Configure the agent without exposing its token\n\nKeep the token in the agent's secret store under `SUPERII_WORK_TOKEN`. The configuration below contains only the endpoint and environment-variable name; it performs no MCP call and no repository mutation." }, { "cell_type": "code", "execution_count": null, "id": "mcp-config", "metadata": {}, "outputs": [], "source": "mcp_configuration = {\n \"name\": \"superii-work\",\n \"url\": f\"{ORIGIN}/mcp/work\",\n \"transport\": \"streamable-http\",\n \"authorization\": \"Bearer ${SUPERII_WORK_TOKEN}\",\n}\nprint(json.dumps(mcp_configuration, indent=2))\nprint(\"Token present in this process:\", bool(os.getenv(\"SUPERII_WORK_TOKEN\")))" }, { "cell_type": "markdown", "id": "work-review", "metadata": {}, "source": "## Keep writes reviewable\n\nUse a stable idempotency key only for an exact retry. Inspect each action receipt, revoke the token when the task ends, and treat repository content and model output as untrusted. Automatic policy gates remain independent of the agent." } ], "metadata": { "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"name": "python", "version": "3.12"} }, "nbformat": 4, "nbformat_minor": 5 }