sshcode-mcp

sshcode-mcp

An MCP server that enables AI assistants to perform development operations on remote servers via SSH, including executing commands, managing files, and browsing directories.

Category
Visit Server

README

sshcode-mcp

SSH Remote AI Development Tool — 通过 SSH 让 AI 在远程计算机上进行开发操作。

基于 MCP (Model Context Protocol) 标准协议,可作为 opencode、Claude Desktop 等 MCP 客户端的工具服务。

功能

工具 说明
execute_command 在远程服务器执行 shell 命令
read_file 读取远程文件内容
write_file 写入/覆盖远程文件
edit_file 编辑远程文件指定行(按行号)
list_directory 列出远程目录内容
create_directory 创建远程目录
delete_path 删除远程文件/目录
rename_path 重命名/移动远程文件/目录
file_stat 获取远程文件元数据
search_files 在远程服务器搜索文件(glob 模式)
get_system_info 获取远程系统信息
get_pool_stats 获取连接池/缓存统计

快速开始

# 安装依赖
npm install

# 密码认证
node bin/sshcode.js ubuntu@192.168.1.5 -P 123

# 密钥认证
node bin/sshcode.js ubuntu@192.168.1.5 -i ~/.ssh/id_rsa

# 自定义端口
node bin/sshcode.js ubuntu@192.168.1.5 -p 2222 -P 123

环境变量模式(MCP 推荐)

export SSHCODE_HOST=192.168.1.5
export SSHCODE_USER=ubuntu
export SSHCODE_PASSWORD=123
node bin/sshcode.js

配置为 opencode MCP 服务

在 ~/.config/opencode/opencode.jsonc 或项目 .opencode.jsonc 中添加:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sshcode": {
      "type": "local",
      "command": ["node", "/path/to/sshcode_mcp/bin/sshcode.js"],
      "environment": {
        "SSHCODE_HOST": "192.168.1.5",
        "SSHCODE_USER": "ubuntu",
        "SSHCODE_PASSWORD": "123",
        "SSHCODE_PORT": "22"
      },
      "timeout": 15000
    }
  }
}

架构

AI (MCP Client) <-> stdio JSON-RPC <-> sshcode-mcp <-> SSH <-> Remote Server

性能优化

  • 连接池: 复用 SSH 连接(最多 5 个),避免重复握手
  • 文件缓存: LRU 缓存(最多 50 个文件,TTL 60s)
  • 命令超时: 默认 30s,防止长时间卡住
  • 并发控制: 最多 10 个并发命令
  • 输出截断: 超过 10MB 自动截断
  • SFTP 复用: 在同一连接内复用 SFTP 通道
  • ssh 压缩: 强制开启压缩减少带宽

配置

# 查看配置
node bin/sshcode.js config

# 修改配置
node bin/sshcode.js config set pool.maxSize 10
node bin/sshcode.js config set command.defaultTimeout 60000

许可证

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured