// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page creator-how-to-mcp-server.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-build
    \ingroup creator-how-to-debug
    \ingroup creator-how-to-run

    \title Using the MCP server

    \QC supports the model context protocol (MCP) to let AI assistants control it
    for debugging, building, and managing projects.

    To use an MCP client, install one and activate the \QC MCP server extension
    to start the MCP server.

    \section1 View MCP server status

    \QC starts the MCP server when you activate the \QC MCP server extension. The
    server runs at \c 127.0.0.1 and accepts connections on port \c 8249. You can
    choose a different IP address and port via the Settings.

    To view the MCP server status, go to \uicontrol Settings >
    \uicontrol {AI} > \uicontrol {MCP Server}.

    \image {qtcreator-mcp-server-status.webp} {MCP Server Settings page}

    If the server does not start, see whether \uicontrol {General Messages} shows
    a warning about the port being in use.

    Make sure that no other process is bound to the port. For example, on Linux,
    enter \c {lsof -i :8249} in \uicontrol Terminal or try a different port.

    \section1 Set up a simple MCP client

    You can use any MCP client that support MCP Protocol Version 2025-11-18.
    This section describes how to use \c https://github.com/modelcontextprotocol/inspector
    to install a simple MCP client and how to configure it.

    To install and configure a simple MCP client:

    \list 1
        \li Go to \uicontrol Terminal, and enter:
            \badcode
            npx @modelcontextprotocol/inspector
            \endcode
        \li Open the URL indicated in the terminal output
        \li Change the settings to:
            \li Transport Type: Streamable HTTP
            \li URL: \c http://127.0.0.1:8249
            \li Connection Type: Via Proxy
        \li Click \uicontrol Connect
    \endlist

    \sa {Activate extensions}
*/
