.. _ai_assistants:
Use the tools from an AI assistant
==================================
An assistant that speaks the `Model Context Protocol `_ (MCP)
can design an experiment, write its run sheet and analyze its results by calling this package. The
assistant holds the conversation; the package does every computation, so each number in the answer
can be reproduced. This matters most for the design itself: a language model asked to write out a
fractional factorial often returns one of a lower resolution than it claims, and with the tools it
has no need to write one.
The assistant gets more than 60 tools from one registry (:doc:`/api/tooling`): designs and their
analysis, multivariate models, control charts, robust statistics and the simulators. A tool takes
its data in the call and returns its result in the answer. No tool takes a file path or an address,
so the assistant cannot ask the server to read or to fetch anything the caller did not send.
.. code-block:: bash
pip install 'process-improve[mcp]'
Two ways to run the server
--------------------------
.. list-table::
:header-rows: 1
:widths: 22 39 39
* - Transport
- When
- Command
* - stdio
- The assistant runs on your machine and starts the server itself: Claude Desktop, Claude
Code, GitHub Copilot in VS Code, Cursor.
- ``process-improve-mcp``
* - Streamable HTTP
- The assistant runs somewhere else and reaches the server at an address: Microsoft Copilot
Studio, Microsoft 365 Copilot, a company's own agent.
- ``process-improve-mcp --transport streamable-http``
An assistant on your machine
----------------------------
**GitHub Copilot in VS Code.** Put this in ``.mcp.json`` at the root of the workspace, or run
**MCP: Add Server** from the Command Palette:
.. code-block:: json
{
"mcpServers": {
"process-improve": {
"type": "stdio",
"command": "process-improve-mcp",
"tools": ["*"]
}
}
}
**Claude Desktop.** Add the server to ``claude_desktop_config.json``:
.. code-block:: json
{
"mcpServers": {
"process-improve": {"command": "process-improve-mcp"}
}
}
**Claude Code.**
.. code-block:: bash
claude mcp add process-improve -- process-improve-mcp
For Claude, the ``doe-designer`` skill in the repository's ``skills/`` folder adds the method on top
of the tools: which design to reach for, and what to do with the answer.
An assistant somewhere else
---------------------------
.. code-block:: bash
export PROCESS_IMPROVE_MCP_API_KEY="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
process-improve-mcp --transport streamable-http --host 0.0.0.0 --port 8000
The tools are then at ``http://:8000/mcp``. Each request stands alone and is answered in one
JSON body, so the server can run as several copies behind a load balancer.
What this transport turns on:
- **Safe mode.** Every call is validated against the tool's input model, then run in a process of
its own with a time limit (10 s unless set otherwise) and a memory limit (1024 MB). The limits are
settings of :mod:`process_improve.config`.
- **A key.** On any address but ``127.0.0.1``, a caller sends the key in an ``X-API-Key`` header, or
as ``Authorization: Bearer ``, and is answered ``401`` without it. The server does not start
on such an address without ``PROCESS_IMPROVE_MCP_API_KEY``.
What it leaves to what stands in front of it:
- **TLS.** The server speaks plain HTTP. Put it behind the HTTPS endpoint of your container
platform or gateway.
- **Who the caller is.** One key is one identity. A gateway gives each user their own, and limits
how often each may call.
Microsoft Copilot Studio
~~~~~~~~~~~~~~~~~~~~~~~~
Copilot Studio reaches the server from Microsoft's cloud, so the server needs an address that
cloud can reach, over HTTPS. Then, in the agent:
1. Turn on generative orchestration: Copilot Studio requires it for MCP.
2. Open **Tools**, select **Add a tool**, then **New tool**, then **Model Context Protocol**.
3. Give the **Server name**, the **Server description** and the **Server URL** (the address that
ends in ``/mcp``).
4. For the authentication choose **API key**, of type **Header**, and name the header
``X-API-Key``.
5. Select **Create**, then **Create a new connection** and give the key, then **Add to agent**.
These steps follow `Microsoft's documentation
`_ as it
read on 30 November 2026. They were not run against a Copilot Studio tenant when this page was
written.
Known limits there, from `Microsoft's troubleshooting page
`_:
- A tool whose input uses a reference type is left out. That is the five tools of the multivariate
workbench: ``mva_open``, ``mva_fit``, ``mva_explain``, ``mva_predict`` and ``mva_script``. The
tools for experiments are not among them.
- An input that offers a fixed set of choices is shown to the agent as free text. The library still
refuses a value outside the set, and says which values it takes.
- A company's data policy for Power Platform connectors applies to an MCP server too.
Any other client
~~~~~~~~~~~~~~~~
Give the client the address and the header. For Claude Code:
.. code-block:: bash
claude mcp add --transport http process-improve https:///mcp --header "X-API-Key: "
On your own machine, ``process-improve-mcp --transport streamable-http`` with no ``--host`` serves
``http://127.0.0.1:8000/mcp`` to that machine alone, and asks for no key.