# 2. Functional Requirements (MVP)

The Fabric MCP Server, for its MVP, will provide the following functionalities to an MCP-compatible client:

1. **MCP Standard Compliance & Basic Operation:**
    - The server MUST correctly implement the Model Context Protocol (MCP) for communication with MCP clients.
    - The server MUST allow MCP clients to discover available Fabric-related tools (e.g., via MCP's `list_tools()` mechanism).
    - The server MUST be able to start and listen for connections from MCP clients (e.g., initially via stdio, with options for Streamable HTTP and SSE transports).
    - The server MUST process valid MCP requests and return appropriately structured MCP responses.

2. **Fabric Instance Connectivity & Configuration:**
    - The server MUST connect to a running Fabric instance via its REST API using a configurable base URL (`FABRIC_BASE_URL`).
    - The server MUST support authentication with the Fabric REST API using a configurable API key (`FABRIC_API_KEY`), if provided.
    - The server's logging behavior MUST be configurable via a log level setting (`FABRIC_MCP_LOG_LEVEL`).

3. **Exposing Fabric Pattern Functionality:**
    - **List Patterns:** Users MUST be able to request and receive a list of available Fabric patterns.
    - **Get Pattern Details:** Users MUST be able to request and receive details for a specific Fabric pattern, including its system prompt and metadata, by providing the pattern's name.
    - **Run Pattern:**
        - Users MUST be able to execute a specified Fabric pattern by providing its name.
        - The server MUST allow users to provide optional input text for the pattern.
        - The server MUST allow users to specify optional parameters for pattern execution, such as model name, LLM tuning parameters (`temperature`, `top_p`, `presence_penalty`, `frequency_penalty`), an operational `strategy_name`, `variables` (map[string]string), and `attachments` (list of strings).
        - The server MUST be able to return the output generated by the Fabric pattern to the user.
        - The server MUST support streaming the pattern's output to the MCP client if requested by the client (via `stream=true` parameter) and supported by the Fabric API (which uses SSE).

4. **Exposing Fabric Model & Strategy Information:**
    - **List Models:** Users MUST be able to request and receive a list of configured Fabric models, potentially organized by vendor.
    - **List Strategies:** Users MUST be able to request and receive a list of available Fabric strategies, including their name, description, and prompt.

5. **Exposing Fabric Configuration:**
    - **Get Configuration:** Users MUST be able to request and receive the current Fabric operational configuration settings. The server MUST redact sensitive values (like API keys) before relaying this information.
