Metadata-Version: 2.3
Name: luxsin-mcp
Version: 0.1.0
Summary: MCP server for Luxsin B9, X8 and X9 devices
Requires-Dist: httpx>=0.27
Requires-Dist: jsonschema>=4.23
Requires-Dist: luxsin-common
Requires-Dist: mcp>=1.26,<2
Requires-Python: >=3.13
Description-Content-Type: text/markdown

# Luxsin MCP Server

**English** · [简体中文](README.zh-CN.md)

Read and control Luxsin B9, X8, and X9 devices through MCP. The server receives MCP calls over stdio and communicates with devices over HTTP. Model definitions and options come from `luxsin-common/static/schemas`.

```text
MCP client <-- stdio --> Luxsin MCP Server <-- HTTP --> Luxsin device
```

Ask your MCP client “What is the current volume in dB?”, “Set the volume to -45.5 dB,” or “List the PEQ presets.”

## Install from GitHub

The browser URL includes `/tree/main/luxsin-mcp`. The uvx configuration below uses the Git repository URL and selects each package with `#subdirectory=`. [MCP server source on GitHub](https://github.com/allen2fuc/luxsin-mcp/tree/main/luxsin-mcp)

Install from the `allen2fuc/luxsin-mcp` GitHub repository. The `--with` argument installs the dependency from the `luxsin-common/` subdirectory, and `--from` installs the MCP server from the `luxsin-mcp/` subdirectory of the same repository.

```json
{
  "mcpServers": {
    "luxsin": {
      "command": "uvx",
      "args": [
        "--python", "3.13",
        "--with", "git+https://github.com/allen2fuc/luxsin-mcp.git#subdirectory=luxsin-common",
        "--from", "git+https://github.com/allen2fuc/luxsin-mcp.git#subdirectory=luxsin-mcp",
        "luxsin-mcp"
      ]
    }
  }
}
```

To pin a release, add the same tag after `.git` in both URLs, for example `.git@v0.1.0#subdirectory=luxsin-mcp`.

To use `"args": ["luxsin-mcp"]` in the client configuration, publish both `luxsin-mcp` and its runtime dependency `luxsin-common` to a Python package index your users can access, such as PyPI. The publisher must control both names. If either package is renamed, update the dependency declaration accordingly.

## Run from local source

From the monorepo, enter the `luxsin-mcp` directory and use Python 3.13 or later.

```sh
uv sync
uv run luxsin-mcp
```

In your MCP client, try “Connect to the Luxsin device at 192.168.9.130.” The client calls `luxsin_api_connect` with `{"ip":"192.168.9.130"}`. HTTP defaults to port 80, which you can override with `port`. Once the connection check succeeds, subsequent calls use that address until you switch devices or restart the MCP process. The optional `LUXSIN_DEVICE_URL` environment variable sets a default device.

Example stdio MCP client configuration follows.

```json
{
  "mcpServers": {
    "luxsin": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/luxsin-mcp", "run", "luxsin-mcp"]
    }
  }
}
```

## Tools

| Tool | Purpose |
| --- | --- |
| `luxsin_api_connect` | Check connectivity via `/msgCount` and switch devices by IP address and optional port |
| `luxsin_api_identity` | Read device identity and MAC address |
| `luxsin_api_schema` | Look up device fields, PEQ schemas, and options by model |
| `luxsin_api_status` | Read device status, including volume in dB |
| `luxsin_api_msg_count` / `luxsin_api_refresh` | Read the message count or send a refresh notification |
| `luxsin_api_set_volume` | Set volume in 0.5 dB increments |
| `luxsin_api_settings` | Update supported settings in one call, such as input, output, or DSP toggles |
| `luxsin_api_peq_list` | Get a PEQ snapshot and all presets, decoding filter lists returned as JSON strings |
| `luxsin_api_peq_select` | Select a preset by zero-based index |
| `luxsin_api_peq_save` / `luxsin_api_peq_remove` | Save, update, or delete presets by name |
