Skip to main content
Glama
classix

classix-mcp-proxy

Official
by classix
README.md
# classix-mcp-proxy

This nodejs server accepts incoming websocket connections and creates unique POST API endpoints for each one of them.


## Build

Requires: Node 20 or newer

    npm ci
    npm run build


## Local testing

### 1. Start MCP proxy

    npm start -- --custom-id=true

And let the process run

### 2. Launch classix
To make classix connect to the local MCP proxy, launch it as follows:

    SET CX_MCP_PROXY_ENDPOINT=ws://localhost:8080/classix/local
    cxas <bindir/dlloption>

and login

### 3. Prepare test script
Run `npm install` in the `test/call-mcp` directory.

### 4. Test MCP requests
Now you can simply drop the JSON files for the corresponding MCP calls from the `test` directory onto the `call-mcp.bat` file to execute the tool call against the local classix instance and see its response.


## Command line options
The following command line options can be passed to the mcp proxy:

| Parameter                  |                                                                          |
|----------------------------|--------------------------------------------------------------------------|
| `port <port number>`       | The port to listen for classix and mcp connections                       |
| `host <host name>`         | Just for debug output at the moment                                      |
| `trust-proxy <true/false>` | Set to `true` to use ip from x-forwarded-for header (default = false)    |
| `klio-url <url>`           | Overwrite the default KLIO url prefix - this is being sent to classix and returned by `OpenMcpConnection` |
| `custom-id <true/false>`   | set to `true` to allow classix to choose the endpoint id by connecting to /classix/<id>.The MCP endpoint will then be /mcp/<id>. This disables the automatic generation of unique ids for identifying the classix instance. This results in potentially guessable endpoint ids, but may be useful when stable endpoints are needed (eg. vscode mcp servers) (default = false) |

## Environment variables
The following environment are supported by the mcp proxy:\
*command line options take precedence over environment variables*

| Name          |  Description                          |
|---------------|---------------------------------------|
| `KLIO_URL`    | overwrite the default KLIO url prefix |
| `HOST`        | set the host via environment variable |
| `POST`        | set the port via environment variable |
| `TRUST_PROXY` | set to 'true' to enable               |
| `CUSTOM_ID`   | set to 'true'  to enable              |