MCP服务器集合

一个为Claude和AI代理提供的Model Context Protocol(MCP)服务器集合,包含文件系统访问、网页搜索、计算、天气数据和HTTP请求等常见集成功能。

  • by gabubu-dev
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 gabubu-dev/mcp-server-collection

使用说明

MCP服务器集合

为Claude和AI代理精心策划的模型上下文协议(MCP)服务器集合。此存储库提供了即用型MCP服务器,用于常见的集成,包括文件系统访问、web搜索、计算、天气数据和HTTP请求。

特性

  • 文件系统服务器:安全地读取、写入和列出配置目录中的文件
  • Web搜索服务器:使用Brave Search API搜索网页
  • 计算器服务器:进行数学计算和评估
  • 天气服务器:获取任何位置的当前天气数据
  • HTTP客户端服务器:向外部API发出HTTP请求(GET、POST、PUT、DELETE)

安装

npm install
npm run build

配置

复制 .env.example 到 .env 并配置所需的API密钥和设置:

cp .env.example .env

编辑 .env 根据您的具体配置:

  • BRAVE_SEARCH_API_KEY:web搜索服务器需要
  • OPENWEATHER_API_KEY:天气服务器需要
  • FS_ALLOWED_PATHS:文件系统服务器允许的目录列表,以逗号分隔
  • 其他特定于服务器的设置

用法

运行单个服务器

每个服务器都可以通过stdio传输独立运行(用于Claude Desktop或其他MCP客户端):

# File System Server
node dist/servers/filesystem/index.js

# Web Search Server
node dist/servers/search/index.js

# Calculator Server
node dist/servers/calculator/index.js

# Weather Server
node dist/servers/weather/index.js

# HTTP Client Server
node dist/servers/http/index.js

Claude桌面配置

将服务器添加到Claude Desktop配置文件中(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):

{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": ["/path/to/mcp-server-collection/dist/servers/filesystem/index.js"],
      "env": {
        "FS_ALLOWED_PATHS": "/home/user/documents,/home/user/projects"
      }
    },
    "search": {
      "command": "node",
      "args": ["/path/to/mcp-server-collection/dist/servers/search/index.js"],
      "env": {
        "BRAVE_SEARCH_API_KEY": "your_api_key"
      }
    },
    "calculator": {
      "command": "node",
      "args": ["/path/to/mcp-server-collection/dist/servers/calculator/index.js"]
    },
    "weather": {
      "command": "node",
      "args": ["/path/to/mcp-server-collection/dist/servers/weather/index.js"],
      "env": {
        "OPENWEATHER_API_KEY": "your_api_key"
      }
    },
    "http": {
      "command": "node",
      "args": ["/path/to/mcp-server-collection/dist/servers/http/index.js"]
    }
  }
}

建筑

每个服务器都包含在其自己的目录中 src/servers/:

src/
├── servers/
│   ├── filesystem/     # File system operations
│   ├── search/         # Web search via Brave API
│   ├── calculator/     # Math calculations
│   ├── weather/        # Weather data via OpenWeather API
│   └── http/           # HTTP client for API requests
├── shared/             # Shared utilities and types
└── index.ts            # Main entry point

每个服务器都使用官方 @modelcontextprotocol/sdk 包裹。

发展

# Build all servers
npm run build

# Watch mode for development
npm run build:watch

# Run tests
npm test

# Lint code
npm run lint

# Format code
npm run format

可用工具

文件系统服务器

  • read_file:读取文件内容
  • write_file:将内容写入文件
  • list_directory:列出文件和目录
  • create_directory:创建新目录
  • delete_file:删除文件

Web搜索服务器

  • web_search:搜索网络,获得标题、网址和片段的热门结果

计算器服务器

  • calculate:计算数学表达式(支持+、-、*、/、^、sqrt、sin、cos、tan、log等)
  • convert_units:在常用单位(长度、重量、温度)之间转换

天气服务器

  • get_weather:获取某个地点的当前天气
  • get_forecast:获取未来几天的天气预报

HTTP客户端服务器

  • http_request:使用标头和正文发出HTTP请求(GET、POST、PUT、DELETE)

安全

  • 文件系统服务器仅限制对配置的允许路径的访问
  • 所有API密钥都应该保持安全,并且永远不要致力于版本控制
  • HTTP请求具有可配置的超时和速率限制

贡献

欢迎投稿!请随时提交拉取请求。

  1. 克隆该仓库
  2. 创建功能分支(git checkout -b feat/amazing-server)
  3. 提交您的更改(git commit -m 'feat: add amazing server')
  4. 推到分支(git push origin feat/amazing-server)
  5. 打开拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件

致谢

使用官方 模型上下文协议SDK.