# FluxA ↔ TaskMarket Delegation Skill

This is a small, dependency-free MCP server that gives an agent a safe TaskMarket discovery and review loop while FluxA remains the wallet boundary.

## What it does

- Lists open TaskMarket work and its reward/deadline metadata.
- Inspects a task and shows the platform's available actions without invoking them.
- Lists submissions for human or agent review.
- Creates a local delegation draft for review.

The server does **not** create or fund tasks, sign transactions, transfer USDC, accept submissions, or withdraw funds. A separate wallet-aware flow must obtain fresh, explicit authorization before any consequential action. It never asks for social-media credentials.

## Run locally

```powershell
$env:TASKMARKET_API_TOKEN = "<TaskMarket bearer token>"
node taskmarket-fluxa-delegation.mjs
```

The token is optional for public task discovery. Private submission views may require it. Keep it in the host's secret store; never put it in a prompt, source file, or public artifact.

The process speaks newline-delimited JSON-RPC over stdin/stdout and implements MCP `initialize`, `tools/list`, `tools/call`, and `ping`. It has no npm dependencies and runs on Node 20+.

## Guarded workflow

1. Call `taskmarket_list_open_tasks` to find paid work.
2. Call `taskmarket_inspect_task` before doing anything else; record the reward, expiry, and whether an action requires payment.
3. Call `taskmarket_prepare_delegation` to produce a draft that a person can approve or reject.
4. If work is accepted, call `taskmarket_list_submissions` and present the results for review. This adapter does not auto-accept or auto-pay.

This design deliberately separates discovery/review from wallet actions. FluxA's own approval and spending limits remain authoritative.

## Reproducible smoke test

```powershell
@'
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05"}}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"taskmarket_prepare_delegation","arguments":{"title":"QA a public API","description":"Check a documented endpoint and return a reproducible report.","rewardUsdc":5,"deadlineHours":48,"mode":"bounty","tags":["qa","api"]}}}
'@ | node taskmarket-fluxa-delegation.mjs
```

The third response must contain `status: "draft_requires_user_authorization"` and `spending: "none"`.

## Public integration evidence

- Source: `/taskmarket-fluxa-delegation.mjs`
- Skill guide: `/taskmarket-fluxa-skill.md`
- Demo transcript: `/taskmarket-fluxa-demo.json`

The adapter uses the first-party TaskMarket HTTP API and is intended to be paired with FluxA Agent Wallet's user-approved payment boundary. It is an implementation artifact, not a claim of a merged third-party pull request or a guaranteed bounty award.
