Skip to content

Add LM Studio ↔ SD WebUI MCP integration and dev server configs#1

Open
Definitionist wants to merge 1 commit into
masterfrom
copilot/vscode-mn30bjro-a101
Open

Add LM Studio ↔ SD WebUI MCP integration and dev server configs#1
Definitionist wants to merge 1 commit into
masterfrom
copilot/vscode-mn30bjro-a101

Conversation

@Definitionist

Copy link
Copy Markdown
Owner

Summary

  • webui-api.bat — new launcher wrapper for SD WebUI that passes --api --listen flags, enabling LM Studio's sd-webui MCP server to connect at http://127.0.0.1:7860
  • .lmstudio/mcp.json — updated SD_OUTPUT_DIR from Downloads to SD's own outputs/txt2img-images/ folder so generated images land in the right place
  • .claude/launch.json — dev server registry for all local projects; corrected SD entry from wrong python webui.py entrypoint to cmd /c webui-api.bat

Test plan

  • Run webui-api.bat — confirm SD WebUI starts and API is accessible at http://127.0.0.1:7860/docs
  • In LM Studio, trigger the sd-webui MCP tool (e.g. txt2img) — confirm image generates and saves to outputs/txt2img-images/
  • Verify launch.json entries match actual project start commands

🤖 Generated with Claude Code

- webui-api.bat: wrapper that starts SD WebUI with --api --listen (required for LM Studio MCP sd-webui server to connect to http://127.0.0.1:7860)
- .lmstudio/mcp.json: updated SD_OUTPUT_DIR to SD's own outputs/txt2img-images folder
- .claude/launch.json: dev server registry for all local projects (SD, Flask, FastAPI, Vite apps); corrected SD entry to use webui-api.bat instead of wrong python webui.py entrypoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 30, 2026 18:01

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces configuration files for project launching and Model Context Protocol (MCP) servers, as well as a batch script to enable the Stable Diffusion WebUI API. Feedback highlights a typo in a project name and points out that hardcoded absolute user paths in the JSON configurations hinder portability, suggesting the use of environment variables instead.

Comment on lines +5 to +6
"name": "PeojectWebsite (Vite/React)",
"cwd": "C:/Users/Shadow/PeojectWebsite",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There appears to be a typo in PeojectWebsite. Assuming it should be ProjectWebsite.

Additionally, the cwd path is hardcoded to a specific user's directory (C:/Users/Shadow/...). This makes the configuration not portable for other developers. This issue is present for all configurations in this file. It's highly recommended to use environment variables. For example, in VS Code's launch.json, you can use ${env:USERPROFILE} which typically resolves to C:\Users\<username> on Windows.

Suggested change
"name": "PeojectWebsite (Vite/React)",
"cwd": "C:/Users/Shadow/PeojectWebsite",
"name": "ProjectWebsite (Vite/React)",
"cwd": "${env:USERPROFILE}/ProjectWebsite",

Comment on lines +2 to +54
"mcpServers": {
"sd-webui": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sd-webui\\server.js"
],
"env": {
"SD_WEBUI_URL": "http://127.0.0.1:7860",
"SD_OUTPUT_DIR": "C:\\Users\\Shadow\\stable-diffusion-webui-master\\outputs\\txt2img-images"
}
},
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow",
"C:\\Users\\Shadow\\Downloads",
"C:\\Users\\Shadow\\Documents",
"C:\\Users\\Shadow\\Desktop",
"C:\\Users\\Shadow\\stable-diffusion-webui-master"
]
},
"memory": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\memory\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
]
},
"playwright": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\playwright\\node_modules\\@playwright\\mcp\\cli.js"
]
},
"fetch": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\fetch\\node_modules\\mcp-fetch-server\\dist\\index.js"
]
},
"github": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\github\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
]
},
"sequential-thinking": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sequential-thinking\\node_modules\\@modelcontextprotocol\\server-sequential-thinking\\dist\\index.js"
]
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This configuration file contains multiple hardcoded absolute paths that include a specific username (C:\\Users\\Shadow\\...). This makes the configuration not portable for other developers. It's highly recommended to avoid user-specific absolute paths in version-controlled files. Consider using paths relative to a known location, or a mechanism that allows user-specific overrides (e.g., via environment variables). For example, the application consuming this file could be made to expand an environment variable like %USERPROFILE% on Windows.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds local integration scaffolding to run Stable Diffusion WebUI with its API enabled and wire it up to LM Studio’s sd-webui MCP server, plus a .claude dev-server launcher registry for common local projects.

Changes:

  • Added a webui-api.bat wrapper to launch SD WebUI with --api (and --listen) for MCP connectivity.
  • Added LM Studio MCP server configuration (.lmstudio/mcp.json), including SD_WEBUI_URL and SD_OUTPUT_DIR.
  • Added a Claude dev server registry (.claude/launch.json) with a corrected SD WebUI launch command.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
Users/Shadow/stable-diffusion-webui-master/webui-api.bat Wrapper script to start SD WebUI with API flags for LM Studio MCP usage.
Users/Shadow/.lmstudio/mcp.json LM Studio MCP server definitions, including SD WebUI env wiring and filesystem roots.
Users/Shadow/.claude/launch.json Local dev server launch entries, including SD WebUI via the new wrapper script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +6

call webui.bat --api --listen

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--listen typically binds the WebUI to all interfaces (0.0.0.0), which can unintentionally expose the SD WebUI + API to your LAN. If LM Studio connects via 127.0.0.1, consider removing --listen by default, or add a clearly documented opt-in / host-binding option to keep the API local-only.

Suggested change
call webui.bat --api --listen
rem Note: `--listen` is omitted to keep the WebUI/API bound to localhost only.
rem If you intentionally want LAN access, add `--listen` to the command below.
call webui.bat --api

Copilot uses AI. Check for mistakes.
rem Access WebUI at http://127.0.0.1:7860
rem API docs at http://127.0.0.1:7860/docs

call webui.bat --api --listen

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call webui.bat ... depends on the current working directory. To make this wrapper resilient when launched from elsewhere (double-clicked, scheduled task, etc.), call webui.bat via %~dp0 (the script directory) and quote the path.

Suggested change
call webui.bat --api --listen
call "%~dp0webui.bat" --api --listen

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +51
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sd-webui\\server.js"
],
"env": {
"SD_WEBUI_URL": "http://127.0.0.1:7860",
"SD_OUTPUT_DIR": "C:\\Users\\Shadow\\stable-diffusion-webui-master\\outputs\\txt2img-images"
}
},
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow",
"C:\\Users\\Shadow\\Downloads",
"C:\\Users\\Shadow\\Documents",
"C:\\Users\\Shadow\\Desktop",
"C:\\Users\\Shadow\\stable-diffusion-webui-master"
]
},
"memory": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\memory\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
]
},
"playwright": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\playwright\\node_modules\\@playwright\\mcp\\cli.js"
]
},
"fetch": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\fetch\\node_modules\\mcp-fetch-server\\dist\\index.js"
]
},
"github": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\github\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
]
},
"sequential-thinking": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sequential-thinking\\node_modules\\@modelcontextprotocol\\server-sequential-thinking\\dist\\index.js"

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config hard-codes machine-specific absolute paths (including a specific Windows username) for both the MCP server entrypoint and SD_OUTPUT_DIR. If this repo is intended to be used on other machines, consider parameterizing these via environment variables (e.g., %USERPROFILE%) or checking in a template file and keeping the real mcp.json untracked.

Suggested change
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sd-webui\\server.js"
],
"env": {
"SD_WEBUI_URL": "http://127.0.0.1:7860",
"SD_OUTPUT_DIR": "C:\\Users\\Shadow\\stable-diffusion-webui-master\\outputs\\txt2img-images"
}
},
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow",
"C:\\Users\\Shadow\\Downloads",
"C:\\Users\\Shadow\\Documents",
"C:\\Users\\Shadow\\Desktop",
"C:\\Users\\Shadow\\stable-diffusion-webui-master"
]
},
"memory": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\memory\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
]
},
"playwright": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\playwright\\node_modules\\@playwright\\mcp\\cli.js"
]
},
"fetch": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\fetch\\node_modules\\mcp-fetch-server\\dist\\index.js"
]
},
"github": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\github\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
]
},
"sequential-thinking": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\sequential-thinking\\node_modules\\@modelcontextprotocol\\server-sequential-thinking\\dist\\index.js"
"%USERPROFILE%\\.lmstudio\\mcp-servers\\sd-webui\\server.js"
],
"env": {
"SD_WEBUI_URL": "http://127.0.0.1:7860",
"SD_OUTPUT_DIR": "%USERPROFILE%\\stable-diffusion-webui-master\\outputs\\txt2img-images"
}
},
"filesystem": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"%USERPROFILE%",
"%USERPROFILE%\\Downloads",
"%USERPROFILE%\\Documents",
"%USERPROFILE%\\Desktop",
"%USERPROFILE%\\stable-diffusion-webui-master"
]
},
"memory": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\memory\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
]
},
"playwright": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\playwright\\node_modules\\@playwright\\mcp\\cli.js"
]
},
"fetch": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\fetch\\node_modules\\mcp-fetch-server\\dist\\index.js"
]
},
"github": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\github\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
]
},
"sequential-thinking": {
"command": "node",
"args": [
"%USERPROFILE%\\.lmstudio\\mcp-servers\\sequential-thinking\\node_modules\\@modelcontextprotocol\\server-sequential-thinking\\dist\\index.js"

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +23
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow",
"C:\\Users\\Shadow\\Downloads",
"C:\\Users\\Shadow\\Documents",
"C:\\Users\\Shadow\\Desktop",
"C:\\Users\\Shadow\\stable-diffusion-webui-master"
]
},

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filesystem MCP server is granted access to the entire user home directory (C:\\Users\\Shadow) plus other subfolders. This is a very broad permission set for an LLM tool; consider restricting the allowed roots to only what’s required for this workflow (e.g., the SD WebUI folder and a dedicated workspace/output directory).

Suggested change
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow",
"C:\\Users\\Shadow\\Downloads",
"C:\\Users\\Shadow\\Documents",
"C:\\Users\\Shadow\\Desktop",
"C:\\Users\\Shadow\\stable-diffusion-webui-master"
]
},
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\Shadow\\.lmstudio\\mcp-servers\\filesystem\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
"C:\\Users\\Shadow\\stable-diffusion-webui-master",
"C:\\Users\\Shadow\\stable-diffusion-webui-master\\outputs\\txt2img-images",
"C:\\Users\\Shadow\\.lmstudio\\mcp-workspace"
]
},

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
"name": "PeojectWebsite (Vite/React)",
"cwd": "C:/Users/Shadow/PeojectWebsite",

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible typo in the project name/path: "PeojectWebsite" looks like it should be "ProjectWebsite". If this is unintended, correct it so the entry is easier to find and doesn’t point at a non-existent directory.

Suggested change
"name": "PeojectWebsite (Vite/React)",
"cwd": "C:/Users/Shadow/PeojectWebsite",
"name": "ProjectWebsite (Vite/React)",
"cwd": "C:/Users/Shadow/ProjectWebsite",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants