Skip to main content
Glama
dhks77
by dhks77

NHN Server MCP

这是一个通过 SSH 网关连接服务器并执行命令的 MCP (Model Context Protocol) 服务器。

功能

  • 通过 SSH 网关连接服务器

  • 支持 Kerberos 认证 (kinit)

  • 使用 macOS 原生对话框确认命令执行

  • “始终允许”选项可自动批准相同命令

  • 服务器信息查询(AI 可查看日志路径等)

  • 通过网关进行 SCP 文件上传/下载

  • 远程命令超时机制,防止进程挂起

  • 动态重新加载配置

安装

npm install
npm run build

配置

1. 创建 config.json

{
  "gatewayConnection": "user@gateway.example.com:22",
  "gatewayPassword": "your-password",
  "kinitPassword": "your-kerberos-password",
  "allowedHosts": ["server1", "server2"],
  "confirmDialog": true,
  "serverInfo": {
    "서버에 대한 user 정보 필수": "exec 할때 user 를 같이 보냅니다.",
    "나머지는": "원하는 내용으로",
    "ex - logPaths": {
      "app": "/var/log/app.log",
      "nginx": "/var/log/nginx/access.log"
    }
  }
}

2. 客户端配置

Claude Code (CLI)

通过 CLI 命令注册:

# 프로젝트 단위 (해당 프로젝트에서만 사용)
claude mcp add --scope project nhn-server -e CONFIG_FILE=/path/to/config.json -e DEBUG=false -- node /path/to/nhn-server-mcp/dist/index.js

# 글로벌 (모든 프로젝트에서 사용)
claude mcp add --scope user nhn-server -e CONFIG_FILE=/path/to/config.json -e DEBUG=false -- node /path/to/nhn-server-mcp/dist/index.js

或者也可以直接编辑配置文件。

项目级 — 在项目根目录创建 .mcp.json

{
  "mcpServers": {
    "nhn-server": {
      "command": "node",
      "args": ["/path/to/nhn-server-mcp/dist/index.js"],
      "env": {
        "CONFIG_FILE": "/path/to/config.json",
        "DEBUG": "false"
      }
    }
  }
}

全局 — 添加到 ~/.claude.json

{
  "mcpServers": {
    "nhn-server": {
      "command": "node",
      "args": ["/path/to/nhn-server-mcp/dist/index.js"],
      "env": {
        "CONFIG_FILE": "/path/to/config.json",
        "DEBUG": "false"
      }
    }
  }
}

.mcp.json — 仅在当前项目中使用。提交到 git 后可与团队成员共享(注意:config.json 路径在各人机器上可能不同)

~/.claude.json — 在所有项目中使用。用于个人环境配置

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "nhn-server": {
      "command": "node",
      "args": ["/path/to/nhn-server-mcp/dist/index.js"],
      "env": {
        "CONFIG_FILE": "/path/to/config.json",
        "DEBUG": "false"
      }
    }
  }
}

配置选项

说明

默认值

gatewayConnection

网关 SSH 连接 (user@host:port)

-

gatewayPassword

网关 SSH 密码

-

kinitPassword

Kerberos 认证密码

-

allowedHosts

允许连接的主机列表

[] (全部允许)

confirmDialog

命令执行前显示确认对话框

true

serverInfo

暴露给 AI 的服务器信息

{}

commandTimeoutSec

远程命令超时(秒)。使用 GNU timeout 包装

300

环境变量

变量

说明

CONFIG_FILE

config.json 文件路径

DEBUG

启用调试日志 (true/false)

MCP 工具

exec

在服务器上执行命令。

{
  "host": "server-hostname",
  "user": "appuser",
  "command": "tail -100 /var/log/app.log"
}

如果启用了 confirmDialog,将显示 macOS 原生对话框:

  • 取消: 不执行命令

  • 确认: 仅执行本次

  • 始终允许: 执行 + 后续相同命令无需确认(会话结束时重置)

get_config

查询服务器配置信息。(允许的主机、服务器信息)

reload_config

重新加载配置文件。

disconnect_server

断开网关连接。

connection_status

检查当前连接状态。

scp_upload

将文件内容上传到服务器。(通过网关 SCP)

{
  "host": "server-hostname",
  "user": "appuser",
  "remotePath": "/path/to/remote/file.txt",
  "content": "파일 내용"
}

scp_download

从服务器下载文件。(通过网关 SCP)

{
  "host": "server-hostname",
  "user": "appuser",
  "remotePath": "/path/to/remote/file.txt",
  "localPath": "/path/to/local/file.txt"
}
  • 指定 localPath 时保存为本地文件

  • 未指定 localPath 时仅返回文件内容

安全性

  • config.json 包含敏感信息(密码),请勿提交到 git

  • 通过 confirmDialog 在执行命令前获取用户确认

  • 通过 allowedHosts 限制可连接的服务器

  • 5 分钟不活动后自动断开连接

  • 发生异常时自动清理会话

许可证

MIT

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - A tier

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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/dhks77/nhn-server-mcp'

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