JC

jx-codes/codemode-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

134 stars 12 forks Качество 52 Тренд 1

jx-codes/codemode-mcp — это кандидат на сервер MCP, импортированный из https://github.com/jx-codes/codemode-mcp.

Обзор

jx-codes/codemode-mcp — это кандидат на сервер MCP, импортированный из https://github.com/jx-codes/codemode-mcp.

Обзор (машинный перевод)

ПРИМЕЧАНИЕ: Я прекратил работу над этим репо в пользу:

https://github.com/jx-codes/lootbox

Это гораздо более продуманный подход к режиму кода

Сервер MCP в режиме кода

Локальная реализация рабочего процесса «Code Mode» для MCP-серверов. Вместо того чтобы сталкиваться с множеством вызовов инструментов, LLM пишут код TypeScript/JavaScript, который вызывает простой HTTP-прокси для доступа к вашим MCP-серверам.

Примечание: он не пытается обрабатывать слой транспиляции MCP -> typescript API. Было бы здорово, но я очень хотел протестировать рабочий процесс.

https://blog.cloudflare.com/code-mode/

Что это?

Это реализует основное понимание того, что LLM гораздо лучше пишут код, чем вызывают инструменты. Вместо того чтобы напрямую подвергать LLM множество инструментов (с чем она испытывает трудности), этот сервер предоставляет LLM только один инструмент: execute_code. LLM пишет код, который делает HTTP-запросы для доступа к вашим другим MCP-серверам.

Как это работает

  1. LLM получает один инструмент: execute_code — запускает TypeScript/JavaScript
  2. LLM записывает код: использует fetch() для вызова http://localhost:3001/mcp/* конечных точек
  3. HTTP-прокси пересылки: Прозрачно пересылает запросы на ваши реальные MCP-серверы

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

NOTE: I’ve stopped working on this repo in favor of:

https://github.com/jx-codes/lootbox

It’s a much more thought out approach to code mode

Code Mode MCP Server

A local implementation of the “Code Mode” workflow for MCP servers. Instead of struggling with multiple tool calls, LLMs write TypeScript/JavaScript code that calls a simple HTTP proxy to access your MCP servers.

Note: It does not attempt to handle the MCP -> typescript API transpilation layer. Would be cool but I really wanted to test the workflow.

https://blog.cloudflare.com/code-mode/

What is this?

This implements the core insight that LLMs are much better at writing code than at tool calling. Instead of exposing many tools directly to the LLM (which it struggles with), this server gives the LLM just one tool: execute_code. The LLM writes code that makes HTTP requests to access your other MCP servers.

How it works

  1. LLM gets one tool: execute_code - executes TypeScript/JavaScript
  2. LLM writes code: Uses fetch() to call http://localhost:3001/mcp/* endpoints
  3. HTTP proxy forwards: Transparently proxies requests to your actual MCP servers
  4. Results flow back: Through the code execution to the LLM

This gives you all the benefits of complex tool orchestration, but leverages what LLMs are actually good at: writing code.

Installation

Prerequisites

  • Bun (latest version)
  • Deno (for code execution sandbox)
  • An MCP-compatible client (Claude Desktop, Cursor, VS Code with Copilot, etc.)

Setup

  1. Clone the repository
git clone https://github.com/jx-codes/codemode-mcp.git
cd codemode-mcp
  1. Install dependencies
bun install
  1. Configure the server (optional)

Create a codemode-config.json file to customize settings:

{
   "proxyPort": 3001,
   "configDirectories": [
      "~/.config/mcp/servers",
      "./mcp-servers",
      "./"
   ]
}
  1. Set up your MCP servers

Create a .mcp.json file with your MCP server configurations in any of the directories you specified above:

{
   "mcpServers": {
      "fs": {
         "command": "npx",
         "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
         "env": {}
      }
   }
}

Example Workflows

Single MCP Server Call

Instead of direct tool calling, the LLM writes:

// List available servers
const servers = await fetch("http://localhost:3001/mcp/servers").then((r) =>
  r.json()
);
console.log("Available servers:", servers);

// Call a tool on the filesystem server
const result = await fetch("http://localhost:3001/mcp/call", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    server: "fs",
    tool: "read_file",
    args: { path: "/tmp/example.txt" },
  }),
}).then((r) => r.json());

console.log("File contents:", result);

Chaining Multiple Operations

Открыть полный README на GitHub

Установка

npx -y @modelcontextprotocol/server-filesystem /tmp
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "fs": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"], "env": {} } } }