harn-mcp
БесплатноБез исполняемых скриптовНе проверенUse for MCP client connections, server definitions, inbound roots/sampling/elicitation, and deterministic MCP fixtures.
от burin-labs★ 34 звезды на GitHubОб этом скилле
Build MCP clients and servers in Harn
Use this skill when a Harn program talks to an MCP server or serves one. Pair it with harn-testing for deterministic fixtures, harn-agent for tool exposure inside an agent loop, and harn-providers when sampling routes back to a model.
Maintainers changing Harn's own MCP implementation should read
docs/src/dev/mcp-maintenance.md instead. This skill covers writing MCP
clients and servers in Harn, not editing the runtime that carries them.
Start here
docs/src/mcp-and-acp.mdis the public client and server reference.docs/src/mcp-server.mdcovers the orchestrator server,harn mcp serve.- Harn's stdio servers accept the released
initializelifecycle and the 2026-07-28 request-metadata lifecycle. Streamable HTTP uses 2026-07-28. - The official Rust SDK owns protocol mechanics; Harn owns product policy.
- Route every capability through
harness.tools.*.
Connect as a client
Connect explicitly when the server is chosen at runtime:
const client = harness.tools.mcp_connect("npx", ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])
const info = harness.tools.mcp_server_info(client)
const tools = harness.tools.mcp_list_tools(client)
const content = harness.tools.mcp_call(client, "read_file", {path: "/tmp/data.txt"})
harness.tools.mcp_disconnect(client)
Resources and prompts use mcp_list_resources, mcp_read_resource,
mcp_list_resource_templates, mcp_list_prompts, and mcp_get_prompt.
mcp_callreturns a string for a single text result, a list of content dicts for multiple blocks, or nil when empty.mcp_callthrows when the tool reports an error. Catch it where the pipeline can recover; do not let a remote failure read as an empty result.- Disconnect what you connect. Prefer declared servers when the set is fixed.
Declare servers instead of connecting by hand
Put a fixed server set in harn.toml as repeated mcp array-of-tables
entries. Each entry carries name, plus either command and args for stdio,
or transport = "http" and url. Declared servers connect before the pipeline
runs and appear in the global mcp dict.
- Mark a server
lazy = truewhen most runs never call it. It boots on the firstmcp_call,mcp_ensure_active("name"), or skill activation that names it inrequires_mcp. - Declare the server once. Do not also
mcp_connectthe same target.
Resolve inbound requests
A stable server asks the client for work by returning input_required with
embedded requests. Harn resolves them and retries the operation with
inputResponses. Harn advertises roots, form and URL elicitation, sampling,
and the stable tasks extension.
- Roots resolve from script and project roots, also readable through
harness.tools.mcp_roots(). - Sampling dispatches to the host bridge as
capability="mcp",operation="sample". Approved requests route tollm_call. Without approval, Harn returns a structured decline; treat that as a normal outcome. - Elicitation dispatches as
capability="mcp",operation="elicit"in form and URL modes. Harn never prefetches or opens an elicited URL. - Long tool calls poll through
tasks/get. Do not add a wait loop of your own.
Install fixtures before the call that triggers the request, not after the run
starts failing. A harness may install them after mcp_connect returns; the
client reads fixture state when the inbound request arrives.
Serve a Harn pipeline over MCP
type GreetingInput = {name: string}
pipeline main(harness: Harness) {
let tools = tool_registry()
tools = tool_define(tools, "greet", "Greet someone", {
inputSchema: schema_to_json_schema(schema_of(GreetingInput)) + {additionalProperties: false},
handler: { args: GreetingInput -> "Hello, ${args.name}!" },
annotations: {title: "Greeter", readOnlyHint: true},
})
harness.tools.mcp_tools(tools)
}
Keep required arguments in the advertised input schema. Derive it from a named
input type with schema_to_json_schema(schema_of(Input)); use
additionalProperties: false to refuse extra arguments. An arg_schema value
inside annotations does not define the tool's input contract.
Add harness.tools.mcp_resource(...), harness.tools.mcp_resource_template(...),
and harness.tools.mcp_prompt(...) for the other surfaces. Run the script with
harn serve mcp agent.harn. Use composition_mcp_tools() from
std/composition for the governed Code Mode profile.
- List endpoints paginate at 100 entries and return
nextCursor. Override withHARN_MCP_LIST_PAGE_SIZE. printandprintlngo to stderr when stdio is the transport. Never write protocol output to stdout yourself.- Out-of-scope features fail with
error.data.type = "mcp.unsupportedFeature". - Set
readOnlyHintanddestructiveHinthonestly. Clients gate approval on them.
Write and verify workspace files
For a generated tool package, harness.fs.project_root() names the pack
Установить harn-mcp в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл harn-mcp?
Use for MCP client connections, server definitions, inbound roots/sampling/elicitation, and deterministic MCP fixtures.
Как установить скилл harn-mcp?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл harn-mcp запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic