harness-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
harness-mcp
An opinionated TypeScript boilerplate for building MCP servers with harness engineering in mind.
Harness engineering is the discipline of designing the scaffolding around an LLM agent — tools, descriptions, errors, context — so the agent actually does the right thing. Most MCP boilerplates teach you the protocol. This one teaches you the protocol and the practice.
What's in the box
defineTool()— one Zod schema feeds the MCP SDK, OpenAI's function-calling API, and the runtime handler. Validation and error wrapping are automatic.Both transports — stdio (
src/index.ts) for Claude Code-style local clients, Streamable HTTP (src/http.ts) for remote/web clients. Both share onecreateServer().Structured
AgentErrors — every error has acode, amessage, and ahintwritten for the model: "callitems_listfirst to find a valid id." Vague errors waste turns; this fixes that at the type level.A real eval harness — Vitest-based. Unit tests run free in CI;
tests/mcp/echo.test.tsdrives a real OpenAI model through the MCP server via an in-memory transport pair and asserts on the resulting tool-call trace.A simple CRUD example —
items_create / list / read / update / deleteplus anechotool. Replace the in-memory store with your real backend; keep the shape.
Related MCP server: TypeScript MCP Server Boilerplate
Quick start
bun install
bun test # unit tests, no API key needed
bun run start # stdio server on stdin/stdout
bun run start:http # HTTP server on http://localhost:3000/mcpTo run the model-in-the-loop evals:
cp .env.example .env
# add OPENAI_API_KEY
bun run test:mcpWire into Claude Code
{
"mcpServers": {
"harness-mcp": {
"command": "bun",
"args": ["run", "/absolute/path/to/harness/mcp/src/index.ts"]
}
}
}Layout
src/
index.ts stdio entry
http.ts streamable-http entry
core/
server.ts createServer() — shared by both transports
tool.ts defineTool() wrapper
errors.ts AgentError
store.ts replace with your backend
tools/
echo.ts smoke-test tool
items-*.ts CRUD example tools
index.ts registry
tests/
unit/ fast, no API key
tool.test.ts
store.test.ts
mcp/ protocol + model-in-the-loop
setup.ts in-memory client + runWithModel() helper
smoke.test.ts no model
echo.test.ts gpt-4o-mini, skipped without OPENAI_API_KEYThe opinions
Tool descriptions are prompt engineering. Every description leads with
USE WHEN ...and includesDO NOT USE WHEN ...for sibling tools the model could confuse this with. The smoke test enforces the convention.Errors teach. Every
AgentErrorcarries ahintfield. Read your error messages as if you were the agent — would you know what to do next? If not, rewrite.List endpoints paginate.
items_listreturns{ items, nextCursor }. Default limit 20, hard cap 100. Don't dump unbounded data into the context.Destructive ops accept
dryRun.items_deletewill tell you what would happen if you weren't sure.One Zod, three consumers. Don't maintain JSON Schema by hand alongside Zod —
defineToolderives both.Evals are tests. Tool-call traces are assertable. When a description regression breaks the model's behavior, your test catches it.
License
MIT.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
A simple Typescript MCP server built using the official MCP Typescript SDK and smithery/cli. This…
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
A MCP server built for developers enabling Git based project management with project and personal…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA TypeScript-based template for rapidly developing MCP servers with modular tool architecture, built-in validation using Zod schemas, and comprehensive error handling.5 npmMIT
- AlicenseAqualityDmaintenanceA boilerplate for building MCP servers using TypeScript, with example tools like calculator and greet, plus resource support.6MIT
- AlicenseBqualityDmaintenanceA TypeScript MCP server boilerplate providing example tools and resources for rapid development of custom Model Context Protocol servers.8ISC
- AlicenseBqualityDmaintenanceA TypeScript MCP server boilerplate providing example tools and resources for rapid development and testing of Model Context Protocol servers.7ISC