Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Building Benchline: browser tools that are also a stateless MCP server

Description and use

Benchline unifies browser tool logic into a single pure function usable as a web page and an MCP agent, eliminating code duplication.

Problem

Developing lightweight, stateless browser tools that can be used both as web pages and as Model Context Protocol (MCP) agents without duplication of logic.

Outcome

Benchline achieves a unified, stateless architecture where each tool’s core logic is shared across web, HTTP, and MCP interfaces, reducing duplication and easing maintenance.

Workflow

  • Organize each tool in its own folder under src/tools/<slug>/ with meta.ts, tool.tsx, lib/, and mcp.ts.
  • Implement the core logic in lib/, a pure function that takes input and options and returns a result object.
  • Wrap the function in a thin web page (tool.tsx) for human use.
  • Create an MCP entry point (mcp.ts) that defines zod schemas and a run function calling the same lib function.
  • Export a BenchTool object containing slug, name, title, description, schemas, and run.
  • Deploy the site so each tool is accessible as a page and as an MCP agent.
  • Use vitest for unit testing the pure function.
  • Fix bugs in lib/ once to update all surfaces.

Evidence

Every tool lives in its own folder under src/tools/<slug>/: src/tools/<slug>/ meta.ts name, tagline, category, FAQ, SEO copy tool.tsx the client workspace a person uses lib/ the pure function, covered by vitest mcp.ts the agent entry point, calling the same lib/

Source

Nothing in it knows about React, HTTP or MCP. It takes a string and options and returns a result object. That makes it easy to test with vitest and easy to call from anywhere.

Source

The agent entry point is mcp.ts. It declares a zod input schema, a zod output schema, and a run function that calls the same formatJson

Source

  • Record date: 2026-10-18T14:56:09.331Z