自作MCPサーバー その7 #AI - Qiita
@ohisama@github

Custom MCP Server Part 7

  • Custom MCP
  • AI
  • ClaudeDesktop
  • DesktopCommander
  • Security
0
Last updated at 2026-11-11Posted at 2026-11-11
TAG40@@
TAG42

Overview

I became interested in MCP servers, so I looked into it.
I asked the AI.
I tried the sample.
I tried Desktop-Commander.
I tried compiling C#.

Add mcpServers to claude_desktop_config.json.

An error occurred.

image.png

Install desktop-commander using npx

An error occurred

>npx -y @wonderwhy-er/desktop-commander@latest npm warn EBADENGINE Unsupported engine { npm warn EBADENGINE package: '@wonderwhy-er/desktop-commander@0.3.2', npm warn EBADENGINE required: { node: '>=22.12.0' }, npm warn EBADENGINE current: { node: 'v22.11.0', npm: '10.9.0' } npm warn EBADENGINE } npm warn deprecated uuid@8.3.2: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).npm warn deprecated glob@10.5.0: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me node:internal/modules/cjs/loader:1249 const err = new Error(message); ^ Error: Cannot find module './lib/retry' Require stack: - C:\Users\ohisa\AppData\Local\npm-cache\_npx\4b4c857f6efdfb61\node_modules\retry\index.js - C:\Users\ohisa\AppData\Local\npm-cache\_npx\4b4c857f6efdfb61\node_modules\proper-lockfile\lib\lockfile.js - C:\Users\ohisa\AppData\Local\npm-cache\_npx\4b4c857f6efdfb61\node_modules\proper-lockfile\index.js at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15) at Function._load (node:internal/modules/cjs/loader:1075:27)at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:218:24) at Module.require (node:internal/modules/cjs/loader:1340:12) at require (node:internal/modules/helpers:141:16) at Object. (C:\Users\ohisa\AppData\Local\npm-cache\_npx\4b4c857f6efdfb61\node_modules\retry\index.js:1:18) at Module._compile (node:internal/modules/cjs/loader:1546:14) at Object..js (node:internal/modules/cjs/loader:1689:10) at Module.load (node:internal/modules/cjs/loader:1318:32) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Users\\ohisa\\AppData\\Local\\npm-cache\\_npx\\4b4c857f6efdfb61\\node_modules\\retry\\index.js', 'C:\\Users\\ohisa\\AppData\\Local\\npm-cache\\_npx\\4b4c857f6efdfb61\\node_modules\\proper-lockfile\\lib\\lockfile.js', 'C:\\Users\\ohisa\\AppData\\Local\\npm-cache\\_npx\\4b4c857f6efdfb61\\node_modules\\proper-lockfile\\index.js' ] } Node.js v22.11.0

Upgrade the Node.js version.

>nvm install lts Downloading node.js version 26.13.0 (64-bit)... Extracting node and npm... Complete Installation complete. If you want to use this version, type: nvm use 26.13.0 >nvm use 26.13.0

Again, install desktop-commander using npx

>npx @wonderwhy-er/desktop-commander@latest setup ??????? ??????????????????? ???????????? ??????? ??????? ??????? ??????? ???? ???????? ???? ?????? ???? ?????????? ?????????????? ??????????????????????????? ?????????????????????????????? ?????????????????????? ?????????? ?????????????????? ??????????????????????????? ??? ????????? ??????????????? ??? ??? ??????????? ??? ??? ??????????????????????????????????????? ?????? ????????? ???????? ??? ????????? ??????????????? ??? ??? ?????????????? ??? ??? ?????????????????????????????????????????????? ????????? ???????? ??????????????????????????? ??? ??? ???????????? ???????????????????? ??? ?????? ??? ?????? ?????? ????????????????????????? ??? ??????? ??????????????????? ??? ??? ??????? ??? ??????? ??????? ??? ?????? ?????? ?????? ???????????? ??????????? ??? Creating config directory: C:\Users\ohisa\AppData\Roaming\Claude Claude config file not found at: C:\Users\ohisa\AppData\Roaming\Claude\claude_desktop_config.jsonCreating default config file... Default config file created. ? Desktop Commander MCP vunknown successfully added to Claude’s configuration. Configuration location: C:\Users\ohisa\AppData\Roaming\Claude\claude_desktop_config.json Windows: Claude restart skipped - requires manual restart ? Installation successfully completed! Thank you for using Desktop Commander! The server is available as "desktop-commander" in Claude's MCP server list Future updates will install automatically ? no need to run this setup again. ? Need help or have feedback? Happy to jump on a quick call: https://calendar.app.google/SHMNZN5MJznJWC5A7 or join our community: https://discord.com/invite/kQ27sNnZr7

Steps to create hello.cs using Desktop Commander and compile and run it with csc.

Is Desktop Commander unusable?

I’ll check whether it can be used.

It has loaded, so I’ll retrieve the configuration to check whether it actually works.

Yes, it can be used. My previous response was insufficient. Since Desktop Commander is connected, it can operate your own Windows PC. I just retrieved the configuration and confirmed the connection.

Confirmed environment

  • OS: Windows (default shell: PowerShell)
  • Node.js: Available (v26.13.0)
  • Python: Not detected (may not be installed or may not be included in the PATH)

What you can do with Desktop Commander

  • Execute commands on your PC (such as PowerShell)
  • Read, write, and edit files (text, Excel, PDF, DOCX, etc.)
  • List folders; list and terminate processes

Precautions

  • Unlike my sandbox earlier, this affects files and processes on the actual PC. Highly consequential operations such as deletion and overwriting will be explained before they are executed.
  • Dangerous commands such as sudo, format, and shutdown are blocked.

Tell me what you want to execute. For example, you can ask me to “list the files in this folder” or “run this script.”

The working folder is C:\Users\ohisa\claude, and will be used

Understood. I’ll check whether the folder exists and create it if it does not.

C:\Users\ohisa\claude already exists and is empty. It will be used for all future file creation and command execution.

Note that each command runs in a separate process, so the effect of Set-Location does not carry over to the next command. Therefore, either change to this folder each time or specify an absolute path.

What would you like to do next? For example, I can test the behavior by creating hello.cs and compiling and running it with csc.

Create hello.cs, then compile and run it with csc

Created hello.cs, compiled it with csc, and ran it successfully.

The output was as follows.

Hello, World! Hello, world!

The following two items have been created in C:\Users\ohisa\claude.

  • hello.cs: Source code
  • hello.exe: Compiled executable file

The compiler used was the 64-bit version of .NET Framework 4 (Framework64\v4.0.30319\csc.exe). Japanese characters were also displayed correctly.

You can also create another program, such as one that accepts arguments or reads and writes files.

Photo

image.png

hello.cs

using System; class Hello { static void Main() {Console.WriteLine("Hello, World!"); Console.WriteLine("Hello, World!"); } }

That's all.

0
0
0