Skip to content

Support user-provided directory of *.prompt.md files #2

@data-douser

Description

@data-douser

Enable users to extend the MCP server with custom prompts by specifying an additional directory of *.prompt.md files at startup.

Configuration

Add new CLI/environment option:

--prompts-dir <path>    Additional directory of *.prompt.md files
CODEQL_MCP_PROMPTS_DIR  Environment variable alternative

Implementation Design

  1. Extend server/src/prompts/prompt-loader.ts

    • Accept optional additionalPromptDirs: string[] parameter
    • Validate directory exists and is readable
    • Merge user prompts with built-in prompts (user prompts take precedence on conflict)
  2. Prompt Discovery

    • Recursively scan directory for *.prompt.md files
    • Parse front-matter for prompt metadata (name, description, arguments)
    • Validate prompt schema matches MCP prompt specification
  3. Server Startup Integration

    • Parse --prompts-dir in ql-mcp-server.ts
    • Load and register user prompts after built-in prompts
    • Log discovered user prompts at startup

Acceptance Criteria

  • User prompts directory configurable via CLI and env var
  • Conflicts handled with user prompts taking precedence
  • Invalid prompt files logged as warnings (non-fatal)
  • Unit tests for prompt discovery and merging logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions