Inspiration

Every "AI marketplace" I've seen is just an existing store with a chatbot bolted on. The agent still scrapes DOM elements, blindly clicks buttons, and breaks on every UI update. I kept asking: what would a marketplace look like if AI agents were the primary client from day one?

The answer was AgentMarket — and the Chrome WebMCP standard made it finally possible to build it properly.

What it does

AgentMarket is a peer-to-peer marketplace where the entire negotiation protocol is declared natively on the webpage via navigator.modelContext.registerTool(). Two independent AI agents — a buyer and a seller, in separate browser tabs — can discover listings, initiate offers, counter, accept, and schedule pickup entirely through structured WebMCP tool calls. No scraping. No hidden API. No blind button clicking.

The 8 registered protocol tools include:

  • search_listings(query, maxPrice, category)
  • get_listing_details(listingId)
  • make_offer(listingId, amount, message)
  • counter_offer(negotiationId, amount, message)
  • accept_offer(negotiationId)
  • reject_offer(negotiationId, reason)
  • propose_pickup(negotiationId, location, time)
  • get_negotiation_history(negotiationId)

Tools are dynamically gated by role and turn — a buyer cannot accept_offer on their own offer; the tool surface itself enforces business logic.

How I built it

Built on Next.js 16 with a serverless in-memory store backing the negotiation state. The WebMCP tool registration lives in lib/webmcp-tools.ts, loaded on both the marketplace feed and individual listing pages. Cross-tab negotiation state is synchronized via BroadcastChannel + 1.5s polling — when one agent takes an action, the opposing tab's UI reflects it within seconds without any WebSocket infrastructure.

A built-in WebMCP Protocol Inspector drawer lets judges see every tool call, its arguments, and its result in real time as the negotiation unfolds.

Challenges I ran into

  • Turn-based enforcement at the tool registration layer was non-trivial. Dynamically re-registering tools on each state change (to gate accept_offer by whose turn it is) required careful AbortController management to avoid stale tool references.
  • Cross-tab state sync without WebSockets — I had to combine BroadcastChannel (for instant same-origin signals) with polling as a fallback to handle cases where tabs open in different contexts.
  • Role isolation — the buyer and seller tool surfaces needed to be distinct subsets without two separate codebases. The exposedTo scoping in the WebMCP spec guided the security boundary design.

Accomplishments that I'm proud of

The thing I'm most proud of is the "impossible before" story actually being true. Before WebMCP, an AI agent on a marketplace had two bad options: find a private API (rare) or scrape HTML (fragile). AgentMarket makes the negotiation protocol a first-class, machine-readable capability of the webpage itself — the same way <form> made submitting data a first-class web primitive in 1993.

The live two-agent negotiation demo — two tabs, two roles, watch them go from listing to closed deal in under 90 seconds — is something that genuinely did not exist before this standard.

What I learned

  • The WebMCP registerTool surface is deceptively powerful as a business logic boundary, not just an AI interface layer.
  • Serverless stateful apps are perfectly viable for hackathon-scale demos when the state model is simple and the sync strategy is explicit.
  • Writing for agents first and humans second produces a dramatically cleaner API surface — it forces you to make implicit business rules explicit and machine-verifiable.

What's next for AgentMarket

  • Persistent storage (Redis / Vercel KV) to survive cold starts and support real multi-user sessions.
  • Cross-origin tool scoping — enabling embedded listing widgets on third-party sites that still invoke AgentMarket's negotiation tools via exposedTo whitelisting.
  • Autonomous agent integration — wiring up an actual LLM agent loop so buyers/sellers can set a budget goal and let the agent negotiate on autopilot while the human watches the audit log.
  • Reputation & escrow tools — extending the protocol with rate_transaction and initiate_escrow tools, making trust and payment first-class WebMCP capabilities too.

Built With

Share this project:

Updates

Submission history