Repository navigation
[MCP] Application profile: tool generation over Resources registry #618
Copy link
Copy link
Closed
Labels
area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLIModel Context Protocol (MCP) server: protocol, profiles, stdio CLIarea:rest-apiREST API, resources, routingREST API, resources, routingenhancementNew feature or requestNew feature or requestfeature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.
Milestone
Description
Scope. Application MCP profile. Walk the Resources registry and generate per-resource MCP tools (get_*, search_*, create_*, update_*, delete_*). Derive input JSON Schema from Table.attributes. Implement tool-name sanitization and collision rules.
Design reference. Sections "Application MCP" and "Tool-list filtering" in #465.
Acceptance criteria
- Walk
resources/Resources.tsregistry; for each exported resource (table or custom Resource), publish only the verbs the class implements (class-level introspection from [MCP] Tool registry + class-level introspection + RBAC-aware tools/list filtering #615 —prototype.method !== Resource.prototype.method). - Generated tool set per resource:
get_<r>,search_<r>,create_<r>,update_<r>,delete_<r>(each only when the verb is implemented and the user's role grants the correspondingread/insert/update/deleteflag). - Input schemas for table-backed tools derived from
Table.attributes(types, nullable, primary key) at registration time. -
search_*input schema includes optionallimit(capped atsearchMaxResults) and opaquecursor; responses includenextCursorwhen more rows exist. - Tool-name sanitization: replace
/and.with_, drop other invalid chars; on collision, prefix with database segment, then hash if still colliding. The canonical resource path appears in the tool description. - Tools delegate to the existing
Resource.get/post/...invocation path sotransactional()and instance-levelallowRead/Create/Update/Deleteenforce RBAC at call time. Restricted-attribute writes must be rejected at runtime, not just absent from the input schema — include a test covering this. -
attribute_permissionsnarrow the JSON Schema's allowed properties. - Tools dispatch returns
structuredContentplus a serialized text content block for backwards compat (per MCP §server/tools). - Unit + integration tests for: per-resource tool generation, RBAC filtering of the tool list, schema correctness, isError on restricted-write rejection, search pagination round-trip.
Out of scope. SQL (explicit non-goal). Custom Resource opt-in for non-verb methods (#622). listChanged (#619). Audit + rate limiting (#620).
Stacks on. #615 (tool registry).
Branch & PR conventions
- Branch:
feat/mcp-app-profile - PR base:
main(after [MCP] Tool registry + class-level introspection + RBAC-aware tools/list filtering #615 merges; can be parallel with [MCP] Operations profile: tool generation over OPERATION_FUNCTION_MAP #617). - Closes this issue; references Expose Operations (API) through an MCP Wrapper #465.
Smoke test
curl -sS -X POST http://localhost:9926/mcp ... \
-d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"search_product","arguments":{"conditions":[{"attribute":"category","comparator":"eq","value":"books"}],"limit":50}}}'
# Expected: structuredContent.rows[...], nextCursor on overflow.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLIModel Context Protocol (MCP) server: protocol, profiles, stdio CLIarea:rest-apiREST API, resources, routingREST API, resources, routingenhancementNew feature or requestNew feature or requestfeature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.
Type
Fields
Priority
None yet
Activity
doc(mcp): clarify visibleTo is not a tools/call security boundary (#615)
feat(mcp): resources capability — list, read, templates/list (#616)
feat(mcp): resources capability — list, read, templates/list (#616)
Merge pull request #856 from HarperFast/feat/mcp-tools
kylebernhardy commentedon May 30, 2026
Landed in PR #856 (consolidated PR-1
feat/mcp-tools) — bundled with #617, #618, #619, #620, #622 per @kriszyp's review-load preference. See umbrella #465 for the full delivery table.feat(agent): scaffold built-in Harper Agent component (#626) (#839)
feat(mcp): tool registry + RBAC-aware tools/list (HarperFast#615)
feat(mcp): application profile tool generation + exportTypes (HarperF…