Open Harness
A code-first, composable SDK to build powerful AI agents
What is Open Harness?
Open Harness is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to code-first, composable sdk to build powerful ai agents
A code-first, composable SDK to build powerful AI agents
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A code-first, composable SDK to build powerful AI agents
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @openharness/coreManual Installation
npx -y @openharness/coreConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Open Harness
OpenHarness is a code-first, composable TypeScript SDK for building general-purpose AI agents, inspired by Claude Code and Codex. It provides an Agent class backed by Vercel's AI SDK, built-in filesystem and bash tools, multi-turn Session management with automatic context compaction and retry, composable middleware (turn tracking, retry, compaction), and nested subagent delegation with optional background runs. Developers use it to build custom coding agents, chat interfaces, and automation workflows in Node.js without being locked to a single LLM provider.
Prerequisites
- Node.js 18+ and npm or pnpm
- An LLM provider API key — default examples use OPENAI_API_KEY; the package supports any Vercel AI SDK provider including Anthropic, Groq, and others
- An MCP-compatible client if using the MCP server mode (Claude Desktop, Cursor, etc.)
Install the core package
Install @openharness/core and an AI SDK provider package. The default examples use OpenAI, but you can substitute any Vercel AI SDK-compatible provider.
npm install @openharness/core @ai-sdk/openaiCreate a basic agent
Import Agent from @openharness/core, configure it with a model and tools, then iterate over the streamed events. The built-in createFsTools and createBashTool give the agent file system and shell access.
import { Agent, createFsTools, createBashTool, NodeFsProvider, NodeShellProvider } from "@openharness/core";
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "dev",
model: openai("gpt-4o"),
tools: {
...createFsTools(new NodeFsProvider()),
...createBashTool(new NodeShellProvider()),
},
maxSteps: 20,
});
for await (const event of agent.run([], "List all TypeScript files and count lines")) {
if (event.type === "text.delta") process.stdout.write(event.text);
}Add multi-turn Sessions for persistent conversations
Wrap the agent in a Session to maintain conversation history across messages. The Session handles context window compaction and automatic retry transparently.
import { Session } from "@openharness/core";
const session = new Session({ agent, contextWindow: 128_000 });
for await (const event of session.send("List all TypeScript files")) {
if (event.type === "text.delta") process.stdout.write(event.text);
}
for await (const event of session.send("Now refactor the largest one")) {
if (event.type === "text.delta") process.stdout.write(event.text);
}Add composable middleware
Use the apply helper with middleware factories to add turn tracking, context compaction, and retry behavior to any agent runner without modifying the agent itself.
import { Conversation, toRunner, apply, withTurnTracking, withCompaction, withRetry } from "@openharness/core";
const runner = apply(
toRunner(agent),
withTurnTracking(),
withCompaction({ contextWindow: 200_000, model: agent.model }),
withRetry({ maxRetries: 5 }),
);
const chat = new Conversation({ runner });
for await (const event of chat.send("Fix all linting errors")) { /* ... */ }Add to your MCP client config
If you want to use the OpenHarness MCP server mode, add it to your Claude Desktop or Cursor configuration using npx.
{
"mcpServers": {
"open-harness": {
"command": "npx",
"args": ["-y", "@openharness/core"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key"
}
}
}
}Open Harness Examples
Client configuration
Claude Desktop configuration for the OpenHarness MCP server using npx with an OpenAI API key.
{
"mcpServers": {
"open-harness": {
"command": "npx",
"args": ["-y", "@openharness/core"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}Prompts to try
Example tasks suited to OpenHarness agents equipped with filesystem and bash tools.
- "List all TypeScript files in the src directory and identify any that are over 300 lines."
- "Refactor the auth module to use async/await instead of callbacks."
- "Run the test suite and summarize which tests are failing and why."
- "Find all TODO comments in the codebase and create a prioritized task list."
- "Analyze the package.json and suggest dependency updates with changelog summaries."Troubleshooting Open Harness
Agent exceeds context window and throws a context length error
Wrap the agent in a Session or use the withCompaction middleware with a contextWindow value that matches your model's limit. Compaction summarizes older turns before they would overflow the window.
Bash tool executes commands but changes are not persisted between turns
Each bash tool invocation runs in a fresh shell by default. Chain commands with && or write state to files between turns. The filesystem tools (createFsTools) maintain state through the real filesystem.
Provider API key errors or model not found
Ensure the provider package matching your chosen model is installed (e.g. @ai-sdk/openai for OpenAI, @ai-sdk/anthropic for Claude) and the correct environment variable is set (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.).
Frequently Asked Questions about Open Harness
What is Open Harness?
Open Harness is a Model Context Protocol (MCP) server that code-first, composable sdk to build powerful ai agents It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Open Harness?
Install via npm with the command: npx -y @openharness/core. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Open Harness?
Open Harness works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Open Harness free to use?
Yes, Open Harness is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Open Harness Alternatives — Similar Coding Agents Servers
Looking for alternatives to Open Harness? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Open Harness in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Open Harness?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.