mcpcodeserver 标志

mcpcodeserver

社区
zbowling

A Model Context Protocol (MCP) proxy server that translates tool calls into TypeScript code generation. Instead of making multiple tool calls back and forth, LLMs can write TypeScript code that calls multiple tools naturally, reducing token overhead and leveraging the LLM's superior code generation capabilities.

发布者zbowling
代码仓库mcpcodeserver
语言TypeScript
复刻数
1
星标数
14
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    mcpcodeserver 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 14 个 Star 和 1 个 Fork。

mcpcodeserver

NPM Version MIT licensed Install MCP Server Install in VS Code (npx)

A Model Context Protocol (MCP) proxy server that translates tool calls into TypeScript code generation. Instead of making multiple tool calls back and forth, LLMs can write TypeScript code that calls multiple tools naturally, reducing token overhead and leveraging the LLM's superior code generation capabilities.

❌ Without mcpcodeserver

LLMs make multiple sequential tool calls, burning tokens and struggling with complex workflows:

  • ❌ Multiple round-trips between LLM and tools
  • ❌ Complex tool calling sequences are error-prone
  • ❌ Data cannot easily be passed between tools
  • ❌ Limited error handling and control flow

✅ With mcpcodeserver

LLMs write TypeScript code that calls multiple tools naturally:

  • ✅ Write code to call multiple tools in sequence
  • ✅ Use variables, loops, and conditionals naturally
  • ✅ Better error handling with try/catch
  • ✅ Reduce token usage by combining operations
  • ✅ Leverage LLM's strong code generation capabilities

Quick Start

  1. Install mcpcodeserver in your MCP client (see installation section below)
  2. Create an mcp.json configuration file with your child MCP servers
  3. Start using it - your LLM can now generate and execute TypeScript code that calls your tools
typescript
// Instead of multiple tool calls, write code like this:
const files = await filesystem.list_directory({ path: "/tmp" });
const results = await Promise.all(
  files.map(file => filesystem.read_file({ path: file.path }))
);
return results.filter(content => content.includes("important"));

Overview

mcpcodeserver is a unique MCP server that:

  • Acts as an MCP client to connect to one or more child MCP servers
  • Discovers all tools from child servers
  • Exposes three powerful tools to parent LLM clients:
    1. list_servers - Lists all available sub-servers connected to this MCP server
    2. get_tool_definitions - Returns TypeScript type definitions for discovered tools (optionally filtered by server)
    3. generate_and_execute_code - Generates and executes TypeScript code that calls those tools in a sandbox

This architecture allows LLMs to orchestrate complex multi-tool workflows by writing code instead of making sequential tool calls, which is often more efficient and natural for modern language models.

Related Work & Research

This approach is inspired by recent research showing that LLMs perform better when generating executable code rather than making direct tool calls:

  • CodeAct: Your LLM Agent Acts Better when Generating Code (Apple, ICML 2024) - Demonstrates that LLM agents achieve up to 20% higher success rates when using executable Python code as a unified action space instead of pre-defined tool calling formats.

  • Cloudflare Code Mode - A similar implementation that converts MCP tools into TypeScript APIs, showing that "LLMs are better at writing code to call MCP, than at calling MCP directly."

The key insight from this research is that LLMs have extensive training on real-world code but limited exposure to synthetic tool-calling formats, making code generation a more natural and effective approach for complex agent workflows.

Why Use This?

Traditional Tool Calling Problems

  • Multiple round-trips between LLM and tools burn tokens
  • LLMs often struggle with complex tool calling sequences
  • Each tool call requires JSON schema understanding and formatting
  • Data cannot easily be passed between tools without going through the LLM

Code Generation Solution

  • Write TypeScript code to call multiple tools in sequence
  • Use variables, loops, and conditionals naturally
  • Better error handling with try/catch
  • Reduce token usage by combining operations
  • Leverage LLM's strong code generation capabilities

Dynamic Tool Discovery

mcpcodeserver automatically monitors child MCP servers for tool changes and notifies parent clients when tools are added, removed, or modified:

  • Automatic Refresh: Checks for tool changes every 30 seconds
  • Real-time Notifications: Sends notifications/tools/list_changed to parent clients
  • Dynamic Updates: Tool definitions and summaries update automatically
  • No Manual Refresh: Parent LLMs receive notifications to refresh their tool knowledge

This ensures that parent LLMs always have the most current tool definitions without requiring manual intervention.

Server Filtering

To reduce context window usage and improve focus, mcpcodeserver supports filtering tool definitions by specific servers:

  • List Available Servers: Use list_servers to see all connected sub-servers
  • Filtered Tool Definitions: Use get_tool_definitions with server_names parameter to get tools from specific servers only
  • Reduced Verbosity: Get focused TypeScript definitions without overwhelming the LLM's context window
  • Method Namespacing: All generated functions are prefixed with server names (e.g., pizzashop_create_pizza, filesystem_read_file)

Example usage:

typescript
// List available servers
const servers = await list_servers({});
// Returns: ["pizzashop", "filesystem", "memory"]

// Get all tool definitions
const allTools = await get_tool_definitions({});

// Get only pizzashop tools
const pizzashopTools = await get_tool_definitions({
  server_names: ["pizzashop"]
});

Advanced MCP Features

mcpcodeserver supports pass-through of advanced MCP protocol features when both parent and child servers support them:

  • Elicitation: Child servers can request user input during tool execution, which is passed through to parent clients
  • Roots: Lists and aggregates roots from all child servers, providing a unified view of available resources
  • Sampling: Enables LLM sampling requests to be passed through to child servers for advanced AI capabilities

These features are automatically advertised to parent clients and work seamlessly when supported by the underlying child MCP servers.

Quick Start

Try it immediately with npx (no installation required):

bash
# From GitHub
npx github:zbowling/mcpcodeserver --help

# Or when published to npm
npx mcpcodeserver --help

🛠️ Installation

Requirements

  • Node.js >= v18.0.0
  • Cursor, Claude Code, VSCode, Windsurf or another MCP Client

Installing via Smithery

To install mcpcodeserver for any client automatically via Smithery:

bash
npx -y @smithery/cli@latest install mcpcodeserver --client <client-name> --key <smithery-key>

Install in Cursor

Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Pasting the following configuration into your Cursor ~/.cursor/mcp.json file is the recommended approach. You may also install in a specific project by creating .cursor/mcp.json in your project folder.

Cursor One-Click Installation

Install MCP Server

Cursor Local Server Connection

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Cursor Remote Server Connection (if you set up HTTP transport)

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "url": "http://localhost:3000/mcp"
    }
  }
}

Install in Claude Code

Run this command. See Claude Code MCP docs for more info.

Claude Code Local Server Connection

sh
claude mcp add mcpcodeserver -- npx -y mcpcodeserver --config /path/to/your/mcp.json

Claude Code Remote Server Connection

sh
claude mcp add --transport http mcpcodeserver http://localhost:3000/mcp

Install in VSCode

VSCode One-Click Installation

Install in VS Code (npx)

VSCode Manual Configuration

Add to your VSCode MCP settings:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Windsurf

Windsurf One-Click Installation

Install in Windsurf

Install in AI Coding Assistants

For Continue, Cline, and RooCode, add to your configuration:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Amp

Run this command in your terminal. See Amp MCP docs for more info.

sh
amp mcp add mcpcodeserver -- npx -y mcpcodeserver --config /path/to/your/mcp.json

Install in Text Editors

For Aider, Codium, Zed, Nova, and Sublime Text, add to your configuration:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Neovim

Add to your Neovim MCP configuration:

lua
{
  mcpServers = {
    mcpcodeserver = {
      command = "npx",
      args = {"-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"}
    }
  }
}

Install in Emacs

Add to your Emacs MCP configuration:

elisp
(setq mcp-servers
      '((mcpcodeserver
         :command "npx"
         :args ("-y" "mcpcodeserver" "--config" "/path/to/your/mcp.json"))))

Install in JetBrains IDEs

For IntelliJ IDEA, WebStorm, PyCharm, and Android Studio, add to your MCP settings:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in AI Tools

For Codeium, Tabnine, GitHub Copilot, and Amazon CodeWhisperer, add to your MCP settings:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Cloud IDEs

For Replit, CodeSandbox, StackBlitz, GitPod, GitHub Codespaces, GitLab Web IDE, and Bitbucket Cloud, add to your MCP settings:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Other Tools

For Xcode, Fleet, Sourcegraph, and JetBrains Gateway, add to your MCP configuration:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Install in Remote Development

For remote development environments, you can also use HTTP transport:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "url": "http://your-server:3000/mcp"
    }
  }
}

Configuration File

Create an mcp.json configuration file to define your child MCP servers:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "env": { "DEBUG": "false" }
    },
    "memory": {
      "command": "npx", 
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": { "BRAVE_API_KEY": "your-api-key" }
    }
  }
}

Installation for Development

bash
# Install dependencies (using Bun for faster performance)
bun install

# Or with npm
npm install

# Build the project
bun run build

# Test the built server
bun dist/index.js --help

Note: This project uses Bun for better performance, but npm/node also work fine.

🚨 Troubleshooting

Module Not Found Errors

If you encounter ERR_MODULE_NOT_FOUND, try using bunx instead of npx:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "bunx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

ESM Resolution Issues

For errors like Error: Cannot find module, try the --experimental-vm-modules flag:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "--node-options=--experimental-vm-modules", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

TLS/Certificate Issues

Use the --experimental-fetch flag to bypass TLS-related problems:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "--node-options=--experimental-fetch", "mcpcodeserver", "--config", "/path/to/your/mcp.json"]
    }
  }
}

General MCP Client Errors

  1. Try adding @latest to the package name
  2. Use bunx as an alternative to npx
  3. Consider using deno as another alternative
  4. Ensure you're using Node.js v18 or higher for native fetch support

Configuration Issues

  • Make sure your mcp.json file is valid JSON
  • Check that all child server commands are available in your PATH
  • Verify that child servers can start independently
  • Check file permissions for the config file path

Testing with MCP Inspector

bash
npx -y @modelcontextprotocol/inspector npx mcpcodeserver --config /path/to/your/mcp.json

💻 Development

CLI Arguments

mcpcodeserver accepts the following CLI flags:

  • --config <path> – Path to the MCP configuration file (default: ./mcp.json)
  • --transport <stdio|http> – Transport to use (stdio by default). Note that HTTP transport automatically provides both HTTP and SSE endpoints
  • --port <number> – Port to listen on when using http transport (default 3000)
  • --help – Show help message

Example with HTTP transport and port 8080:

bash
npx mcpcodeserver --config /path/to/mcp.json --transport http --port 8080

Example with stdio transport:

bash
npx mcpcodeserver --config /path/to/mcp.json --transport stdio

Environment Variables

You can use environment variables for configuration:

  • MCP_CONFIG_PATH – Path to the MCP configuration file (alternative to --config)
  • MCP_TRANSPORT – Transport type (alternative to --transport)
  • MCP_PORT – Port number for HTTP transport (alternative to --port)

Example with environment variables:

bash
# .env
MCP_CONFIG_PATH=/path/to/your/mcp.json
MCP_TRANSPORT=stdio

Example MCP configuration using environment variables:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver"],
      "env": {
        "MCP_CONFIG_PATH": "/path/to/your/mcp.json"
      }
    }
  }
}

Note: CLI flags take precedence over environment variables when both are provided.

Local Development Configuration

For local development, you can run the TypeScript source directly:

json
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": ["tsx", "/path/to/mcpcodeserver/src/index.ts", "--config", "/path/to/your/mcp.json"]
    }
  }
}

Running Modes

Stdio Mode (Default)

The server runs in stdio mode by default, which is perfect for integration with MCP clients like Claude Desktop:

bash
# Run in stdio mode
npx mcpcodeserver --config mcp.json

# Or with custom config path
npx mcpcodeserver --config /path/to/your/mcp.json

HTTP Mode

For debugging, testing, or integration with web-based MCP clients, you can run the server in HTTP mode:

bash
# Run in HTTP mode on default port 3000
npx mcpcodeserver --http --config mcp.json

# Run on custom port and host
npx mcpcodeserver --http --port 8080 --host 0.0.0.0 --config mcp.json

When running in HTTP mode, the server will be available at:

  • Server URL: http://localhost:3000/mcp (or your custom host:port)
  • MCP Inspector: Use npx @modelcontextprotocol/inspector http://localhost:3000/mcp to debug and test

MCP Inspector Integration

The MCP Inspector is a powerful tool for debugging and testing MCP servers. When running in HTTP mode, you can use it to:

  • Inspect available tools and their schemas
  • Test tool calls interactively
  • Debug resource access and prompts
  • Monitor real-time notifications
bash
# Start the server in HTTP mode
npx mcpcodeserver --http --config mcp.json

# In another terminal, start the MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:3000/mcp

# Or use the shorthand script (includes all example servers)
npm run inspector

The inspector will open in your browser and provide a full interface for exploring and testing your MCP server.

Note: The npm run inspector command uses mcp-test.json which includes 8 MCP servers (67 tools total) from the official examples, including both TypeScript (npx) and Python (uvx) based servers.

Configuration

Create an mcp.json file that defines which child MCP servers to connect to. This follows the standard MCP client configuration format:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "env": {
        "DEBUG": "false"
      }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
      }
    },
    "weather": {
      "url": "http://localhost:3000/mcp",
      "transport": "sse"
    }
  }
}

Configuration Options

Each server entry supports:

For stdio transport:

  • command (required) - The command to execute (e.g., "node", "python", "npx")
  • args (optional) - Array of arguments to pass to the command
  • env (optional) - Environment variables for the child process

For HTTP/SSE transport:

  • url (required) - The HTTP endpoint URL
  • transport - Set to "sse" for Server-Sent Events

Usage

Starting the Server

bash
# Use default config (./mcp.json)
mcpcodeserver

# Use custom config location
mcpcodeserver --config /path/to/custom-mcp.json

# Show help
mcpcodeserver --help

Using as an MCP Server

Configure mcpcodeserver in your MCP client (like Claude Desktop, Claude Code, Cline, etc.):

With npx (recommended - no installation needed):

json
{
  "mcpServers": {
    "codeserver": {
      "command": "npx",
      "args": ["-y", "mcpcodeserver", "--config", "/path/to/mcp.json"]
    }
  }
}

From GitHub (works immediately):

json
{
  "mcpServers": {
    "codeserver": {
      "command": "npx",
      "args": ["-y", "github:zbowling/mcpcodeserver", "--config", "/path/to/mcp.json"]
    }
  }
}

With other package managers:

json
// yarn
{ "command": "yarn", "args": ["dlx", "mcpcodeserver", "--config", "/path/to/mcp.json"] }

// pnpm
{ "command": "pnpm", "args": ["dlx", "mcpcodeserver", "--config", "/path/to/mcp.json"] }

// bun
{ "command": "bunx", "args": ["mcpcodeserver", "--config", "/path/to/mcp.json"] }

See examples/ for more configuration examples and MCP client-specific setups.

Tool 1: get_tool_definitions

This tool returns TypeScript type definitions for all discovered tools from child servers.

Input:

  • include_examples (optional boolean) - Whether to include usage examples

Example:

typescript
// Call the tool (in your MCP client)
get_tool_definitions({ include_examples: true })

Output: Returns TypeScript code with interfaces and function declarations:

typescript
/**
 * Auto-generated TypeScript definitions for MCP tools
 */

interface ToolResult {
  content: Array<{
    type: string;
    text?: string;
    // ...
  }>;
  isError?: boolean;
}

/**
 * Read contents of a file
 * Server: filesystem
 * Tool: read_file
 */
interface ReadFileParams {
  path: string;
}

declare function filesystem_read_file(params: ReadFileParams): Promise<ToolResult>;

// ... more tool definitions

Tool 2: generate_and_execute_code

This tool executes TypeScript code in a sandbox with access to all discovered tool functions.

Input:

  • code (required string) - TypeScript/JavaScript code to execute
  • timeout (optional number) - Max execution time in milliseconds (default: 30000, max: 300000)

Example:

typescript
// Call the tool with TypeScript code
generate_and_execute_code({
  code: `
    // Read multiple files and combine them
    const file1 = await filesystem_read_file({ path: "/tmp/file1.txt" });
    const file2 = await filesystem_read_file({ path: "/tmp/file2.txt" });

    const text1 = file1.content[0].text;
    const text2 = file2.content[0].text;

    console.log("File 1 length:", text1.length);
    console.log("File 2 length:", text2.length);

    return {
      combined: text1 + text2,
      totalLength: text1.length + text2.length
    };
  `
})

Output:

=== Console Output ===
File 1 length: 42
File 2 length: 38

=== Result ===
{
  "combined": "...",
  "totalLength": 80
}

Sandbox Environment

The TypeScript execution sandbox provides:

Available:

  • All discovered tool functions (as async functions)
  • Console methods: console.log(), console.error(), console.warn(), console.info()
  • Basic JavaScript globals: Math, JSON, Date, Array, Object, String, Number, Boolean
  • Promise and async/await support
  • Error handling with try/catch
  • Timers: setTimeout, setInterval, clearTimeout, clearInterval

Not Available:

  • Node.js modules (fs, http, child_process, etc.)
  • File system access (except via MCP tools)
  • Network access (except via MCP tools)
  • Process information

Security Note: This is not a fully secure sandbox. The VM context provides isolation but is not bulletproof. Only execute trusted code.

Error Handling

Errors in the sandbox are caught and returned with stack traces:

typescript
generate_and_execute_code({
  code: `
    try {
      const result = await filesystem_read_file({ path: "/nonexistent" });
      return result;
    } catch (error) {
      console.error("Failed to read file:", error.message);
      throw error; // Re-throw to surface to parent
    }
  `
})

Testing with Claude Code

Want to try mcpcodeserver with Claude Code? Use the one-command setup:

bash
./setup-claude-code-test.sh

This will build the project, install test dependencies, and show you exactly what to add to your Claude Code configuration. See TESTING_WITH_CLAUDE.md for detailed instructions.

Development

bash
# Install dependencies
bun install

# Build the project
bun run build

# Watch mode for development
bun run dev

# Run the server
bun start

# Run tests
bun test                # All tests
bun run test:unit       # Unit tests only
bun run test:integration # Integration tests (requires Python)

# Code quality
bun run lint            # Check linting
bun run format          # Format code
bun run typecheck       # Type checking

Project Structure

See AGENTS.md for detailed project structure and component documentation.

Use Cases

Multi-File Operations

Instead of making multiple tool calls through the LLM, write code:

typescript
const files = ["/tmp/a.txt", "/tmp/b.txt", "/tmp/c.txt"];
const contents = await Promise.all(
  files.map(path => filesystem_read_file({ path }))
);
return contents.map(r => r.content[0].text);

Data Transformation

Process data between tool calls without LLM intervention:

typescript
const data = await api_fetch({ url: "https://api.example.com/data" });
const json = JSON.parse(data.content[0].text);
const filtered = json.items.filter(item => item.active);
return filtered.length;

Conditional Logic

Make decisions based on tool results:

typescript
const exists = await filesystem_read_file({ path: "/tmp/config.json" });
if (exists.isError) {
  console.log("Config doesn't exist, using defaults");
  return { source: "defaults" };
} else {
  return { source: "file", config: JSON.parse(exists.content[0].text) };
}

Error Recovery

Handle errors gracefully without aborting the entire workflow:

typescript
const results = [];
for (const path of ["/tmp/a.txt", "/tmp/b.txt", "/tmp/c.txt"]) {
  try {
    const content = await filesystem_read_file({ path });
    results.push({ path, success: true, data: content });
  } catch (error) {
    results.push({ path, success: false, error: error.message });
  }
}
return results;

Upstream MCP Servers Integration

mcpcodeserver can integrate with official upstream MCP servers from the Model Context Protocol servers repository. This allows you to use real, production-ready MCP servers alongside your custom tools.

Supported Upstream Servers

  • filesystem: File system operations (read, write, list directories)
  • memory: In-memory key-value storage
  • sqlite: SQLite database operations
  • github: GitHub API integration
  • brave-search: Web search capabilities
  • fetch: HTTP request capabilities

Example Configuration

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "/tmp/test.db"]
    }
  }
}

Testing Upstream Integration

The project includes comprehensive tests for upstream server integration:

bash
# Run upstream servers integration tests
bun tests/integration/run-upstream-tests.ts

# Or manually test with upstream config
npx mcpcodeserver --config tests/integration/upstream-test-config.json

Cross-Server Workflows

With upstream servers, you can create powerful cross-server workflows:

typescript
// Store database query results in memory and write to file
const queryResult = await sqlite_execute_sql({
  sql: "SELECT COUNT(*) as count FROM users"
});
const count = queryResult.content[0].text;

await memory_create({
  key: "user-count",
  value: count
});

await filesystem_write_file({
  path: "/tmp/user-count.txt",
  content: `Total users: ${count}`
});

Limitations

  • Execution timeout: Maximum 5 minutes (configurable, default 30 seconds)
  • Memory: Limited by Node.js VM context
  • No persistent state between executions
  • Cannot require/import external modules
  • Not a security sandbox - don't run untrusted code

Contributing

Contributions welcome! This project is built with:

  • TypeScript 5.7+
  • Node.js 18+
  • MCP TypeScript SDK 1.20+
  • Zod for validation

See CONTRIBUTING.md for detailed contribution guidelines.

Support

If you find this project helpful, consider buying me a coffee!

Buy Me A Coffee

License

MIT

Resources

将 mcpcodeserver MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 mcpcodeserver 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 mcpcodeserver 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 mcpcodeserver MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "mcpcodeserver": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 mcpcodeserver MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 mcpcodeserver MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 mcpcodeserver 帮我完成这项任务吗?
mcpcodeserver
当然。我已阅读。
以下是我使用 mcpcodeserver 得到的结果。

常见问题

mcpcodeserver MCP 服务器有什么用途?

mcpcodeserver 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 mcpcodeserver MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 mcpcodeserver,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 mcpcodeserver MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 mcpcodeserver 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 mcpcodeserver MCP 连接到 TypingMind?

mcpcodeserver 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

mcpcodeserver MCP 在 TypingMind 中提供哪些工具?

mcpcodeserver 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 mcpcodeserver MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 mcpcodeserver 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇