主机Ping工具

一个用于ping主机并返回结果的工具,主要用于演示FastMCP的使用。

  • by punkpeye
  • TypeScript
  • 本地部署
  • 12 星标
  • 更新于
在 GitHub 查看 punkpeye/mcp-ping

使用说明

MCP Ping

ping主机并返回结果。

[!注意] 此MCP服务器主要用于 展示 如何使用 FastMCP.

用法

mcp-ping

配置

服务器支持以下环境变量:

名称 描述
HTTP_PROXY 要使用的HTTP代理的URL(可选)

MCP服务器配置文件

{
  "prompts": [],
  "resources": [],
  "tools": [
    {
      "annotations": {
        "openWorldHint": false,
        "readOnlyHint": true,
        "title": "Ping"
      },
      "description": "Pings a host and returns the result",
      "inputSchema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false,
        "properties": {
          "host": {
            "description": "The hostname or URL to ping (e.g., 'google.com' or 'https://google.com')",
            "type": "string"
          }
        },
        "required": ["host"],
        "type": "object"
      },
      "name": "ping"
    }
  ]
}

工具

ping 工具示例响应

Ping results for glama.ai:

PING glama.ai (37.16.29.120): 56 data bytes
64 bytes from 37.16.29.120: icmp_seq=0 ttl=55 time=11.273 ms
64 bytes from 37.16.29.120: icmp_seq=1 ttl=55 time=11.353 ms
64 bytes from 37.16.29.120: icmp_seq=2 ttl=55 time=11.455 ms
64 bytes from 37.16.29.120: icmp_seq=3 ttl=55 time=12.634 ms

--- glama.ai ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 11.273/11.679/12.634/0.555 ms

测试

npm run test