harness-mcp
harness-mcp
Harnessエンジニアリングを念頭に置いた、MCPサーバー構築のための独断的なTypeScriptボイラープレートです。
Harnessエンジニアリングとは、LLMエージェントを取り巻く足場(ツール、説明、エラー、コンテキスト)を設計し、エージェントが実際に正しい動作をするようにするための規律です。ほとんどのMCPボイラープレートはプロトコルを教えるだけですが、これはプロトコルと実践の両方を教えます。
含まれているもの
defineTool()— 1つのZodスキーマで、MCP SDK、OpenAIの関数呼び出しAPI、およびランタイムハンドラーに供給します。バリデーションとエラーのラップは自動的に行われます。両方のトランスポート — Claude Codeスタイルのローカルクライアント用のstdio (
src/index.ts) と、リモート/Webクライアント用のストリーミング可能なHTTP (src/http.ts)。どちらも1つのcreateServer()を共有します。構造化された
AgentError— すべてのエラーには、モデル向けに書かれたcode、message、およびhintが含まれます(例:「有効なIDを見つけるために、まずitems_listを呼び出してください」)。曖昧なエラーはターンを無駄にします。これは型レベルでそれを修正します。本格的な評価ハーネス — Vitestベース。ユニットテストはCIで自由に実行でき、
tests/mcp/echo.test.tsはメモリ内トランスポートペアを介してMCPサーバーを通じて実際のOpenAIモデルを駆動し、結果として得られるツール呼び出しトレースをアサートします。シンプルなCRUDの例 —
items_create / list / read / update / deleteに加え、echoツール。メモリ内ストアを実際のバックエンドに置き換えても、形状は維持されます。
Related MCP server: TypeScript MCP Server Boilerplate
クイックスタート
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/mcpモデル・イン・ザ・ループの評価を実行するには:
cp .env.example .env
# add OPENAI_API_KEY
bun run test:mcpClaude Codeへの組み込み
{
"mcpServers": {
"harness-mcp": {
"command": "bun",
"args": ["run", "/absolute/path/to/harness/mcp/src/index.ts"]
}
}
}レイアウト
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_KEY設計思想
ツールの説明はプロンプトエンジニアリングである。 すべての説明は
USE WHEN ...で始まり、モデルが混同する可能性のある兄弟ツールに対してはDO NOT USE WHEN ...を含めます。スモークテストはこの慣習を強制します。エラーは教えるためのもの。 すべての
AgentErrorはhintフィールドを持ちます。エラーメッセージをエージェントになったつもりで読んでみてください。次に何をすべきか分かりますか?分からなければ、書き直してください。リストエンドポイントはページネーションする。
items_listは{ items, nextCursor }を返します。デフォルトの制限は20、ハードキャップは100です。制限のないデータをコンテキストに流し込まないでください。破壊的操作は
dryRunを受け入れる。items_deleteは、確信が持てない場合に何が起こるかを事前に教えてくれます。1つのZod、3つのコンシューマー。 Zodと並行してJSON Schemaを手動で管理しないでください。
defineToolが両方を導出します。評価はテストである。 ツール呼び出しのトレースはアサート可能です。説明の回帰によってモデルの動作が壊れた場合、テストがそれを検知します。
ライセンス
MIT。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.9MIT
- FlicenseAqualityDmaintenanceA boilerplate for building MCP servers using TypeScript, with example tools like calculator and greet, plus resource support.6
- FlicenseBqualityCmaintenanceA TypeScript MCP server boilerplate providing example tools and resources for rapid development of custom Model Context Protocol servers.8
- FlicenseNot gradedqualityDmaintenanceA TypeScript MCP server boilerplate providing example tools and resources for rapid development and testing of Model Context Protocol servers.
Related MCP Connectors
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…
Kickstart development with a customizable TypeScript template featuring sample tools for greeting,…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/giuseppecrj/harness-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server