Skip to main content
Glama
developersorli

mcp-file-system-lmstudio

README.md
# mcp-file-system-lmstudio

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that exposes a local [LM Studio](https://lmstudio.ai) model as tools. It talks to LM Studio's OpenAI-compatible API, so any model loaded in LM Studio can be queried from an MCP client.

## Features

- **`lmstudio_chat`** — send a prompt (or full multi-turn message history) to the local model and get its response back
- **`lmstudio_list_models`** — list all models currently available on the LM Studio server
- No API keys required — everything runs locally against your own LM Studio instance

## Requirements

- Node.js >= 18 (uses built-in `fetch`)
- A running [LM Studio](https://lmstudio.ai) server with at least one model loaded

Start the LM Studio server from its UI (Developer tab → Start Server). By default it listens on `http://localhost:1234`.

## Installation

```bash
git clone https://github.com/developersorli/mcp-file-system-lmstudio.git
cd mcp-file-system-lmstudio
npm install
```

## Configuration

The server reads two optional environment variables:

| Variable            | Default                     | Description                                                        |
| ------------------- | --------------------------- | ------------------------------------------------------------------ |
| `LMSTUDIO_BASE_URL` | `http://localhost:1234/v1`  | Base URL of the LM Studio OpenAI-compatible API                    |
| `LMSTUDIO_MODEL`    | *(auto)*                    | Default model id. If unset, the first available model is used      |

## MCP client configuration

Example for Cline / Claude Desktop style clients:

```json
{
  "mcpServers": {
    "mcp-file-system-lmstudio": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-file-system-lmstudio/index.mjs"],
      "env": {
        "LMSTUDIO_BASE_URL": "http://localhost:1234/v1",
        "LMSTUDIO_MODEL": "my-model-id"
      }
    }
  }
}
```

## Tools

### `lmstudio_chat`

| Parameter     | Type   | Required | Description                                                        |
| ------------- | ------ | -------- | ------------------------------------------------------------------ |
| `prompt`      | string | yes      | The user message / prompt to send                                  |
| `system`      | string | no       | Optional system instruction prepended as a system message          |
| `model`       | string | no       | Model id to use (overrides the default)                            |
| `temperature` | number | no       | Sampling temperature 0–2 (default 0.7)                             |
| `max_tokens`  | number | no       | Maximum tokens to generate                                         |
| `messages`    | array  | no       | Full conversation history; takes precedence over `prompt`/`system` |

### `lmstudio_list_models`

No parameters. Returns the ids of all models available on the LM Studio server.

## License

MIT — see [LICENSE](./LICENSE).