Spaces:
Runtime error
Runtime error
File size: 3,185 Bytes
1a8fbbd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# MCP Server Setup on Windows: Reference Guide
## Overview
This document summarizes key points and step-by-step instructions for setting up MCP servers on Windows, with a focus on the use of `cmd` and `/c` wrappers in configuration files. It is based on a real troubleshooting and research session.
---
## 1. Installing Prerequisites
- **Node.js**: Download and install from https://nodejs.org/
- **Python 3.10+** (if using Python-based servers): https://www.python.org/downloads/
- Add both to your PATH during installation.
---
## 2. Installing MCP Servers Globally
Open **Command Prompt (CMD) as Administrator** and run:
```sh
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-memory
npm install -g @modelcontextprotocol/server-brave-search
```
(Install any other MCP servers you need.)
---
## 3. Using Absolute Paths in Configuration
Find your global npm modules path:
```sh
where node
npm root -g
```
Use these absolute paths in your config files.
---
## 4. Example MCP Server Configuration (with cmd and /c)
```json
"sentiment-analysis": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"mcp-remote",
"https://freemansel-mcp-sentiment.hf.space/gradio_api/mcp/sse",
"--transport",
"sse-only"
]
}
```
### What does `cmd` and `/c` do?
- **`cmd`**: Launches the Windows Command Prompt.
- **`/c`**: Tells `cmd.exe` to execute the following command and then terminate.
- This ensures the command runs in a Windows shell, which is important for compatibility and environment handling.
---
## 5. When to Use This Pattern
- Use `cmd` and `/c` when you want to ensure a command runs in the Windows Command Prompt, especially for shell-specific syntax or command chaining.
- For simple scripts, you can sometimes use `node` or `npx` directly, but `cmd` is the most compatible for complex or chained commands.
---
## 6. Windows CLI Wrapper Example
For a Windows-specific CLI wrapper (to expose PowerShell, CMD, or Git Bash as MCP tools):
- [win-cli-mcp-server](https://github.com/SimonB97/win-cli-mcp-server)
Install and configure:
```sh
npm install -g @simonb97/server-win-cli
```
Config example:
```json
"windows-cli": {
"command": "npx",
"args": ["-y", "@simonb97/server-win-cli"]
}
```
---
## 7. Tips and Troubleshooting
- Always use **absolute paths** for both Node and server files.
- Run Cursor/Claude Desktop as **Administrator** for best compatibility.
- If you need environment variables, set them in the `env` section of your config.
- If you get errors, try running the server directly in CMD to check for issues.
---
## 8. References
- [MCP-Windows Setup Guide (Gist)](https://gist.github.com/feveromo/7a340d7795fca1ccd535a5802b976e1f)
- [win-cli-mcp-server GitHub](https://github.com/SimonB97/win-cli-mcp-server)
---
## Conversation Summary
- The use of `cmd` and `/c` is a Windows-specific wrapper to ensure commands run in a shell and terminate after execution.
- This pattern is common in MCP server configs for Windows to maximize compatibility.
- For more details or troubleshooting, see the references above or ask for help in the Cursor/Claude community forums. |