Back to MCP directory
publicPublicdnsLocal runtime

mcp-commands

一个基于Ruby on Rails的微服务命令协议(MCP)服务器,提供文件操作功能,特别是文件合并服务。

article

README

🚀 MCP 命令行服务

MCP 命令行服务是一个基于 Ruby on Rails 的应用程序,它提供了文件操作命令的微服务命令协议(MCP)服务器,能高效处理文件拼接等操作。

🚀 快速开始

先决条件

  • Ruby(版本由 .ruby-version 指定)
  • Rails
  • Bundler

安装步骤

  1. 克隆仓库:
git clone https://github.com/yourusername/mcp-commands.git
cd mcp-commands
  1. 安装依赖项:
bundle install
  1. 配置数据库:
rails db:create db:migrate

启动服务器

运行 Rails 服务器:

rails server

✨ 主要特性

  • 文件拼接命令
  • RESTful API 接口
  • 使用 RSpec 和 FakeFS 进行全面测试覆盖

💻 使用示例

基础用法

拼接文件

将多个文件拼接到一个输出文件中。 接口地址: POST /mcp/concatenate 请求体格式:

{
  "files": ["/path/to/file1.txt", "/path/to/file2.txt"],
  "output_path": "/path/to/output.txt"
}

响应内容:

{
  "success": true,
  "output_path": "/path/to/output.txt"
}

📚 详细文档

API 文档

拼接文件

将多个文件拼接到一个输出文件中。 接口地址: POST /mcp/concatenate 请求体格式:

{
  "files": ["/path/to/file1.txt", "/path/to/file2.txt"],
  "output_path": "/path/to/output.txt"
}

响应内容:

{
  "success": true,
  "output_path": "/path/to/output.txt"
}

🔧 技术细节

本项目使用 RSpec 和 FakeFS 进行全面测试覆盖,保证代码质量和功能的稳定性。

📄 许可证

本项目在 MIT 许可证下开源,详细信息请查看 LICENSE 文件。

贡献指南

  1. 叉取仓库
  2. 创建功能分支(git checkout -b feature/amazing-feature
  3. 提交更改(git commit -m 'Add some amazing feature'
  4. 推送到分支(git push origin feature/amazing-feature
  5. 提交拉取请求

测试

运行测试套件:

bundle exec rspec
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client