harper-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHarper MCP
Harper MCP
Guidelines for exposing a Harper instance as a Model Context Protocol (MCP) server and for building the tools, prompts, and resources AI clients consume. Harper implements MCP Streamable HTTP (spec rev 2025-06-18) with two independent profiles: (your app's surface) and (Harper administration).
applicationoperations本指南介绍如何将Harper实例部署为Model Context Protocol(MCP)服务器,以及构建AI客户端所需的工具、提示词和资源。Harper实现了MCP Streamable HTTP(规范版本2025-06-18),包含两个独立配置文件:(应用层面)和(Harper管理层面)。
applicationoperationsWhen to Use
使用场景
Reference these guidelines when:
- Enabling or configuring the MCP endpoint on a Harper instance
- Connecting an MCP client (Claude, agent frameworks, custom HTTP code) to Harper
- Deciding what tools an AI should see for a schema, or trimming that surface
- Exposing custom behavior (), prompt templates (
mcpTools), or content (mcpPrompts) to AI clientsmcpResources - Protecting a public or anonymous-accessible MCP endpoint (rate limits, durable quotas, hardening)
- Debugging MCP wire errors (session/protocol headers, 400s, SSE)
在以下场景中参考本指南:
- 在Harper实例上启用或配置MCP端点
- 将MCP客户端(Claude、Agent框架、自定义HTTP代码)连接到Harper
- 确定AI针对某一模式应可见的工具,或精简工具范围
- 向AI客户端暴露自定义行为()、提示词模板(
mcpTools)或内容(mcpPrompts)mcpResources - 保护公开或可匿名访问的MCP端点(速率限制、持久配额、加固)
- 调试MCP通信错误(会话/协议头、400状态码、SSE)
How It Works
工作原理
- Start with to mount a profile, then
enabling-mcpfor the handshake contract.connecting-clients - For the tool surface, consult first — most CRUD needs are covered with zero code — and reach for
automatic-verb-toolsonly for real behavior.custom-mcp-tools - For content and templates, use and
custom-mcp-resources;custom-mcp-promptsexplains what exists without any code.resources-surface - Before any public exposure, work through 's checklist and configure
security-posture(+rate-limitingfor cost-bearing tools).durable-quotas
- 首先通过挂载配置文件,然后通过
enabling-mcp完成握手协议。connecting-clients - 对于工具范围,首先参考——大多数CRUD需求无需代码即可满足——仅在需要实现实际行为时使用
automatic-verb-tools。custom-mcp-tools - 对于内容和模板,使用和
custom-mcp-resources;custom-mcp-prompts介绍了无需代码即可使用的现有资源。resources-surface - 在公开暴露之前,完成的检查清单,并配置
security-posture(对于产生成本的工具,还需配置rate-limiting)。durable-quotas
Examples
示例
See the concrete examples embedded in each rule (curl handshakes, / declarations, quota-hook implementations, and hardening configs).
<!-- BEGIN GENERATED INDEX -->static mcpToolsmcpResources查看每个规则中嵌入的具体示例(curl握手、/声明、配额钩子实现以及加固配置)。
<!-- BEGIN GENERATED INDEX -->static mcpToolsmcpResourcesRule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Setup & Connection | HIGH | |
| 2 | Tools & Prompts | HIGH | |
| 3 | Resources | MEDIUM | |
| 4 | Operations & Security | HIGH | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | 设置与连接 | 高 | |
| 2 | 工具与提示词 | 高 | |
| 3 | 资源 | 中 | |
| 4 | 运维与安全 | 高 | |
Quick Reference
快速参考
1. Setup & Connection (HIGH)
1. 设置与连接(高优先级)
- — How to enable and configure Harper's MCP server profiles (application and operations).
enabling-mcp - — How MCP clients connect to Harper - the initialize handshake, session and protocol-version headers, and authentication.
connecting-clients
- — 如何启用和配置Harper的MCP服务器配置文件(应用和运维层面)。
enabling-mcp - — MCP客户端如何连接到Harper——初始化握手、会话和协议版本头,以及身份验证。
connecting-clients
2. Tools & Prompts (HIGH)
2. 工具与提示词(高优先级)
- — How Harper auto-generates CRUD MCP tools from exported tables, with RBAC filtering and allow/deny/maxTools controls.
automatic-verb-tools - — How to expose custom instance methods as MCP tools via static mcpTools, including the anonymous-exposure security model.
custom-mcp-tools - — How to publish reusable prompt templates to MCP clients via static mcpPrompts.
custom-mcp-prompts
- — Harper如何从导出的表自动生成CRUD MCP工具,包含RBAC过滤以及允许/拒绝/maxTools控制。
automatic-verb-tools - — 如何通过static mcpTools将自定义实例方法暴露为MCP工具,包括匿名访问的安全模型。
custom-mcp-tools - — 如何通过static mcpPrompts向MCP客户端发布可复用的提示词模板。
custom-mcp-prompts
3. Resources (MEDIUM)
3. 资源(中优先级)
- — The MCP resources surface - harper:// metadata URIs, harper+rest:// table descriptors, templates, subscriptions, and list_changed notifications.
resources-surface - — How to serve custom content (docs pages, reports, binaries) as MCP resources via static mcpResources with URI templates and completions.
custom-mcp-resources
- — MCP资源范围——harper://元数据URI、harper+rest://表描述符、模板、订阅以及list_changed通知。
resources-surface - — 如何通过带有URI模板和补全功能的static mcpResources,将自定义内容(文档页面、报告、二进制文件)作为MCP资源提供。
custom-mcp-resources
4. Operations & Security (HIGH)
4. 运维与安全(高优先级)
- — MCP tools/call rate limiting - per-tool, per-session, and per-client-identity token buckets, and the identityHeader trust model.
rate-limiting - — Operator-pluggable durable quotas for MCP tools/call via the server.setMcpQuotaHandler registration hook, with a race-safe counter pattern.
durable-quotas - — The MCP security model - anonymous access, RBAC boundaries, origin validation, audit logging, and the hardening checklist for public instances.
security-posture
- — MCP工具/调用速率限制——按工具、按会话、按客户端身份的令牌桶机制,以及identityHeader信任模型。
rate-limiting - — 运维人员可通过server.setMcpQuotaHandler注册钩子为MCP工具/调用配置可插拔的持久配额,包含竞态安全的计数器模式。
durable-quotas - — MCP安全模型——匿名访问、RBAC边界、来源验证、审计日志,以及公开实例的加固检查清单。
security-posture
How to Use
使用方法
Read individual rule files for detailed explanations and code examples:
rules/enabling-mcp.md
rules/connecting-clients.md
rules/custom-mcp-tools.md
rules/custom-mcp-resources.md
rules/security-posture.md阅读单个规则文件以获取详细说明和代码示例:
rules/enabling-mcp.md
rules/connecting-clients.md
rules/custom-mcp-tools.md
rules/custom-mcp-resources.md
rules/security-posture.mdFull Compiled Document
完整编译文档
For the complete guide with all rules expanded:
AGENTS.md如需包含所有扩展规则的完整指南,请查看:
AGENTS.md