API Reference / agent / mcp /

server.py

MCP (Model Context Protocol) server for TuiML.

Exposes workflow and discovery tools that give LLMs access to all TuiML components (algorithms, preprocessors, datasets, features). New algorithms added to the component registry are automatically discoverable via tuiml_list / tuiml_describe and usable via tuiml_train / tuiml_benchmark.

Run the server (installed with pip install tuiml):

bash
tuiml-mcp

Or run it as a Python module:

bash
python -m tuiml.agent.mcp.server

Server options:

bash
tuiml-mcp --help   # Show help
tuiml-mcp --info   # Show server info

Configure in Claude Desktop (claude_desktop_config.json):

json
{
    "mcpServers": {
        "tuiml": {
            "command": "tuiml-mcp"
        }
    }
}

Functions

Func

create_server

Line 282
create_server() -> 'Server'

Create and configure the TuiML MCP server.

Only workflow and discovery tools are exposed as MCP tools (30 total). The internal registry still tracks all 200+ components so that tuiml_list, tuiml_describe, and tuiml_train can dynamically access any algorithm - including new ones added later.

Returns

Server
Configured MCP server exposing TuiML workflow tools, with every handler registered on the constructor as the 2.x SDK expects.

Raises

ImportError
If the 2.x mcp package is not installed.
Func

run_server

Line 660
run_server()

Run the MCP server using stdio transport.

Returns

None
Blocks until the client disconnects; exits the process if the mcp package is not installed.
Func

main

Line 709
main()

Main entry point for the MCP server (the tuiml-mcp command).

Handles the --info and --help flags, otherwise runs the stdio server.

Returns

None
Func

get_server_info

Line 763
get_server_info() -> Dict[str, Any]

Get information about the MCP server.

Returns

dict
Server metadata with keys "name", "version", "description", "mcp_available", and "tools" (a dict with "exposed_tools", "discoverable_components", and "components_by_category" counts).