Skip to main content
Glama

JavaScript MCP Server

by yannbam

JavaScript MCP 服务器 (js-mcp)

模型上下文协议 (MCP) 服务器允许 AI 助手使用有状态的 REPL 会话执行 JavaScript 代码。

特征

核心功能

  • 一次性 JavaScript 执行:直接在 Node.js 中执行 JavaScript 代码
  • 有状态 REPL 会话:在多次执行中维护变量和上下文
  • 文件系统操作:读取、写入和操作文件
  • 包管理:导入模块并管理 npm 包

高级功能

  • 安全沙盒执行
  • 异步代码支持
  • 使用格式化的堆栈跟踪进行错误处理
  • 具有自动清理功能的会话管理

安装

# Clone the repository git clone https://github.com/yourusername/js-mcp.git cd js-mcp # Install dependencies npm install # Build the project npm run build

用法

使用 stdio 传输运行(用于 Claude Desktop)

npm start # or node dist/index.js --stdio

使用 HTTP 传输运行

node dist/index.js --http # Default port is 3000, or specify with PORT environment variable PORT=3456 node dist/index.js --http

可用工具

JavaScript 执行

  • 执行javascript :在基本沙箱中运行JavaScript代码
  • 执行javascript_with_modules :通过模块导入运行JavaScript
  • execute_javascript_async :运行异步 JavaScript 代码

REPL 会话

  • repl_create_session :创建一个新的 REPL 会话
  • repl_execute :在 REPL 会话中执行代码
  • repl_get_context :获取会话中的变量值
  • repl_delete_session :删除会话
  • repl_list_sessions :列出所有活动会话

文件操作

  • file_read :读取文件内容
  • file_write :将内容写入文件
  • file_list :列出目录中的文件
  • file_delete :删除文件或目录
  • file_exists :检查文件是否存在

包管理

  • package_check :检查模块是否可用
  • package_install :安装 npm 包
  • package_list :列出已安装的软件包

安全

服务器使用具有安全功能的直接 JavaScript 执行:

  • 代码执行的超时限制
  • 文件系统访问仅限于工作目录
  • 路径验证以防止危险操作

配置

通过设置环境变量来配置服务器:

  • PORT :HTTP 服务器端口(默认值:3000)
  • WORKING_DIRECTORY :文件操作的基本目录(默认值:当前目录)
  • SESSION_TIMEOUT :REPL 会话超时(分钟)(默认值:30)

发展

# Start in development mode npm run dev # Run tests npm test # Lint code npm run lint # Format code npm run format

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

一种服务器,使 AI 助手能够通过有状态的 REPL 会话、文件操作和包管理功能执行具有持久上下文的 JavaScript 代码。

  1. 特征
    1. 核心功能
    2. 高级功能
  2. 安装
    1. 用法
      1. 使用 stdio 传输运行(用于 Claude Desktop)
      2. 使用 HTTP 传输运行
    2. 可用工具
      1. JavaScript 执行
      2. REPL 会话
      3. 文件操作
      4. 包管理
    3. 安全
      1. 配置
        1. 发展
          1. 执照

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              The sessionless code interpreter. Securely run AI-generated code in stateful sandboxes that run forever.
              Last updated -
              65
              176
              Rust
              MIT License
            • A
              security
              A
              license
              A
              quality
              A server that enhances AI assistants with the ability to update your JSON Resume by analyzing your coding projects, automatically extracting skills and generating professional descriptions.
              Last updated -
              3
              32
              39
              TypeScript
              The Unlicense
              • Apple
              • Linux
            • -
              security
              A
              license
              -
              quality
              A server that enables AI assistants to understand and interact with Unity projects in real-time, providing access to scene hierarchy, project settings, and the ability to execute code directly in the Unity Editor.
              Last updated -
              40
              MIT License
              • Linux
              • Apple
            • -
              security
              F
              license
              -
              quality
              A web browser automation server that allows AI assistants to control Chrome with persistent state management, enabling complex browsing tasks through asynchronous browser operations.
              Last updated -
              1
              Python
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/yannbam/js-mcp'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server