Skip to content

[MCP] Application profile: tool generation over Resources registry #618

Closed

Description

@kylebernhardy

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.ts registry; 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 corresponding read/insert/update/delete flag).
  • Input schemas for table-backed tools derived from Table.attributes (types, nullable, primary key) at registration time.
  • search_* input schema includes optional limit (capped at searchMaxResults) and opaque cursor; responses include nextCursor when 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 so transactional() and instance-level allowRead/Create/Update/Delete enforce 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_permissions narrow the JSON Schema's allowed properties.
  • Tools dispatch returns structuredContent plus 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

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.

Tracking. Part of #465. Sub-issue #6 of 11.

Activity

  1. added this to the milestone on May 19, 2026
  2. added
    enhancementNew feature or request
    area:rest-apiREST API, resources, routing
    area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLI
    feature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.
    on May 19, 2026
  3. kylebernhardy commented on May 30, 2026

    @kylebernhardy
    MemberAuthor

    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.

  4. modified the milestones: , v5.1 on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLIarea:rest-apiREST API, resources, routingenhancementNew feature or requestfeature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions