返回市场
curl服务器

curl服务器

作者:mcp-get64 星标更新:2024-12-05

项目介绍

@mcp-get-community/server-curl

一个允许大型语言模型使用类似curl的接口向任何URL发起HTTP请求的MCP服务器。

特性

  • 向任何URL发起HTTP请求
  • 支持所有常见的HTTP方法(GET、POST、PUT、DELETE、PATCH、HEAD、OPTIONS)
  • 可自定义的头部信息和请求体
  • 可配置的超时时间
  • 包含状态码、头部信息和响应体在内的完整响应信息

安装

npx @michaellatman/mcp-get@latest install @mcp-get-community/server-curl

使用

{
  "mcpServers": {
    "@mcp-get-community/server-curl": {
      "runtime": "node",
      "command": "npx",
      "args": [
        "-y",
        "@mcp-get-community/server-curl"
      ]
    }
  }
}

该服务器提供了一个名为curl的单一工具,接受以下参数:

  • url(必需):要发起请求的URL
  • method(可选):使用的HTTP方法(默认:'GET')
  • headers(可选):包含HTTP头部的对象
  • body(可选):POST/PUT/PATCH请求的请求体
  • timeout(可选):请求超时时间,以毫秒为单位(默认:30000,最大:300000)

示例请求

{
  "url": "https://api.example.com/data",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer token123"
  },
  "body": "{\"key\": \"value\"}",
  "timeout": 5000
}

示例响应

{
  "status": 200,
  "statusText": "OK",
  "headers": {
    "content-type": "application/json",
    "server": "nginx"
  },
  "body": "{\"result\": \"success\"}"
}

开发

# 安装依赖
npm install

# 构建项目
npm run build

# 在开发模式下运行
npm run dev

许可证

MIT