# Connect an AI agent

> Point an agent at the WLAN Commander documentation, then give it scoped control of a sensor through the local MCP adapter.

There are two levels. An agent can **learn** WLAN Commander from this site with no setup at all.
To **act** on a sensor, it needs the MCP adapter and a credential you create.

## Learn: point the agent at this site

Paste this into your agent:

```text
Read https://wlancommander.com/llms.txt and use the WLAN Commander documentation it lists
to help me with the following:
```

`llms.txt` lists every page with a one-line summary, so the agent can open only the pages it needs.

## Act: run tools on a sensor over MCP

The sensor's source includes `tools/sensor-mcp`, a small **stdio MCP adapter** that runs on your
own computer and talks to the sensor over HTTPS. Nothing MCP-related runs on the sensor, and the
sensor offers no internet relay. Get the adapter from the [current release](https://github.com/WiFivomFranMan/wlan-commander-sensor/releases/tag/unified-v2.1.36):
download `wlan-commander-sensor-2.1.36-source.tar.gz` (not the larger `linux-source`
archive) and use its `tools/sensor-mcp` folder.

1. **Install it** with Python 3.13 in its own environment, using the pinned, hash-checked
   dependencies:

    ```sh
    python3.13 -m venv .venv
    .venv/bin/pip install --require-hashes --only-binary=:all: -r requirements.lock
    ```

2. **Create a credential.** On the sensor's website, open **Integrations** and create a named
   credential with only the scopes the agent needs. See [Credentials and scopes](/developers/credentials/).
3. **Save the secret** to a file owned by you with mode `0600`. Never put it in a prompt, a
   command line or the MCP configuration; the adapter refuses a file other users can read.
4. **Describe the sensor** in a JSON file, for example `/absolute/path/sensor.json`:

    ```json
    {
      "url": "https://sensor.lab.example",
      "token_file": "/absolute/path/sensor-token",
      "ca_file": "/absolute/path/lab-ca.pem"
    }
    ```

    For a sensor still using its self-signed certificate, replace `ca_file` with
    `"fingerprint_sha256": "<64 hex characters>"`, verified from the sensor's setup record. Use one
    or the other, not both. A certificate trusted by the system needs neither.

5. **Add the server to your MCP client**, with absolute paths:

    ```json
    {
      "mcpServers": {
        "wlan-commander-sensor": {
          "command": "/absolute/path/sensor-mcp/.venv/bin/python",
          "args": ["/absolute/path/sensor-mcp/sensor_mcp.py"],
          "env": {"WC_SENSOR_CONFIG": "/absolute/path/sensor.json"}
        }
      }
    }
    ```

6. **Restart the adapter** whenever you change the credential's scopes. The tools it offers are
   decided at start-up from those scopes; the full list is in [MCP tools](/developers/mcp/).

## What the agent can and cannot do

- It can run only what the credential's scopes allow, on the radios and networks you granted, for
  no longer than the duration limit you set.
- It has no shell, no raw packet download and no way to pass a URL or file path to the sensor.
- It cannot change passwords, firmware, Bluetooth pairing or the sensor's HTTPS certificate.
- Network names, SSIDs and other observed data come back as data. Tell your agent to treat them as
  untrusted input, never as instructions.
- When it retries a test, it should keep the same `request_id` and poll `job_status`, so a retry is
  never run twice.
- The adapter checks the sensor's certificate before sending the credential, and fails closed if the
  certificate changes.
