docs/principles/first-scope.md의 Phase 1을 실제 작업 단위로 풀어낸 문서.
원칙: 단순하게 시작 / 작게 만들기 / 빠르게 검증.
로컬 anvil 위에서 다음 end-to-end 동선이 web UI로 완주되는 것:
market 생성 → YES/NO 베팅 → 수동 resolve → claim
이게 끝나야 Phase 2(API/인덱서/오라클)의 의미가 생긴다.
Market, MarketFactory 컨트랙트 (binary outcome, 수동 resolve)buy_yes/no, claim) → Phase 3 (AA + session key 위임 후)packages/contractsMarket.sol
buyYes() payable, buyNo() payableresolve(bool outcome) — onlyOwnerclaim() — winner pro-rata 분배MarketFactory.sol
createMarket(question, endTime) → Market 배포markets() 조회MarketCreated, Bought, Resolved, Claimedscript/Deploy.s.sol: anvil에 factory 배포packages/sdkcreateFactoryClient(address, publicClient, walletClient)getMarkets(), getMarket(address)buyYes, buyNo, resolve, claimforge build 산출물에서 import (수동 복사 금지)packages/web/ markets list (factory.markets() 호출)/markets/[addr] — 베팅 UI + 내 포지션 + claim 버튼.env.local (multi-chain은 Phase 2)packages/openclaw-skillThe Week 2 OpenClaw-specific skill spike has been replaced by a single MCP server (@verex/mcp-server) that any harness — OpenClaw, Claude Dispatch, Claude Desktop, Cursor — connects to. OpenClaw skill / Dispatch connector become thin wrappers on top of MCP in a later phase. The Week 2 work item is now: scaffold the MCP server. Full spec: see “MCP Server v0 — Phase 1 Task Spec” at the bottom of this file.
| M | 시점 | 산출물 |
|---|---|---|
| M1 | Day 3 | 컨트랙트 + 테스트 통과, anvil 배포 스크립트 동작 |
| M2 | Day 7 | SDK로 anvil 위에서 create/bet/claim CLI 시연 |
| M2.5 | Day 11 | MCP server v0 scaffold + list_markets works from Claude Desktop on local anvil |
| M3 | Day 14 | Web에서 메타마스크로 동일 플로우 완주 |
| M4 | Day 21 | Demo recording — 두 지갑 베팅, owner resolve, winner claim |
Runs in parallel with Web MVP. MCP server work is time-boxed — if it slips, Web MVP takes priority and MCP rolls into Week 3.
packages/mcp-server/ (folder structure, package.json, tsconfig.json, README)pnpm-workspace.yaml and turbo.json to include the new packagelist_markets, get_market, get_position, get_market_statslist_markets and get_market against @verex/sdk (do not import viem directly)list_markets against anvildocs/history/0001-mcp-server-as-canonical-agent-interface.mddocs/principles/ design doc §11.1 to MCP-first languageforge test 100% 통과, 핵심 invariant 포함docs/features/README.md §11.2 참고.buyYes/buyNo escrow API가 v2에서 fillOrder 류로 교체됨. 강제 결합은 아니되 인터페이스 명명/위치가 어색해지지 않게 둘 것.각 phase는 별도 02-*.md, 03-*.md로 확장 예정.
You are working in the Verex monorepo (/Users/jay/work/verex).
Verex is a Web3 prediction market dApp. The full design is in docs/principles/ (see the v1.1 design doc).
Currently the design doc has §11.1 (TODO) which proposes integrating Verex with personal AI assistants (OpenClaw skill, Dispatch, etc.) in Phase 3.
We are changing this decision: instead of writing one integration per harness (OpenClaw skill, Dispatch connector, etc.), we will publish a single MCP (Model Context Protocol) server as the canonical machine interface to Verex. Any harness — OpenClaw, Claude Dispatch, Cursor, Claude Desktop, etc. — connects to this MCP server. The MCP server becomes the single source of truth for programmatic access; OpenClaw skills or Dispatch connectors (if we publish them later) become thin wrappers around it.
We are also moving this work into Phase 1 because:
Update planning documents and scaffold the new package so that Phase 1 includes a working read-only Verex MCP server.
docs/principles/ design doc to reflect the new decision.docs/features/01-phase-1-core.md to add the MCP server work.docs/history/ documenting the decision.packages/mcp-server/ with package.json, tsconfig, README, and stub source files.pnpm-workspace.yaml and turbo.json so the new package is part of the monorepo.buy_yes, claim, etc.) — those wait for AA + session keys in Phase 3.@modelcontextprotocol/sdk. Node.js worker.@verex/sdk for all chain reads. Do not import viem directly in packages/mcp-server/. This matches the existing rule for mm-agent.VEREX_RPC_URL), chain id via env var (VEREX_CHAIN_ID).@verex/mcp-server.These are the tools the MCP server should advertise. For this task only declare them in the README + as stubs that throw NotImplementedError. Implementation comes in a follow-up task.
| Tool | Input | Output | Notes |
|---|---|---|---|
list_markets |
{ status?: "open" \| "resolved" \| "all" } |
Market[] |
Calls sdk.markets.list() |
get_market |
{ id: string } |
Market |
Calls sdk.markets.get(id) |
get_position |
{ user: string, marketId: string } |
Position |
Calls sdk.positions.get(...) |
get_market_stats |
{ id: string } |
{ yesPool, noPool, impliedYesProb } |
Derived in SDK |
Write tools (buy_yes, buy_no, claim, subscribe_market) are deferred to Phase 3 — list them in the README under a “Future tools (post-AA)” section but do not stub them.
docs/history/0001-mcp-server-as-canonical-agent-interface.md — short ADR (Context / Decision / Consequences) explaining why MCP is now the single agent interface and why it moved to Phase 1.
docs/principles/ design doc edit — modify §11.1:
@verex/mcp-server). 하네스(OpenClaw / Dispatch / Claude Desktop / Cursor 등)는 모두 이 MCP 서버를 경유한다.”docs/features/01-phase-1-core.md edit — add a new section (suggest: §4 or appended) titled “MCP Server v0 (read-only)” containing:
packages/mcp-server/list_markets + get_market against @verex/sdkcast queries against the deployed Market contract.packages/mcp-server/ — scaffold:
packages/mcp-server/
├── src/
│ ├── index.ts # entry: starts MCP stdio server
│ ├── server.ts # registers tools
│ ├── tools/
│ │ ├── list-markets.ts
│ │ ├── get-market.ts
│ │ ├── get-position.ts
│ │ └── get-market-stats.ts
│ └── config.ts # env loading
├── test/
│ └── server.test.ts # one trivial test that the server boots
├── package.json
├── tsconfig.json
└── README.md
package.json: name @verex/mcp-server, private: true, depends on @verex/sdk (workspace:*) and @modelcontextprotocol/sdk.README.md: how to run locally (pnpm --filter @verex/mcp-server dev), how to add to Claude Desktop’s claude_desktop_config.json, list of v0 tools, list of future tools (write path), and the SDK-only rule.throw new Error("NotImplemented: <tool> ships in a follow-up task") except list_markets and get_market, which call the SDK if it exposes those methods, otherwise also throw NotImplemented.pnpm-workspace.yaml includes packages/mcp-server and turbo.json pipelines (build, dev, test, lint) cover it the same way as other packages.After your changes, the following should all pass:
pnpm install
pnpm --filter @verex/mcp-server build
pnpm --filter @verex/mcp-server test
pnpm --filter @verex/mcp-server dev # should start and wait on stdio
And manually:
docs/history/0001-*.md exists and is non-empty.docs/principles/ design doc reflects MCP-first language in §11.1.docs/features/01-phase-1-core.md has the new MCP section with subtasks and acceptance criteria.packages/mcp-server/README.md lists the 4 v0 tools and the deferred write tools.@verex/sdk does not yet export markets.list() / markets.get(), leave the tool stubs throwing NotImplemented and add a note in docs/features/01-phase-1-core.md listing the SDK methods that need to be added (do not modify the SDK in this task).// TODO(verex): comment and continue — do not block.When done, summarize in chat: