Skip to content

MCP parity: support prompts (list/get) in the MCP client #193

Done

Description

@w4ffl35

Problem

HeadlessCode's MCP client supports tools only: MCP prompts (server-provided reusable prompt templates) are not listed or fetched, so configured servers' prompt libraries are invisible to sessions. Called out in docs/mcp.md / docs/gap-audit.md as partial parity.

Architecture (independent solution)

Add prompts as a read-only discovery surface; do not auto-inject them into the system prompt:

  1. Extend the MCP client wrapper with listPrompts / getPrompt via the pinned @modelcontextprotocol/sdk (^1.32.1). Reuse the existing server-config, limits (max 12 servers), and session-end close lifecycle.
  2. Expose them like the skills surface if a close analogue exists (docs/skills.md): list metadata first, fetch full template only on explicit model/user request — never splice untrusted prompt text into the system prompt automatically. State the chosen surfacing in the PR and mirror the MCP-resources issue's idiom if it landed first.
  3. Argument handling: prompt arguments are strings per spec; validate required args are present before calling, return the server's error verbatim (bounded) otherwise.
  4. Update docs/mcp.md supported list in the same change.

Scope / non-goals

  • No resources support (separate issue), no OAuth, no automatic prompt injection, no workspace .mcp.json execution.

Acceptance

  • Fake MCP server with one prompt: list shows name/args, get returns rendered messages (bounded).
  • Server without prompts capability → empty list, no crash; other servers unaffected.

Tests (happy / sad / bad)

  • Happy: list + get with required args.
  • Sad: get with missing required arg → clean validation error before any server call.
  • Bad: oversized prompt result → truncated with note; malformed server response → tool error, session continues.

Contributor notes

Good first issue if you keep it to list/get against the existing fake-server test fixtures. No live server in CI.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Nov 29, 2026
  2. Bhanu-partap-13 commented on Dec 2, 2026

    @Bhanu-partap-13

    Hi @w4ffl35, I can work on this issue. I have planed to implement listPrompts/getPrompt using the existing MCP client wrapper, validate required arguments, and add tests using the fake-server fixtures. Is this issue available for me to take?

  3. w4ffl35 commented on Dec 2, 2026

    @w4ffl35
    MemberAuthor

    Hi @w4ffl35, I can work on this issue. I have planed to implement listPrompts/getPrompt using the existing MCP client wrapper, validate required arguments, and add tests using the fake-server fixtures. Is this issue available for me to take?

    Yes, and feel free to use AI.

  4. w4ffl35 commented on Dec 5, 2026

    @w4ffl35
    MemberAuthor

    Issue 193 — Closing Report

    Files changed

    • src/vendor/zoo-code/src/services/mcp/McpHub.ts: McpPromptLike types, connect-time prompt discovery, listPrompts/getPrompt
    • src/engine/mcp-prompts.ts (new): mcp_list_prompts + mcp_get_prompt tools (metadata-first, string args, 64K truncation)
    • src/engine/loop.ts: register handlers + advertise tools (session start + mode switch, unrestricted sessions only)
    • src/vendor/tests/fixtures/mcp-stdio-server.mjs: greet prompt fixture
    • src/engine/tests/mcp-prompts.test.ts (new): 18 unit tests
    • docs/mcp.md: prompts supported-list update

    Baseline (before)

    • MCP client supported tools only for prompts surface (docs/mcp.md: prompts not implemented).

    Baseline (after)

    • Fake stdio server with greet prompt: list shows name/description/args, get renders messages (verified live via hub probe)
    • Server without prompts capability: empty list, no crash (verified: bare server lists [], tools unaffected); unknown server errors naming the server
    • 18/18 unit tests pass; resources suite 16/16 unaffected; McpHub fixture still green

    Boot check

    • N/A (no boot path changed); tsc clean; prompt text never enters system prompt (discovery-only, explicit get).

    Residual risk / notes

    • Surfacing mirrors the MCP-resources idiom (list metadata first, fetch full template only on explicit request).
    • Malformed server responses surface as tool errors; session continues.
    • No resources/OAuth/auto-injection per scope.

    PR: #202

  5. added a commit that references this issue on Dec 5, 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

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions