---
title: "Connecting Claude and LM Studio to MCP | DreamFactory Docs"
source: "https://docs.dreamfactory.com/AI/mcp-client-setup"
canonical_url: "https://docs.dreamfactory.com/AI/mcp-client-setup"
converted_at: "2026-12-05T02:45:24.369Z"
format: "markdown"
converted_by: "html-to-md-ai"
---
This page connects AI clients to a DreamFactory MCP endpoint (`https://<host>/mcp/<service-name>`). It covers four clients:

- [Claude Desktop with a local config file](#claude-desktop-local-config), which works when DreamFactory is on a private network

- [Claude Code](#claude-code)

- [claude.ai and Claude Desktop Connectors](#claudeai-and-claude-desktop-connectors), which need DreamFactory to be reachable from the internet

- [LM Studio](#lm-studio), which runs the model on your own machine

To create the MCP service first, see [Creating an MCP Server Service](/AI/mcp-service-creation). To install and run the MCP daemon, see [Deploying the MCP Server](/AI/mcp-server-deployment).

## Pick the right client setup[​](#pick-the-right-client-setup)

What matters most is **which machine opens the connection to DreamFactory**.

Client setupWho connects to DreamFactoryMust DreamFactory be reachable from the internet?Claude planclaude.ai or Claude Desktop **Settings → Connectors**Anthropic's cloud**Yes**, from [Anthropic's IP ranges](https://docs.claude.com/en/api/ip-addresses)Pro, Max, Team, or EnterpriseClaude Desktop **local config file** (`claude_desktop_config.json`)Your computerNo. Your computer only needs to reach DreamFactoryAny plan, including Free**Claude Code**Your computerNoPro, Max, Team, Enterprise, or an API key**LM Studio**Your computerNoNone. The model runs locally

If DreamFactory runs in a DMZ, behind a firewall, or on an internal hostname, a Connector added in Settings cannot reach it, because the requests come from Anthropic's servers rather than from your computer. Use the local config file, Claude Code, or LM Studio instead.

Where your data goesWith every Claude setup, including the local ones, tool results become part of the conversation and are sent to Anthropic for the model to process. The local setups only change who opens the connection to DreamFactory. **LM Studio is the only option on this page where data never leaves your machine.** In every case, scope what the AI can see with the API key's role and the service's [Exposed Services](/AI/mcp-exposed-services).

## Before you start: API key authentication[​](#before-you-start-api-key-authentication)

The local setups below authenticate with a DreamFactory API key instead of OAuth. That removes the browser login and redirect steps, which cause most local-client failures. It needs **DreamFactory 7.7.1 or later**. To check your version, run `composer show dreamfactory/df-mcp-server | grep versions` on the DreamFactory host: 1.4.0 or later means 7.7.1+.

1. **Create a role** that can read only what the AI should see (**Roles** tab). Grant it access to the database or file services the AI will use. If the MCP service has **Require Role Access** turned on (the default for services created on 7.7.1+), also grant the role access to the MCP service itself.

2. **Create an app** (**Apps** tab), set its default role to that role, and make sure it is **active**. Copy its **API Key**.

3. **Turn on API key auth** for the MCP service: **AI** tab → **MCP** → your service → **Advanced Options** → **Allow API Key Authentication**, then save. While you are there, make sure **Exposed Services** lists the databases and file services the AI should use. An empty list means no data tools.

4. **Test from the machine that will run the client.** This one command confirms the URL, the network path, and the key before you touch any client:

```
curl -i -X POST https://df.example.com/mcp/<service-name> \  -H "Content-Type: application/json" \  -H "Accept: application/json, text/event-stream" \  -H "X-DreamFactory-API-Key: YOUR_APP_API_KEY" \  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'
```

You want a `200` status and a JSON body whose `serverInfo` names your service, for example `"DreamFactory MCP (<service-name>)"`. On 7.7.1+ the daemon is stateless by default, so the response may have no `MCP-Session-Id` header. That is expected. For any other result, find it in [Reading the curl result](#reading-the-curl-result) before going further.

URL rulesUse `https://<host>/mcp/<service-name>` exactly: the scheme clients actually reach (usually `https`), **no trailing slash**, and not `/api/v2/...`. A redirect (from `http` to `https`, or to add or remove a slash) turns the client's `POST` into a `GET`, which DreamFactory answers with `405`.

Keep the key out of shared files and screenshots. Anyone with it can open MCP sessions with the app's role. See [API Key Authentication for MCP](/AI/mcp-api-key-auth) for how to rotate or revoke it.

### Reading the curl result[​](#reading-the-curl-result)

Match the status line and the `message` in the JSON body:

What `curl` showsWhat it meansFix`200` and `"serverInfo":{"name":"DreamFactory MCP (<service-name>)"...}`Everything works: URL, network, key, and roleIf a client still fails, its config differs from the `curl` command. Compare the URL character by character, and check that the key is in `headers` (LM Studio) or `--header` (bridge, Claude Code)`401` and `Unauthorized: API key required (X-DreamFactory-API-Key header)`The request reached the service but carried no keyCheck the header name is exactly `X-DreamFactory-API-Key` and that the key isn't empty`401` and `Unauthorized: Invalid API key`The key doesn't match any appCopy the key again from **Apps**. A regenerated key replaces the old one. Also check the app is **active** and has a **role**`401` and `Unauthorized: Bearer token required`Either **Allow API Key Authentication** is off for this service, or no MCP service has that nameTurn the switch on and save. Then check the service name against `mcp_endpoint` on the service's **API Docs** tab`403` and `"code":-32003` / `Forbidden: role #N has no access to MCP service '<service-name>'`**Require Role Access** is on and the key's role has no grant on the MCP serviceGrant the role access to the MCP service (**Roles** → **Access**, or the MCP service page), or turn the switch off`400` and `No session token (JWT) or API Key detected in request`The URL points at the REST API (`/api/v2/...`)Use `https://<host>/mcp/<service-name>``405` and `Method Not Allowed: server-initiated SSE stream is not offered (POST only)`DreamFactory received a `GET`, not a `POST`Make sure the command has `-X POST` and the `-d` body. In a client, a redirect can turn the `POST` into a `GET`. See the next row`301`, `302`, `307`, or `308` with a `location:` headerSomething in front of DreamFactory redirects the URL, usually `http`→`https`Use the URL from the `location:` header exactly`503`The MCP daemon is not runningSee [Deploying the MCP Server](/AI/mcp-server-deployment#verifying-the-install)`504` and `MCP daemon did not respond`The daemon is running but too slow to answerSee [Deploying the MCP Server](/AI/mcp-server-deployment#troubleshooting)`curl: (6) Could not resolve host`This machine can't resolve DreamFactory's hostnameFix DNS, or test with the hostname or IP address that this machine uses to reach DreamFactory`curl: (7) Failed to connect` or `curl: (28) ... timed out`The network path is blockedCheck the firewall, VPN, and DMZ rules between this machine and DreamFactory`curl: (60) SSL certificate problem`DreamFactory's certificate comes from a CA this machine doesn't trust, usually an internal CARetry with `--cacert /path/to/internal-ca.pem`. For the bridge, set `NODE_EXTRA_CA_CERTS`. For LM Studio and Claude Code, trust the CA in the operating system

If your result isn't in this table, send the complete `curl` output to DreamFactory support. Replace the API key with `<key>` first.

## Claude Desktop (local config)[​](#claude-desktop-local-config)

Claude Desktop can start local MCP servers from a config file. DreamFactory's endpoint is remote, so a small local bridge, [`mcp-remote`](https://www.npmjs.com/package/mcp-remote), runs on your computer and forwards Claude's requests to DreamFactory with the API key attached. DreamFactory only ever sees connections from your computer.

**Requirements:** Claude Desktop (any plan), and Node.js 20 or later on the same computer (`node -v` to check).

1. Open the config file. In Claude Desktop go to **Settings → Developer** and click **Edit Config**. That opens or creates the file:

OSPathmacOS`~/Library/Application Support/Claude/claude_desktop_config.json`Windows`%APPDATA%\Claude\claude_desktop_config.json`Linux`~/.config/Claude/claude_desktop_config.json`

2. Add DreamFactory under `mcpServers`. If the file already has other keys, keep them and add only the `dreamfactory` entry:

```
{  "mcpServers": {    "dreamfactory": {      "command": "npx",      "args": [        "-y",        "mcp-remote",        "https://df.example.com/mcp/<service-name>",        "--transport",        "http-only",        "--header",        "X-DreamFactory-API-Key:${DF_API_KEY}"      ],      "env": {        "DF_API_KEY": "YOUR_APP_API_KEY"      }    }  }}
```

- Write the header as `Name:${VAR}` with **no space after the colon**. Some clients split arguments on spaces, and the variable keeps the key itself out of the argument list.

- `--transport http-only` stops the bridge from falling back to the legacy SSE transport, so a failure shows the real error instead of a misleading `405`.

- If DreamFactory uses a certificate from an internal CA, add `"NODE_EXTRA_CA_CERTS": "/path/to/internal-ca.pem"` to `env`.

3. **Quit Claude Desktop completely** and reopen it. Closing the window is not enough, because the app keeps running in the background. On macOS, quit from the menu bar. On Windows and Linux, quit from the tray icon or with **File → Quit**.

4. Open **Settings → Developer**. `dreamfactory` should show as running. In a chat, open the tools menu (the slider icon under the message box) to see the DreamFactory tools, then ask something like "List the tables in my database".

If the server shows as failed, check the logs: `~/Library/Logs/Claude/mcp-server-dreamfactory.log` on macOS, `%APPDATA%\Claude\logs\` on Windows, or `~/.config/Claude/logs/` on Linux.

## Claude Code[​](#claude-code)

Claude Code connects to remote MCP servers directly from your computer, so no bridge is needed:

```
claude mcp add --transport http dreamfactory https://df.example.com/mcp/<service-name> \  --header "X-DreamFactory-API-Key: YOUR_APP_API_KEY"
```

- By default the server is added for the current project only. Add `--scope user` to make it available in every project.

- Run `claude mcp list` to check the connection, or `/mcp` inside a session to see its status and tools.

- `--scope project` writes the server to a `.mcp.json` file that is meant to be committed. Don't use it with a key pasted inline. If you need a shared config, use `"X-DreamFactory-API-Key": "${DF_API_KEY}"` in `.mcp.json` and have each user set `DF_API_KEY` in their own environment.

To use OAuth instead (when the instance does not have API key auth turned on), leave out `--header`. Then run `/mcp` in a session and choose **Authenticate** to open the DreamFactory login in your browser.

## claude.ai and Claude Desktop Connectors[​](#claudeai-and-claude-desktop-connectors)

A Connector added in **Settings → Connectors** (on claude.ai or in Claude Desktop) is run by Anthropic's cloud, not your computer. The setup steps are in [Creating an MCP Server Service](/AI/mcp-service-creation#claude-desktop). This setup needs:

- A paid Claude plan (Pro, Max, Team, or Enterprise).

- DreamFactory's MCP endpoint and OAuth endpoints reachable over HTTPS from the public internet. If you restrict inbound traffic, allowlist [Anthropic's published IP ranges](https://docs.claude.com/en/api/ip-addresses).

- OAuth. Connectors sign in through DreamFactory's login page. Claude's OAuth callback is `https://claude.ai/api/mcp/auth_callback`. DreamFactory registers it automatically through Dynamic Client Registration.

- `APP_URL` set to the public HTTPS URL. See [Deploying the MCP Server](/AI/mcp-server-deployment#configuration).

If DreamFactory must stay on a private network, use a local setup above. Organizations on Claude Enterprise can also ask Anthropic about [MCP tunnels](https://claude.com/docs/connectors/mcp-tunnels/oauth), which connect Claude's cloud to a private server through an outbound-only tunnel.

## LM Studio[​](#lm-studio)

[LM Studio](https://lmstudio.ai) runs open-weight models on your own hardware and supports MCP from version **0.3.17**. With LM Studio, both the model and the DreamFactory connection stay on your network.

1. **Load a model that supports tool calling.** In the model list, look for the tool-use (hammer) badge. Small models often call tools badly. Use the largest tool-capable model your hardware runs comfortably, and give it a context length of at least 16k tokens, because DreamFactory's tool list and schemas take up a lot of context.

2. **Open `mcp.json`.** In the right sidebar, open the **Program** tab and click **Install → Edit mcp.json**. The file is at `~/.lmstudio/mcp.json` on macOS and Linux, or `%USERPROFILE%\.lmstudio\mcp.json` on Windows.

3. **Add DreamFactory with the API key header:**

```
{  "mcpServers": {    "dreamfactory": {      "url": "https://df.example.com/mcp/<service-name>",      "headers": {        "X-DreamFactory-API-Key": "YOUR_APP_API_KEY"      }    }  }}
```

4. **Save.** LM Studio loads the server, and `mcp/dreamfactory` appears in the **Program** tab. Switch it on for the chat.

5. Ask "List the tables in my database". LM Studio asks for confirmation before each tool call. Approve it, or allow that tool for the rest of the session.

Use the API key, not the OAuth login, in LM StudioIf you leave out `headers`, LM Studio attempts the OAuth login. DreamFactory completes its side: the client registers and the browser shows DreamFactory's "you are authenticated" page. But in our testing (LM Studio 0.4.29), LM Studio's own callback handler fails before it exchanges the code for a token. LM Studio then keeps showing **Complete sign-in**, or on some versions fails with **Authentication failed: SSE error: Non-200 status code (405)**, because its token-less request is rejected and the SSE fallback gets a `405`. Using the API key header avoids that flow entirely. If you need per-user OAuth with a local model, connect through the [`mcp-remote` bridge](#claude-desktop-local-config) instead, using `command`/`args` in LM Studio's `mcp.json` exactly as shown for Claude Desktop.

## Troubleshooting[​](#troubleshooting)

### `SSE error: Non-200 status code (405)`[​](#sse-error-non-200-status-code-405)

This error hides the real problem. MCP clients first send a `POST` to the endpoint (Streamable HTTP). If that `POST` fails for any reason, they retry with the legacy SSE transport, which sends a `GET`. DreamFactory's MCP endpoint does not accept `GET`, so it answers `405`, and that is the only error the client shows.

To find out why the `POST` failed, run the [`curl` test](#before-you-start-api-key-authentication) from the same machine, then look up the result in [Reading the curl result](#reading-the-curl-result).

If you are using OAuth rather than an API key and `curl` with the key works, the OAuth token is being rejected. The usual causes are an `APP_URL` that doesn't match the URL the client uses (including `http` vs `https`) and a non-admin user whose role has no access to the MCP service. Run the [health endpoint](/AI/mcp-server-deployment#verifying-the-install) to check `APP_URL`.

### Other problems[​](#other-problems)

SymptomFixConnected, but only `list_apis` and similar tools appear, with no database toolsThe service has no [Exposed Services](/AI/mcp-exposed-services) selected, or the role can't reach them. Fix it, then reconnect the client, because the tool list is fixed for the life of a sessionTools are listed, but every tool call failsThe daemon cannot call DreamFactory back. Set [`MCP_INTERNAL_BASE_URL`](/AI/mcp-server-deployment#daemon-callback-url-mcp_internal_base_url)Claude Desktop shows the server as failed right awayNode.js is missing or older than 20, or the JSON is invalid. Check the log file listed in [Claude Desktop](#claude-desktop-local-config)`self-signed certificate` / `unable to verify the first certificate`Set `NODE_EXTRA_CA_CERTS` to your internal CA bundle (bridge), or trust the CA in the OS (LM Studio, Claude Code)The LM Studio model answers without calling tools, or calls them with bad argumentsUse a larger tool-capable model and a longer context length. Ask explicitly, for example "Use the DreamFactory tools to…"

## See also[​](#see-also)

- [API Key Authentication for MCP](/AI/mcp-api-key-auth)

- [Scoping Tools with Exposed Services](/AI/mcp-exposed-services)

- [Creating an MCP Server Service](/AI/mcp-service-creation)

- [Deploying the MCP Server](/AI/mcp-server-deployment)