Skip to content

ask: HTTP API (POST /api/v1/ask) and the w3bs_ask MCP tool - #277

Merged
sh1pt-actions-fleet[bot] merged 1 commit into
mainfrom
feat/ask-api-mcp
Nov 2, 2026
Merged

sh1pt-actions-fleet[bot] merged 1 commit into
mainfrom
feat/ask-api-mcp

Conversation

@sh1pt-actions-fleet

Copy link
Copy Markdown
Contributor

The server side of w3bs ask (#275), so ask ships with a CLI, TUI, API and MCP:

  • API: POST /api/v1/ask {agent, question, search?} returns the same object as w3bs ask --json (answer, sources, node, job id, latency). GET /api/v1/ask/agents lists the agents. No key is needed; the limit is 20 questions an hour per client IP (W3BS_ASK_PER_HOUR).
  • MCP: w3bs_ask on the hosted /mcp and on the stdio server.
  • Transport: the same as the CLI. Infernet /api/chat with p2p_only, and any non-p2p route is refused, so there is no paid fallback. The server sends INFERNET_API_KEY (an Infernet trusted-client key, set in the dev2 app.env) so w3bs.org users do not share one anonymous 20/h budget.
  • Same registry (fixtures/agents.json), grounding and prompt as the CLI.
  • Tests: test/ask.test.mjs covers the unit pieces, plus the API and MCP against a fake pit.world and Infernet (checks p2p_only, the bearer, sources, node and the throttle). The conformance tool count goes to 12.

🤖 Generated with Claude Code

The server side of `w3bs ask` (docs/ask.md), so ask ships on every surface:
CLI + TUI chat (w3bs 0.1.19), API, MCP (hosted /mcp and stdio).

- src/ask.mjs: same registry (fixtures/agents.json), pit.world grounding,
  question-first prompt and echo strip as the CLI; Infernet /api/chat with
  p2p_only and a non-p2p route refused; INFERNET_API_KEY from the server env.
- POST /api/v1/ask {agent, question, search?} (+ /api/ask for the stdio MCP),
  GET /api/v1/ask/agents; 20 questions an hour per client IP (W3BS_ASK_PER_HOUR).
- w3bs_ask on the hosted and stdio MCP servers; discovery lists the ask URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sh1pt-actions-fleet
sh1pt-actions-fleet Bot merged commit 2e7188d into main Nov 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant