Get AI summaries of any video or article — Sign up free
Claude MCP - How To Modify Your Servers To The Next Level thumbnail

Claude MCP - How To Modify Your Servers To The Next Level

All About AI·
5 min read

Based on All About AI's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Start from the official MCP file system server and run it locally so its toolset can be extended.

Briefing

A practical workaround for Claude’s Model Context Protocol (MCP) limitations lets users add an “execute file” capability to a local file-system MCP server—turning a read/write tool into one that can run code, capture output, and even spin up a local website. The core idea is to run the MCP file system server locally (so it can be extended), then modify its TypeScript implementation to include a new tool that executes selected file types and returns stdout/stderr results. That single change unlocks workflows like generating Python scripts, running Node.js programs, and serving a web page from localhost.

The walkthrough starts with the official MCP file system server and narrows in on the “file system” service files (readme, index.ts, package.json, tsconfig.json). Instead of cloning everything, it creates a local “servers/file system” setup in a Cursor workspace, copies in the server code, and adds the necessary TypeScript configuration. A key operational step is generating or locating the Claude Desktop MCP configuration file (via a PowerShell command on Windows) and pointing it to the compiled server entry (index.js) inside the local MCP2 servers folder. After installing dependencies with npm install and launching Claude Desktop (run as admin on Windows), the file system tools appear and can save artifacts to an allowed directory.

To prove the extension works, the guide demonstrates writing Python code through the MCP file system tool—saving a script that adds two integers and writes the result to a file. Then it moves to the main modification: implementing an “execute file tool” inside the existing index.ts server. The new tool is designed to run Python and Node commands, capture standard output, and return execution results back to Claude. After rebuilding (npm run build) and restarting Claude Desktop, the tool count increases (e.g., from 11 to 12), and the new execute capability becomes available.

A test prompt writes a Python script to find the next prime number, then runs it via the execute tool. The output confirms the tool executes the saved file and captures results like “next prime,” with test cases such as inputs 10, 20, and 100 passing.

The final demonstration escalates from code execution to local web hosting. Using the execute capability, the guide attempts a “one-shot” build: creating a web page folder containing index.html, server.js, styles.css, and a main JS/TS file, then running server.js on localhost:3000. When npm and pip commands are initially missing from the allowed command set, the server configuration is updated to permit them, followed by another build and restart. With npm install enabled, dependencies can be installed, server.js can be launched, and the browser loads the retro terminal-styled landing page.

The closing takeaway is a tradeoff: enabling file execution increases risk, but the risk can be managed by restricting which file types and commands are allowed (the guide emphasizes avoiding dangerous executables like .exe). The result is a more capable MCP server that can be tailored to specific needs—whether extending the file system server itself or modifying other community MCP servers for custom workflows.

Cornell Notes

The walkthrough shows how to extend Claude’s MCP file system server so it can execute files, not just read/write them. It starts by running the official file system MCP server locally, wiring it into Claude Desktop via the MCP config, and verifying that saved scripts land in the allowed directory. The key change is adding an “execute file” tool to the server’s TypeScript code (index.ts), rebuilding, and restarting Claude Desktop so the new tool appears. Tests confirm stdout capture by running a Python “next prime” script. The capability then supports a bigger workflow: generating a small Node/Express-style website, installing dependencies (npm), and serving it on localhost:3000.

Why does the guide run the MCP file system server locally instead of relying only on the desktop app’s default setup?

Local execution is what makes it possible to extend the server’s toolset. The guide points Claude Desktop to a locally compiled MCP server entry (index.js) inside the user’s MCP2 servers folder, then modifies the underlying index.ts implementation to add new tools. Without running the server from the local machine, there’s no place to inject the new “execute file” tool logic and rebuild it.

What concrete steps ensure Claude Desktop can connect to the modified file system server?

First, the user creates a local servers/file system folder and adds the MCP server files (index.ts, package.json, tsconfig.json). Next, they obtain or generate the Claude Desktop MCP configuration file (on Windows via a PowerShell command) and edit it to point to the compiled index.js in the local MCP2 servers/file system path. After npm install, the user restarts Claude Desktop (run as admin on Windows) so the updated tools register.

How does the “execute file tool” change what Claude can do through MCP?

It turns saved artifacts into runnable programs. After adding the execute tool to index.ts and rebuilding (npm run build), Claude can write a Python script (e.g., to compute the next prime), then call the execute tool to run it and capture outputs like standard out. The guide demonstrates this by saving prime.py (or prime-related filename) and then executing it to return results for inputs such as 10, 20, and 100.

What’s the significance of restricting allowed commands and file types?

Execution increases security risk. The guide notes that enabling command execution can be dangerous, so the server should allow only a narrow set of safe file types and commands. It explicitly warns against executing risky binaries like .exe and instead focuses on controlled execution paths such as Python scripts and Node commands.

How does the workflow expand from running scripts to hosting a website on localhost:3000?

Once execution is enabled, Claude can generate a full project structure: index.html, styles.css, server.js, and supporting JS/TS files. The execute tool can then run server.js to start a local web server. When npm isn’t initially permitted, the guide updates the server’s allowed commands to include npm (and pip), rebuilds, installs dependencies with npm install, and finally loads the page in a browser at localhost:3000.

Review Questions

  1. What changes in the MCP server code are required to add an “execute file” capability, and what rebuild/restart steps make the new tool appear in Claude Desktop?
  2. How does the guide validate that execution works, and what outputs are used to confirm success?
  3. Why does the guide add npm/pip to the allowed commands for the website demo, and what security principle is still emphasized while doing so?

Key Points

  1. 1

    Start from the official MCP file system server and run it locally so its toolset can be extended.

  2. 2

    Wire Claude Desktop to the locally compiled server entry (index.js) via the MCP desktop config file.

  3. 3

    Add an “execute file” tool to the server’s index.ts so Claude can run saved scripts and return stdout/stderr.

  4. 4

    Rebuild (npm run build) and restart Claude Desktop to register newly added tools.

  5. 5

    Test execution with a simple Python script (e.g., next-prime) and verify captured output for multiple inputs.

  6. 6

    For website hosting, allow execution of Node server code and permit dependency installation by adding npm (and pip) to allowed commands when needed.

  7. 7

    Manage security risk by restricting executable file types and commands—avoid dangerous binaries like .exe.

Highlights

Adding an execute-file tool transforms MCP from “save files” into “run code and capture output,” enabling end-to-end automation.
After rebuilding and restarting Claude Desktop, the tool list increases (e.g., from 11 to 12), and execution becomes available as a first-class MCP tool.
A single workflow can generate a retro terminal-styled landing page, install dependencies, and serve it on localhost:3000.
Security risk rises sharply with execution, so the guide emphasizes tight allowlists for file types and commands.

Topics

Mentioned