Back to MCP directory
publicPublicdnsLocal runtime

env-mcp

env-mcp 是一个跨平台的系统信息获取工具包,支持通过 MCP 协议获取详细的硬件、软件和网络环境信息。

article

README

🚀 env - mcp 工具包文档

env - mcp 是一款强大的工具包,主要用于获取系统和网络环境信息。它为开发者提供了丰富的功能,能助力开发者迅速获取系统的详细配置与状态信息,提升开发效率。

🚀 快速开始

env - mcp 工具包的使用十分便捷,您只需按照以下步骤操作即可在项目中集成并使用它。

安装工具包

# 安装工具包
npm install env-mcp

# 安装完成后,您可以在项目中使用该工具包

配置 MCP 服务

在您的应用中集成 MCP 服务:

  1. 引入 MCP 客户端:
const mcp = require('env-mcp');
  1. 初始化 MCP 实例:
const mcpClient = new mcp.Client({
  port: process.env.PORT || 3000,
  host: 'localhost'
});

调用示例

获取系统平台信息:

mcpClient.getPlatformInfo((error, result) => {
  if (error) {
    console.error('获取平台信息失败:', error);
  } else {
    console.log('平台信息:', result);
  }
});

✨ 主要特性

  • 获取系统的平台信息
  • 获取内存使用情况
  • 获取 CPU 信息
  • 获取网络接口信息
  • 获取用户信息
  • 获取终端类型
  • 获取 IPv4 和 IPv6 地址信息
  • 获取代理设置
  • 获取 USB 设备信息
  • 获取打印机信息
  • 获取 SSH 公钥
  • 获取 Docker 信息
  • 获取 Node.js 版本信息

💻 使用示例

基础用法

在项目中引入并初始化 env - mcp 后,您可以调用其提供的各种函数来获取系统信息。例如,获取系统平台信息和内存使用情况:

// 引入 MCP 客户端
const mcp = require('env-mcp');
// 初始化 MCP 实例
const mcpClient = new mcp.Client({
  port: process.env.PORT || 3000,
  host: 'localhost'
});

// 获取系统平台信息
mcpClient.getPlatformInfo((error, result) => {
  if (error) {
    console.error('获取平台信息失败:', error);
  } else {
    console.log('平台信息:', result);
  }
});

// 获取内存使用情况
mcpClient.getMemoryUsage((error, result) => {
  if (error) {
    console.error('获取内存使用情况失败:', error);
  } else {
    console.log('内存使用情况:', result);
  }
});

📚 详细文档

工具列表及功能描述

获取系统平台信息

  • 函数: getPlatformInfo()
  • 返回值:
{
  platform: string,
  arch: string,
  hostname: string,
  type: string,
  release: string,
  version: string
}

获取内存使用情况

  • 函数: getMemoryUsage()
  • 返回值:
{
  totalMemory: number,
  freeMemory: number,
  usedMemory: number
}

🔧 技术细节

开发指南

# 安装项目依赖
npm install

# 启动开发服务器(支持自动重启)
npm run dev

# 构建生产环境包
npm run build

# 启动构建后的应用
npm start

环境变量配置

通过 .env 文件配置运行时参数:

  • PORT: 服务监听的端口号,默认为 3000。
  • NODE_ENV: 运行环境模式,可选值为 development 或 production。

📄 许可证

本项目遵循 ISC 许可证协议。

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