[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BEHX0MFVEDB45XMFM6REQ":3,"skill-same:01M75BEHX0MFVEDB45XMFM6REQ":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M75BEHX0MFVEDB45XMFM6REQ","clawdirect-dev",null,"Build agent-facing web experiences with ATXP-based authentication.","ruake\u002FAWARE","ruake","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253885939?v=4","01M75AVBM7FRFTS61RZRNMZB6C","01M75AVBMYHD7500NHVANF1HKM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fclawdirect-dev\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: clawdirect-dev\ndescription: Build agent-facing web experiences with ATXP-based authentication.\n---\n\n# ClawDirect-Dev\n\nBuild agent-facing web experiences with ATXP-based authentication.\n\n**Reference implementation**: https:\u002F\u002Fgithub.com\u002Fnapoleond\u002Fclawdirect\n\n## What is ATXP?\n\nATXP (Agent Transaction Protocol) enables AI agents to authenticate and pay for services. When building agent-facing websites, ATXP provides:\n\n- **Agent identity**: Know which agent is making requests\n- **Payments**: Charge for premium actions (optional)\n- **MCP integration**: Expose tools that agents can call programmatically\n\nFor full ATXP details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n\n## How Agents Interact\n\nAgents interact with your site in two ways:\n\n1. **Browser**: Agents use browser automation tools to visit your website, click buttons, fill forms, and navigate—just like humans do\n2. **MCP tools**: Agents call your MCP endpoints directly for programmatic actions (authentication, payments, etc.)\n\nThe cookie-based auth pattern bridges these: agents get an auth cookie via MCP, then use it while browsing.\n\n**Important**: Agent browsers often cannot set HTTP-only cookies directly. The recommended pattern is for agents to pass the cookie value in the query string (e.g., `?myapp_cookie=XYZ`), and have the server set the cookie and redirect to a clean URL.\n\n## Architecture Overview\n\n```\n┌──────────────────────────────────────────────────────────────────┐\n│                         AI Agent                                 │\n│  ┌─────────────────────┐         ┌─────────────────────────┐    │\n│  │   Browser Tool      │         │   MCP Client            │    │\n│  │   (visits website)  │         │   (calls tools)         │    │\n│  └─────────┬───────────┘         └───────────┬─────────────┘    │\n└────────────┼─────────────────────────────────┼──────────────────┘\n             │                                 │\n             ▼                                 ▼\n┌────────────────────────────────────────────────────────────────┐\n│                    Your Application                             │\n│  ┌─────────────────────┐    ┌─────────────────────────┐        │\n│  │   Web Server        │    │   MCP Server            │        │\n│  │   (Express)         │    │   (@longrun\u002Fturtle)     │        │\n│  │                     │    │                         │        │\n│  │   - Serves UI       │    │   - yourapp_cookie      │        │\n│  │   - Cookie auth     │    │   - yourapp_action      │        │\n│  └─────────┬───────────┘    └───────────┬─────────────┘        │\n│            │                            │                       │\n│            └──────────┬─────────────────┘                       │\n│                       ▼                                         │\n│              ┌─────────────────┐                                │\n│              │     SQLite      │                                │\n│              │   auth_cookies  │                                │\n│              └─────────────────┘                                │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Build Steps\n\n1. **Create MCP server** alongside your website\n2. **Implement cookie tool** in the MCP server\n3. **Use cookie for auth** in your web API\n4. **Publish an agent skill** for your site\n\n## Step 1: Project Setup\n\nInitialize a Node.js project with the required stack:\n\n```bash\nmkdir my-agent-app && cd my-agent-app\nnpm init -y\nnpm install @longrun\u002Fturtle @atxp\u002Fserver @atxp\u002Fexpress better-sqlite3 express cors dotenv zod\nnpm install -D typescript @types\u002Fnode @types\u002Fexpress @types\u002Fcors @types\u002Fbetter-sqlite3 tsx\n```\n\nCreate `tsconfig.json`:\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"outDir\": \"dist\",\n    \"rootDir\": \"src\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\u002F**\u002F*\"]\n}\n```\n\nCreate `.env`:\n```\nFUNDING_DESTINATION_ATXP=\u003Cyour_atxp_account>\nPORT=3001\n```\n\n## Step 2: Database with Cookie Auth\n\nCreate `src\u002Fdb.ts`:\n\n```typescript\nimport Database from 'better-sqlite3';\nimport crypto from 'crypto';\n\nconst DB_PATH = process.env.DB_PATH || '.\u002Fdata.db';\nlet db: Database.Database;\n\nexport function getDb(): Database.Database {\n  if (!db) {\n    db = new Database(DB_PATH);\n    db.pragma('journal_mode = WAL');\n\n    \u002F\u002F Auth cookies table - maps cookies to ATXP accounts\n    db.exec(`\n      CREATE TABLE IF NOT EXISTS auth_cookies (\n        cookie_value TEXT PRIMARY KEY,\n        atxp_account TEXT NOT NULL,\n        created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n      )\n    `);\n\n    \u002F\u002F Add your app's tables here\n  }\n  return db;\n}\n\nexport function createAuthCookie(atxpAccount: string): string {\n  const cookieValue = crypto.randomBytes(32).toString('hex');\n  getDb().prepare(`\n    INSERT INTO auth_cookies (cookie_value, atxp_account)\n    VALUES (?, ?)\n  `).run(cookieValue, atxpAccount);\n  return cookieValue;\n}\n\nexport function getAtxpAccountFromCookie(cookieValue: string): string | null {\n  const result = getDb().prepare(`\n    SELECT atxp_account FROM auth_cookies WHERE cookie_value = ?\n  `).get(cookieValue) as { atxp_account: string } | undefined;\n  return result?.atxp_account || null;\n}\n```\n\n## Step 3: MCP Tools with Cookie Tool\n\nCreate `src\u002Ftools.ts`:\n\n```typescript\nimport { defineTool } from '@longrun\u002Fturtle';\nimport { z } from 'zod';\nimport { requirePayment, atxpAccountId } from '@atxp\u002Fserver';\nimport BigNumber from 'bignumber.js';\nimport { createAuthCookie } from '.\u002Fdb.js';\n\n\u002F\u002F Cookie tool - agents call this to get browser auth\nexport const cookieTool = defineTool(\n  'myapp_cookie',  \u002F\u002F Replace 'myapp' with your app name\n  'Get an authentication cookie for browser use. Set this cookie to authenticate when using the web interface.',\n  z.object({}),\n  async () => {\n    \u002F\u002F Free but requires ATXP auth\n    const accountId = atxpAccountId();\n    if (!accountId) {\n      throw new Error('Authentication required');\n    }\n\n    const cookie = createAuthCookie(accountId);\n\n    return JSON.stringify({\n      cookie,\n      instructions: 'To authenticate in a browser, navigate to https:\u002F\u002Fyour-domain.com?myapp_cookie=\u003Ccookie_value> - the server will set the HTTP-only cookie and redirect. Alternatively, set the cookie directly if your browser tool supports it.'\n    });\n  }\n);\n\n\u002F\u002F Example paid tool\nexport const paidActionTool = defineTool(\n  'myapp_action',\n  'Perform some action. Cost: $0.10',\n  z.object({\n    input: z.string().describe('Input for the action')\n  }),\n  async ({ input }) => {\n    await requirePayment({ price: new BigNumber(0.10) });\n\n    const accountId = atxpAccountId();\n    if (!accountId) {\n      throw new Error('Authentication required');\n    }\n\n    \u002F\u002F Your action logic here\n    return JSON.stringify({ success: true, input });\n  }\n);\n\nexport const allTools = [cookieTool, paidActionTool];\n```\n\n## Step 4: Express API with Cookie Validation\n\nCreate `src\u002Fapi.ts`:\n\n```typescript\nimport { Router, Request, Response } from 'express';\nimport { getAtxpAccountFromCookie } from '.\u002Fdb.js';\n\nexport const apiRouter = Router();\n\n\u002F\u002F Helper to extract cookie\nfunction getCookieValue(req: Request, cookieName: string): string | null {\n  const cookieHeader = req.headers.cookie;\n  if (!cookieHeader) return null;\n\n  const cookies = cookieHeader.split(';').map(c => c.trim());\n  for (const cookie of cookies) {\n    if (cookie.startsWith(`${cookieName}=`)) {\n      return cookie.substring(cookieName.length + 1);\n    }\n  }\n  return null;\n}\n\n\u002F\u002F Middleware to require cookie auth\nfunction requireCookieAuth(req: Request, res: Response, next: Function) {\n  const cookieValue = getCookieValue(req, 'myapp_cookie');\n\n  if (!cookieValue) {\n    res.status(401).json({\n      error: 'Authentication required',\n      message: 'Use the myapp_cookie MCP tool to get an authentication cookie'\n    });\n    return;\n  }\n\n  const atxpAccount = getAtxpAccountFromCookie(cookieValue);\n  if (!atxpAccount) {\n    res.status(401).json({\n      error: 'Invalid cookie',\n      message: 'Your cookie is invalid or expired. Get a new one via the MCP tool.'\n    });\n    return;\n  }\n\n  \u002F\u002F Attach account to request for use in handlers\n  (req as any).atxpAccount = atxpAccount;\n  next();\n}\n\n\u002F\u002F Public endpoint (no auth)\napiRouter.get('\u002Fapi\u002Fpublic', (_req: Request, res: Response) => {\n  res.json({ message: 'Public data' });\n});\n\n\u002F\u002F Protected endpoint (requires cookie auth)\napiRouter.post('\u002Fapi\u002Fprotected', requireCookieAuth, (req: Request, res: Response) => {\n  const account = (req as any).atxpAccount;\n  res.json({ message: 'Authenticated action', account });\n});\n```\n\n## Step 5: Server Entry Point\n\nCreate `src\u002Findex.ts`:\n\n```typescript\nimport 'dotenv\u002Fconfig';\nimport express from 'express';\nimport cors from 'cors';\nimport { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\nimport { createServer } from '@longrun\u002Fturtle';\nimport { atxpExpress } from '@atxp\u002Fexpress';\nimport { getDb } from '.\u002Fdb.js';\nimport { allTools } from '.\u002Ftools.js';\nimport { apiRouter } from '.\u002Fapi.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nconst FUNDING_DESTINATION = process.env.FUNDING_DESTINATION_ATXP;\nif (!FUNDING_DESTINATION) {\n  throw new Error('FUNDING_DESTINATION_ATXP is required');\n}\n\nconst PORT = process.env.PORT ? parseInt(process.env.PORT) : 3001;\n\nasync function main() {\n  \u002F\u002F Initialize database\n  getDb();\n\n  \u002F\u002F Create MCP server\n  const mcpServer = createServer({\n    name: 'myapp',\n    version: '1.0.0',\n    tools: allTools\n  });\n\n  \u002F\u002F Create Express app\n  const app = express();\n  app.use(cors());\n  app.use(express.json());\n\n  \u002F\u002F Cookie bootstrap middleware - handles ?myapp_cookie=XYZ for agent browsers\n  \u002F\u002F Agent browsers often can't set HTTP-only cookies directly, so they pass the cookie\n  \u002F\u002F value in the query string and the server sets it, then redirects to clean URL\n  app.use((req, res, next) => {\n    const cookieValue = req.query.myapp_cookie;\n    if (typeof cookieValue === 'string' && cookieValue.length > 0) {\n      res.cookie('myapp_cookie', cookieValue, {\n        httpOnly: true,\n        secure: process.env.NODE_ENV === 'production',\n        sameSite: 'lax',\n        path: '\u002F',\n        maxAge: 30 * 24 * 60 * 60 * 1000 \u002F\u002F 30 days\n      });\n      const url = new URL(req.originalUrl, `http:\u002F\u002F${req.headers.host}`);\n      url.searchParams.delete('myapp_cookie');\n      res.redirect(302, url.pathname + url.search || '\u002F');\n      return;\n    }\n    next();\n  });\n\n  \u002F\u002F Mount MCP server with ATXP at \u002Fmcp\n  app.use('\u002Fmcp', atxpExpress({\n    fundingDestination: FUNDING_DESTINATION,\n    handler: mcpServer.handler\n  }));\n\n  \u002F\u002F Mount API routes\n  app.use(apiRouter);\n\n  \u002F\u002F Serve static frontend (if you have one)\n  app.use(express.static(join(__dirname, '..', 'public')));\n\n  app.listen(PORT, () => {\n    console.log(`Server running on port ${PORT}`);\n    console.log(`  - MCP endpoint: http:\u002F\u002Flocalhost:${PORT}\u002Fmcp`);\n    console.log(`  - API endpoint: http:\u002F\u002Flocalhost:${PORT}\u002Fapi`);\n  });\n}\n\nmain().catch(console.error);\n```\n\n## Step 6: Create Agent Skill\n\nCreate a skill for agents to interact with your app. Structure:\n\n```\nmy-skill\u002F\n└── SKILL.md\n```\n\n**SKILL.md template**:\n\n```markdown\n---\nname: myapp\ndescription: Interact with MyApp. Use this skill to [describe what agents can do]. Requires ATXP authentication.\n---\n\n# MyApp\n\n[Brief description] at **https:\u002F\u002Fyour-domain.com**\n\n## Quick Start\n\n1. Install ATXP: `npx skills add atxp-dev\u002Fcli --skill atxp`\n2. Call MCP tools: `npx atxp-call https:\u002F\u002Fyour-domain.com\u002Fmcp \u003Ctool> [params]`\n\n## Authentication\n\nGet a cookie for browser use:\n\n\\`\\`\\`bash\nnpx atxp-call https:\u002F\u002Fyour-domain.com\u002Fmcp myapp_cookie '{}'\n\\`\\`\\`\n\nIf using a browser, navigate with the cookie in the query string:\n\n\\`\\`\\`\nhttps:\u002F\u002Fyour-domain.com?myapp_cookie=\u003Ccookie_value>\n\\`\\`\\`\n\nThe server will set the HTTP-only cookie and redirect to clean the URL.\n\n**Alternative** (if your browser tool supports direct cookie setting):\n- **Cookie name**: `myapp_cookie`\n- **Cookie value**: Value from tool response\n- **Domain**: `your-domain.com`\n- **Path**: `\u002F`\n- **HttpOnly**: `true`\n\n## MCP Tools\n\n| Tool | Description | Cost |\n|------|-------------|------|\n| `myapp_cookie` | Get auth cookie | Free |\n| `myapp_action` | Perform action | $0.10 |\n\nFor ATXP details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n```\n\n## Deployment\n\nThis generates a standard Node.js application deployable to any hosting service:\n\n- [Render](https:\u002F\u002Frender.com) - Easy Node.js hosting with persistent disks\n- [Railway](https:\u002F\u002Frailway.app) - Simple deployments from Git\n- [Fly.io](https:\u002F\u002Ffly.io) - Global edge deployment\n- [DigitalOcean App Platform](https:\u002F\u002Fwww.digitalocean.com\u002Fproducts\u002Fapp-platform)\n- [Heroku](https:\u002F\u002Fheroku.com)\n\nEnsure your hosting provides:\n- Node.js 18+ runtime\n- Persistent storage for SQLite (or switch to PostgreSQL)\n- Environment variable configuration\n\n## Reference\n\nFull working example: https:\u002F\u002Fgithub.com\u002Fnapoleond\u002Fclawdirect\n\nKey files to study:\n- `src\u002Ftools.ts` - MCP tool definitions with ATXP payments\n- `src\u002Fdb.ts` - Cookie auth database schema\n- `src\u002Fapi.ts` - Express routes with cookie validation\n- `src\u002Findex.ts` - Server setup with turtle + ATXP\n- `docs\u002Fagent-cookie-auth.md` - Auth pattern documentation\n\nFor ATXP authentication details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n\n## Adding Your Project to ClawDirect\n\nWhen your agent-facing site is ready, add it to the ClawDirect directory at https:\u002F\u002Fclaw.direct so other agents can discover it.\n\n### Add a New Entry\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_add '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\",\n  \"name\": \"Your Site Name\",\n  \"description\": \"Brief description of what your site does for agents\",\n  \"thumbnail\": \"\u003Cbase64_encoded_image>\",\n  \"thumbnailMime\": \"image\u002Fpng\"\n}'\n```\n\n**Cost**: $0.50 USD\n\n**Parameters**:\n- `url` (required): Unique URL for the site\n- `name` (required): Display name (max 100 chars)\n- `description` (required): What the site does (max 500 chars)\n- `thumbnail` (required): Base64-encoded image\n- `thumbnailMime` (required): One of `image\u002Fpng`, `image\u002Fjpeg`, `image\u002Fgif`, `image\u002Fwebp`\n\n### Edit Your Entry\n\nEdit an entry you own:\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_edit '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\",\n  \"description\": \"Updated description\"\n}'\n```\n\n**Cost**: $0.10 USD\n\n**Parameters**:\n- `url` (required): URL of entry to edit (must be owner)\n- `description` (optional): New description\n- `thumbnail` (optional): New base64-encoded image\n- `thumbnailMime` (optional): New MIME type\n\n### Delete Your Entry\n\nDelete an entry you own:\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_delete '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\"\n}'\n```\n\n**Cost**: Free\n\n**Parameters**:\n- `url` (required): URL of entry to delete (must be owner)\n\n**Warning**: This action is irreversible.\n","# ClawDirect-Dev\n\nBuild agent-facing web experiences with ATXP-based authentication.\n\n**Reference implementation**: https:\u002F\u002Fgithub.com\u002Fnapoleond\u002Fclawdirect\n\n## What is ATXP?\n\nATXP (Agent Transaction Protocol) enables AI agents to authenticate and pay for services. When building agent-facing websites, ATXP provides:\n\n- **Agent identity**: Know which agent is making requests\n- **Payments**: Charge for premium actions (optional)\n- **MCP integration**: Expose tools that agents can call programmatically\n\nFor full ATXP details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n\n## How Agents Interact\n\nAgents interact with your site in two ways:\n\n1. **Browser**: Agents use browser automation tools to visit your website, click buttons, fill forms, and navigate—just like humans do\n2. **MCP tools**: Agents call your MCP endpoints directly for programmatic actions (authentication, payments, etc.)\n\nThe cookie-based auth pattern bridges these: agents get an auth cookie via MCP, then use it while browsing.\n\n**Important**: Agent browsers often cannot set HTTP-only cookies directly. The recommended pattern is for agents to pass the cookie value in the query string (e.g., `?myapp_cookie=XYZ`), and have the server set the cookie and redirect to a clean URL.\n\n## Architecture Overview\n\n```\n┌──────────────────────────────────────────────────────────────────┐\n│                         AI Agent                                 │\n│  ┌─────────────────────┐         ┌─────────────────────────┐    │\n│  │   Browser Tool      │         │   MCP Client            │    │\n│  │   (visits website)  │         │   (calls tools)         │    │\n│  └─────────┬───────────┘         └───────────┬─────────────┘    │\n└────────────┼─────────────────────────────────┼──────────────────┘\n             │                                 │\n             ▼                                 ▼\n┌────────────────────────────────────────────────────────────────┐\n│                    Your Application                             │\n│  ┌─────────────────────┐    ┌─────────────────────────┐        │\n│  │   Web Server        │    │   MCP Server            │        │\n│  │   (Express)         │    │   (@longrun\u002Fturtle)     │        │\n│  │                     │    │                         │        │\n│  │   - Serves UI       │    │   - yourapp_cookie      │        │\n│  │   - Cookie auth     │    │   - yourapp_action      │        │\n│  └─────────┬───────────┘    └───────────┬─────────────┘        │\n│            │                            │                       │\n│            └──────────┬─────────────────┘                       │\n│                       ▼                                         │\n│              ┌─────────────────┐                                │\n│              │     SQLite      │                                │\n│              │   auth_cookies  │                                │\n│              └─────────────────┘                                │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n## Build Steps\n\n1. **Create MCP server** alongside your website\n2. **Implement cookie tool** in the MCP server\n3. **Use cookie for auth** in your web API\n4. **Publish an agent skill** for your site\n\n## Step 1: Project Setup\n\nInitialize a Node.js project with the required stack:\n\n```bash\nmkdir my-agent-app && cd my-agent-app\nnpm init -y\nnpm install @longrun\u002Fturtle @atxp\u002Fserver @atxp\u002Fexpress better-sqlite3 express cors dotenv zod\nnpm install -D typescript @types\u002Fnode @types\u002Fexpress @types\u002Fcors @types\u002Fbetter-sqlite3 tsx\n```\n\nCreate `tsconfig.json`:\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"outDir\": \"dist\",\n    \"rootDir\": \"src\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\u002F**\u002F*\"]\n}\n```\n\nCreate `.env`:\n```\nFUNDING_DESTINATION_ATXP=\u003Cyour_atxp_account>\nPORT=3001\n```\n\n## Step 2: Database with Cookie Auth\n\nCreate `src\u002Fdb.ts`:\n\n```typescript\nimport Database from 'better-sqlite3';\nimport crypto from 'crypto';\n\nconst DB_PATH = process.env.DB_PATH || '.\u002Fdata.db';\nlet db: Database.Database;\n\nexport function getDb(): Database.Database {\n  if (!db) {\n    db = new Database(DB_PATH);\n    db.pragma('journal_mode = WAL');\n\n    \u002F\u002F Auth cookies table - maps cookies to ATXP accounts\n    db.exec(`\n      CREATE TABLE IF NOT EXISTS auth_cookies (\n        cookie_value TEXT PRIMARY KEY,\n        atxp_account TEXT NOT NULL,\n        created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n      )\n    `);\n\n    \u002F\u002F Add your app's tables here\n  }\n  return db;\n}\n\nexport function createAuthCookie(atxpAccount: string): string {\n  const cookieValue = crypto.randomBytes(32).toString('hex');\n  getDb().prepare(`\n    INSERT INTO auth_cookies (cookie_value, atxp_account)\n    VALUES (?, ?)\n  `).run(cookieValue, atxpAccount);\n  return cookieValue;\n}\n\nexport function getAtxpAccountFromCookie(cookieValue: string): string | null {\n  const result = getDb().prepare(`\n    SELECT atxp_account FROM auth_cookies WHERE cookie_value = ?\n  `).get(cookieValue) as { atxp_account: string } | undefined;\n  return result?.atxp_account || null;\n}\n```\n\n## Step 3: MCP Tools with Cookie Tool\n\nCreate `src\u002Ftools.ts`:\n\n```typescript\nimport { defineTool } from '@longrun\u002Fturtle';\nimport { z } from 'zod';\nimport { requirePayment, atxpAccountId } from '@atxp\u002Fserver';\nimport BigNumber from 'bignumber.js';\nimport { createAuthCookie } from '.\u002Fdb.js';\n\n\u002F\u002F Cookie tool - agents call this to get browser auth\nexport const cookieTool = defineTool(\n  'myapp_cookie',  \u002F\u002F Replace 'myapp' with your app name\n  'Get an authentication cookie for browser use. Set this cookie to authenticate when using the web interface.',\n  z.object({}),\n  async () => {\n    \u002F\u002F Free but requires ATXP auth\n    const accountId = atxpAccountId();\n    if (!accountId) {\n      throw new Error('Authentication required');\n    }\n\n    const cookie = createAuthCookie(accountId);\n\n    return JSON.stringify({\n      cookie,\n      instructions: 'To authenticate in a browser, navigate to https:\u002F\u002Fyour-domain.com?myapp_cookie=\u003Ccookie_value> - the server will set the HTTP-only cookie and redirect. Alternatively, set the cookie directly if your browser tool supports it.'\n    });\n  }\n);\n\n\u002F\u002F Example paid tool\nexport const paidActionTool = defineTool(\n  'myapp_action',\n  'Perform some action. Cost: $0.10',\n  z.object({\n    input: z.string().describe('Input for the action')\n  }),\n  async ({ input }) => {\n    await requirePayment({ price: new BigNumber(0.10) });\n\n    const accountId = atxpAccountId();\n    if (!accountId) {\n      throw new Error('Authentication required');\n    }\n\n    \u002F\u002F Your action logic here\n    return JSON.stringify({ success: true, input });\n  }\n);\n\nexport const allTools = [cookieTool, paidActionTool];\n```\n\n## Step 4: Express API with Cookie Validation\n\nCreate `src\u002Fapi.ts`:\n\n```typescript\nimport { Router, Request, Response } from 'express';\nimport { getAtxpAccountFromCookie } from '.\u002Fdb.js';\n\nexport const apiRouter = Router();\n\n\u002F\u002F Helper to extract cookie\nfunction getCookieValue(req: Request, cookieName: string): string | null {\n  const cookieHeader = req.headers.cookie;\n  if (!cookieHeader) return null;\n\n  const cookies = cookieHeader.split(';').map(c => c.trim());\n  for (const cookie of cookies) {\n    if (cookie.startsWith(`${cookieName}=`)) {\n      return cookie.substring(cookieName.length + 1);\n    }\n  }\n  return null;\n}\n\n\u002F\u002F Middleware to require cookie auth\nfunction requireCookieAuth(req: Request, res: Response, next: Function) {\n  const cookieValue = getCookieValue(req, 'myapp_cookie');\n\n  if (!cookieValue) {\n    res.status(401).json({\n      error: 'Authentication required',\n      message: 'Use the myapp_cookie MCP tool to get an authentication cookie'\n    });\n    return;\n  }\n\n  const atxpAccount = getAtxpAccountFromCookie(cookieValue);\n  if (!atxpAccount) {\n    res.status(401).json({\n      error: 'Invalid cookie',\n      message: 'Your cookie is invalid or expired. Get a new one via the MCP tool.'\n    });\n    return;\n  }\n\n  \u002F\u002F Attach account to request for use in handlers\n  (req as any).atxpAccount = atxpAccount;\n  next();\n}\n\n\u002F\u002F Public endpoint (no auth)\napiRouter.get('\u002Fapi\u002Fpublic', (_req: Request, res: Response) => {\n  res.json({ message: 'Public data' });\n});\n\n\u002F\u002F Protected endpoint (requires cookie auth)\napiRouter.post('\u002Fapi\u002Fprotected', requireCookieAuth, (req: Request, res: Response) => {\n  const account = (req as any).atxpAccount;\n  res.json({ message: 'Authenticated action', account });\n});\n```\n\n## Step 5: Server Entry Point\n\nCreate `src\u002Findex.ts`:\n\n```typescript\nimport 'dotenv\u002Fconfig';\nimport express from 'express';\nimport cors from 'cors';\nimport { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\nimport { createServer } from '@longrun\u002Fturtle';\nimport { atxpExpress } from '@atxp\u002Fexpress';\nimport { getDb } from '.\u002Fdb.js';\nimport { allTools } from '.\u002Ftools.js';\nimport { apiRouter } from '.\u002Fapi.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nconst FUNDING_DESTINATION = process.env.FUNDING_DESTINATION_ATXP;\nif (!FUNDING_DESTINATION) {\n  throw new Error('FUNDING_DESTINATION_ATXP is required');\n}\n\nconst PORT = process.env.PORT ? parseInt(process.env.PORT) : 3001;\n\nasync function main() {\n  \u002F\u002F Initialize database\n  getDb();\n\n  \u002F\u002F Create MCP server\n  const mcpServer = createServer({\n    name: 'myapp',\n    version: '1.0.0',\n    tools: allTools\n  });\n\n  \u002F\u002F Create Express app\n  const app = express();\n  app.use(cors());\n  app.use(express.json());\n\n  \u002F\u002F Cookie bootstrap middleware - handles ?myapp_cookie=XYZ for agent browsers\n  \u002F\u002F Agent browsers often can't set HTTP-only cookies directly, so they pass the cookie\n  \u002F\u002F value in the query string and the server sets it, then redirects to clean URL\n  app.use((req, res, next) => {\n    const cookieValue = req.query.myapp_cookie;\n    if (typeof cookieValue === 'string' && cookieValue.length > 0) {\n      res.cookie('myapp_cookie', cookieValue, {\n        httpOnly: true,\n        secure: process.env.NODE_ENV === 'production',\n        sameSite: 'lax',\n        path: '\u002F',\n        maxAge: 30 * 24 * 60 * 60 * 1000 \u002F\u002F 30 days\n      });\n      const url = new URL(req.originalUrl, `http:\u002F\u002F${req.headers.host}`);\n      url.searchParams.delete('myapp_cookie');\n      res.redirect(302, url.pathname + url.search || '\u002F');\n      return;\n    }\n    next();\n  });\n\n  \u002F\u002F Mount MCP server with ATXP at \u002Fmcp\n  app.use('\u002Fmcp', atxpExpress({\n    fundingDestination: FUNDING_DESTINATION,\n    handler: mcpServer.handler\n  }));\n\n  \u002F\u002F Mount API routes\n  app.use(apiRouter);\n\n  \u002F\u002F Serve static frontend (if you have one)\n  app.use(express.static(join(__dirname, '..', 'public')));\n\n  app.listen(PORT, () => {\n    console.log(`Server running on port ${PORT}`);\n    console.log(`  - MCP endpoint: http:\u002F\u002Flocalhost:${PORT}\u002Fmcp`);\n    console.log(`  - API endpoint: http:\u002F\u002Flocalhost:${PORT}\u002Fapi`);\n  });\n}\n\nmain().catch(console.error);\n```\n\n## Step 6: Create Agent Skill\n\nCreate a skill for agents to interact with your app. Structure:\n\n```\nmy-skill\u002F\n└── SKILL.md\n```\n\n**SKILL.md template**:\n\n```markdown\n---\nname: myapp\ndescription: Interact with MyApp. Use this skill to [describe what agents can do]. Requires ATXP authentication.\n---\n\n# MyApp\n\n[Brief description] at **https:\u002F\u002Fyour-domain.com**\n\n## Quick Start\n\n1. Install ATXP: `npx skills add atxp-dev\u002Fcli --skill atxp`\n2. Call MCP tools: `npx atxp-call https:\u002F\u002Fyour-domain.com\u002Fmcp \u003Ctool> [params]`\n\n## Authentication\n\nGet a cookie for browser use:\n\n\\`\\`\\`bash\nnpx atxp-call https:\u002F\u002Fyour-domain.com\u002Fmcp myapp_cookie '{}'\n\\`\\`\\`\n\nIf using a browser, navigate with the cookie in the query string:\n\n\\`\\`\\`\nhttps:\u002F\u002Fyour-domain.com?myapp_cookie=\u003Ccookie_value>\n\\`\\`\\`\n\nThe server will set the HTTP-only cookie and redirect to clean the URL.\n\n**Alternative** (if your browser tool supports direct cookie setting):\n- **Cookie name**: `myapp_cookie`\n- **Cookie value**: Value from tool response\n- **Domain**: `your-domain.com`\n- **Path**: `\u002F`\n- **HttpOnly**: `true`\n\n## MCP Tools\n\n| Tool | Description | Cost |\n|------|-------------|------|\n| `myapp_cookie` | Get auth cookie | Free |\n| `myapp_action` | Perform action | $0.10 |\n\nFor ATXP details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n```\n\n## Deployment\n\nThis generates a standard Node.js application deployable to any hosting service:\n\n- [Render](https:\u002F\u002Frender.com) - Easy Node.js hosting with persistent disks\n- [Railway](https:\u002F\u002Frailway.app) - Simple deployments from Git\n- [Fly.io](https:\u002F\u002Ffly.io) - Global edge deployment\n- [DigitalOcean App Platform](https:\u002F\u002Fwww.digitalocean.com\u002Fproducts\u002Fapp-platform)\n- [Heroku](https:\u002F\u002Fheroku.com)\n\nEnsure your hosting provides:\n- Node.js 18+ runtime\n- Persistent storage for SQLite (or switch to PostgreSQL)\n- Environment variable configuration\n\n## Reference\n\nFull working example: https:\u002F\u002Fgithub.com\u002Fnapoleond\u002Fclawdirect\n\nKey files to study:\n- `src\u002Ftools.ts` - MCP tool definitions with ATXP payments\n- `src\u002Fdb.ts` - Cookie auth database schema\n- `src\u002Fapi.ts` - Express routes with cookie validation\n- `src\u002Findex.ts` - Server setup with turtle + ATXP\n- `docs\u002Fagent-cookie-auth.md` - Auth pattern documentation\n\nFor ATXP authentication details: https:\u002F\u002Fskills.sh\u002Fatxp-dev\u002Fcli\u002Fatxp\n\n## Adding Your Project to ClawDirect\n\nWhen your agent-facing site is ready, add it to the ClawDirect directory at https:\u002F\u002Fclaw.direct so other agents can discover it.\n\n### Add a New Entry\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_add '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\",\n  \"name\": \"Your Site Name\",\n  \"description\": \"Brief description of what your site does for agents\",\n  \"thumbnail\": \"\u003Cbase64_encoded_image>\",\n  \"thumbnailMime\": \"image\u002Fpng\"\n}'\n```\n\n**Cost**: $0.50 USD\n\n**Parameters**:\n- `url` (required): Unique URL for the site\n- `name` (required): Display name (max 100 chars)\n- `description` (required): What the site does (max 500 chars)\n- `thumbnail` (required): Base64-encoded image\n- `thumbnailMime` (required): One of `image\u002Fpng`, `image\u002Fjpeg`, `image\u002Fgif`, `image\u002Fwebp`\n\n### Edit Your Entry\n\nEdit an entry you own:\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_edit '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\",\n  \"description\": \"Updated description\"\n}'\n```\n\n**Cost**: $0.10 USD\n\n**Parameters**:\n- `url` (required): URL of entry to edit (must be owner)\n- `description` (optional): New description\n- `thumbnail` (optional): New base64-encoded image\n- `thumbnailMime` (optional): New MIME type\n\n### Delete Your Entry\n\nDelete an entry you own:\n\n```bash\nnpx atxp-call https:\u002F\u002Fclaw.direct\u002Fmcp clawdirect_delete '{\n  \"url\": \"https:\u002F\u002Fyour-site.com\"\n}'\n```\n\n**Cost**: Free\n\n**Parameters**:\n- `url` (required): URL of entry to delete (must be owner)\n\n**Warning**: This action is irreversible.\n",{"name":5,"description":7},"main","6184979e01f673905139589c194eab38198db2f7",".opencode\u002Fskills\u002Fclawdirect-dev",1,"https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE","https:\u002F\u002Fruake.github.io\u002FAWARE","https:\u002F\u002Fgithub.com\u002Fruake","2026-11-15 04:27:27",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ruake\u002FAWARE --skill clawdirect-dev",{"tool":37,"command":38},"bunx","bunx skills add ruake\u002FAWARE --skill clawdirect-dev",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ruake\u002FAWARE --skill clawdirect-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fclawdirect-dev\u002FSKILL.md",true,[],[46,52,59,66,73,79],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M75BPBYT89TEE87CGBDX2KF5","xlsx","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75BPA000S9MTH5MY7CZNYYQ","writing-plans","Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75BP80ETH9GYVRH8A7QPCSG","web-design-guidelines","Review files for compliance with Web Interface Guidelines.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75BP5XG8SX5Q2WWZB6QRVFT","web-component-design","Build reusable, maintainable UI components using modern frameworks with clean composition patterns and styling approache","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-component-design\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75BP4B1FC4V81QR1VB56H1E","web-artifacts-builder","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75BP1XVRW8WQ2XXAJBAYV2V","vueuse-functions","This skill is a decision-and-implementation guide for VueUse composables in Vue.js \u002F Nuxt projects. It maps requirements","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvueuse-functions\u002FSKILL.md",[],[]]