localmcpcoder
Enables remote MCP clients like ChatGPT to run shell commands and manage files on your local machine via a Cloudflare tunnel, exposing tools for file operations, search, and task management.
README
localmcpcoder
A remote MCP server that gives ChatGPT, Claude (web) — or any MCP client — Claude Code style tools on your own machine: run shell commands, read, write and edit files, search the filesystem, and keep a task list.
It runs locally and is published to the internet through a free Cloudflare tunnel, so a web chat can actually work on your computer instead of just talking about it — no coding CLI to install or subscribe to.
Read the Security section before exposing this. This is remote code execution on your machine, by design.
Requirements
| macOS, Linux or Windows 10/11 | Shell defaults to bash, or powershell on Windows |
|
| Node.js 22+ | node -v |
22 or newer (uses the built-in fs.glob) |
| cloudflared | cloudflared --version |
Installed in step 2 below |
| A web chat that takes connectors | ChatGPT or Claude — anything that speaks Streamable HTTP |
Installation
1. Get the code and install the dependencies
git clone https://github.com/JuanseGZZ/localmcpcoder.git
cd localmcpcoder
npm install
2. Install cloudflared
brew install cloudflared # macOS
winget install --id Cloudflare.cloudflared -e # Windows
On Windows, close and reopen PowerShell afterwards so cloudflared lands on your
PATH. Check it on either platform:
cloudflared --version
That is the whole installation. The access token is generated automatically on first
run and saved to .env, which is gitignored — you never create it by hand.
Running it
cd localmcpcoder
./start.sh # macOS / Linux
.\start.ps1 # Windows
This starts the server on 127.0.0.1:8787, opens the tunnel, and prints a public URL
that it also copies to your clipboard:
=============================================================
READY. Paste this URL into your MCP client:
https://random-words-here.trycloudflare.com/mcp
Authentication: OAuth. Leave client ID and secret blank —
the client registers itself.
Then the browser will ask for this passphrase:
0a14bdd6c9f2...
Exposed folder: /Users/me/localmcpcoder
=============================================================
Leave that window open. Closing it, or pressing Ctrl+C, shuts down both the server
and the tunnel.
Common options:
./start.sh --root ~/projects # expose a different folder
./start.sh --port 8788 # use a different port
./start.sh --allow-outside-root # whole disk — see Security
.\start.ps1 -Root "C:\Users\me\projects"
.\start.ps1 -Port 8788
.\start.ps1 -AllowOutsideRoot
Connecting it to ChatGPT
Two steps, in two different settings pages.
1. Turn on Developer mode — Settings → Security and login → scroll to Developer mode → toggle it on. It is flagged as elevated risk because it is exactly what lets an unverified connector like this one write to your machine; with it off, only the search-style tools get wired up.
2. Add the connector — Settings → Plugins → the + button →
- URL: the URL printed above, ending in
/mcp. - Authentication: OAuth. Leave client ID and secret blank — the server supports dynamic client registration, so ChatGPT registers itself.
Save, then click Connect. A page opens asking for the passphrase printed by
start.sh (it is also in .env). Approve, and it should show as Connected with the
ten tools below. Open a chat, enable it from the tools menu, and try "list the files in
the folder".
Connecting it to Claude
Settings → Connectors → Add → Add custom connector → paste the same URL
ending in /mcp. Leave the OAuth client ID and secret blank under advanced settings.
Click Connect and approve with the passphrase.
The server is a plain Streamable HTTP endpoint, so any MCP client that can point at a URL will work.
Authentication
The connector URL used to end in /mcp/<token>, which meant the secret was written into
every proxy, edge and browser log the request passed through. It doesn't anymore.
The server is now its own OAuth 2.1 authorization server, implementing the parts of the MCP authorization spec that ChatGPT and Claude drive automatically:
/.well-known/oauth-protected-resource |
RFC 9728 — points clients at the authorization server |
/.well-known/oauth-authorization-server |
RFC 8414 — endpoint discovery |
POST /oauth/register |
RFC 7591 — the client registers itself, so there is no client ID or secret to copy |
GET/POST /oauth/authorize |
Consent page; PKCE with S256 is mandatory |
POST /oauth/token |
Audience-bound access tokens (RFC 8707), rotating refresh tokens |
The passphrase (the value in .env) is what you type on the consent page. It never
travels in a URL. Everything else is a short-lived token in an Authorization header.
For CLI clients, the passphrase also works directly as a bearer token — still a header, so still not log-visible:
curl -X POST https://<host>/mcp \
-H "Authorization: Bearer $(grep MCP_TOKEN .env | cut -d= -f2)" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Tokens live in memory, so restarting the server signs every client out and they re-authorize on next use.
Restarting later
The free tunnel gives you a new URL every time you start it. The passphrase stays the
same — it lives in .env — but the hostname changes, so re-paste the URL into the
connector and re-approve after each restart.
Tools
| Tool | What it does |
|---|---|
bash |
Runs a shell command — bash, or PowerShell on Windows (working dir, timeout, exit code) |
read_file |
Reads a file with line numbers (offset / limit) |
write_file |
Creates or overwrites a file |
edit_file |
Exact string replacement, with replace_all |
list_dir |
Lists a directory |
glob |
Finds files by pattern (**/*.js) |
grep |
Searches a regex across file contents |
todo_write / todo_read |
Session task list |
system_info |
OS, user, allowed root, shell |
Configuration
start.sh / start.ps1 set these for you; set them by hand only if you run
node server.js directly.
| Variable | Default | Purpose |
|---|---|---|
MCP_TOKEN |
— | The passphrase, required, 16 characters minimum |
MCP_PORT |
8787 |
Local port |
MCP_ROOT |
cwd | The only folder that can be accessed |
MCP_ALLOW_OUTSIDE_ROOT |
0 |
1 allows the whole disk |
MCP_SHELL |
bash, or powershell on Windows |
bash, powershell or cmd |
MCP_MAX_OUTPUT |
60000 |
Max characters per tool response |
Using your own domain instead
If you own a domain on Cloudflare, you can swap the random URL for a fixed one. Create a
named tunnel in the Cloudflare Zero Trust dashboard, install it as a service, and point a
public hostname at http://localhost:8787. Then run start-server.sh
(or start-server.ps1) instead — they start only the server and leave
the tunnel to the service. A named tunnel requires a domain in your Cloudflare account;
without one, use the quick tunnel above.
Security
This publishes remote code execution on your machine to the internet. Anyone holding the passphrase can do anything you can do on that computer.
- The passphrase is the password, and it is 192 bits of randomness — not guessable.
It lives in
.env, which is gitignored. Keep it that way. To rotate it, delete.envand restart. Do not paste it into a repo, an issue, a screenshot, or a chat you do not control. - Nothing is reachable without it. Every endpoint except the OAuth discovery
documents requires a bearer token,
/healthincluded. bashhas no allowlist, andMCP_ROOTdoes not contain it. The root restriction applies to the file tools and to the working directory a command starts in — not to what the command does once it runs.cd ~works. So doescurl. TreatMCP_ROOTas a limit on the file tools, not as a sandbox around the shell.- The file tools resolve symlinks before the root check, so a link inside the root that points outside it is rejected rather than followed.
- Prompt injection is the realistic attack. You are not defending against someone guessing the passphrase; you are defending against a web page, a README or an email the model reads talking it into running something. Keep the connector on ask before each action rather than allow all.
- Shut it down when you are not using it (
Ctrl+C).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。