网络工具MCP服务器

一个基于STDIO的最小化高质量模型上下文协议(MCP)服务器,为LLM/代理或CLI客户端提供经典网络工具。

  • by Hoysal-25
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 hoysal-25/network_utility_mcp_server

使用说明

网络实用程序MCP服务器

极简、高品质 模型上下文协议(MCP) 服务器已关闭 标准输入输出 它为 LLM/代理人 或a CLI客户端:

  • 🔌 端口检查 (telnet风格)-验证主机端口是打开还是关闭
  • 🌐 域名解析 (nslookup样式)–A、AAAA、CNAME、MX、TXT、NS、SOA、任意

内置于 Node.js+TypeScript,与 零运行时依赖关系. 实现 JSON-RPC 2.0 通过stdio对MCP友好。 包括一个小型演示CLI客户端。

🚀 快速开始

bash

1) 安装依赖项

npm安装

2) 构建TypeScript

npm运行构建

3) 启动MCP服务器(在stdio上监听)

npm启动

  • 服务器日志→ 标准错误
  • JSON-RPC通信→ stdin/stdout

🧪 演示(无需代理)

运行服务器并使用内置的演示客户端进行测试: bash

终端1:启动服务器

npm运行开发

终端2:运行演示客户端

npm运行演示 或者使用附带的示例发送单个请求: bash

示例:检查端口

node-dist/mcpServer.js<示例/请求/端口检查.json

示例:DNS A记录

node dist/mcpServer.js<示例/请求/dnsA.json

📡 JSON-RPC方法

net.checkPort

检查给定主机上的TCP端口是否打开。

参数:

数据 {“host”:“example.com”,“port”:80,“timeoutMs”:2000}

答复:

数据 {“jsonrpc”:“2.0”,“id”:1,“result”:{“open”:true}

dns.lookup

解析主机的DNS记录。

参数:

{ "host": "example.com", "type": "A" }


**Response:**

json
{ "jsonrpc": "2.0", "id": 2, "result": ["93.184.216.34"] }

Supported record types: `A`, `AAAA`, `CNAME`, `MX`, `TXT`, `NS`, `SOA`, `ANY`

 📂 Project Structure

src/
  mcpServer.ts         # JSON-RPC over stdio server
  utils/
    portCheck.ts       # host:port checker
    dnsLookup.ts       # DNS resolver
  cli/
    demoClient.ts      # interactive CLI to test the server
examples/
  requests/            # sample JSON-RPC requests

🤝 Contributing

1. Fork the repo
2. Create a feature branch (`git checkout -b feature/my-feature`)
3. Commit changes (`git commit -m 'Add new feature'`)
4. Push to your branch (`git push origin feature/my-feature`)
5. Open a Pull Request 🎉