模块化MCP服务器

一个具有服务状态监控功能的模块化MCP服务器,易于扩展新工具,适用于开发者和系统管理员。

  • by neerajp926
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 neerajp926/status-mcp-server

使用说明

MCP服务器状态

一个模块化的MCP(模型上下文协议)服务器,配备服务状态监控工具,设计便于通过添加额外工具进行扩展。

特点/特性

  • ✅ 模块化架构易于添加新工具
  • 🔍 看起来像是一个放大镜的符号,通常用于表示搜索、查看细节或调查等动作,但本身没有直接的中文翻译,可以理解为“查看”、“搜索”或“调查”等含义,具体取决于上下文。 服务状态监控获取实时状态信息
  • 🛠️(工具/扳手) 可扩展设计基于模板的工具创建
  • 📦 翻译为中文是:📦(此符号本身无特定含义,通常用于表示包裹或箱子,可直接保留或根据上下文具体描述为“包裹”、“箱子”等) LM Studio 准备就绪预配置以集成LM Studio

快速入门

1. 安装依赖项

cd status-mcp-server
npm install

2. 配置LM Studio

将此配置添加到您的LM Studio MCP设置中:

{
  "mcpServers": {
    "status-mcp-server": {
      "command": "node",
      "args": ["/Users/neeraj/workspace/MCP_SERVER/status-mcp-server/src/index.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

重要的更新路径中的 args 以匹配您的安装位置。

3. 开始使用

重启LM Studio后,您将能够访问 get_service_status 工具。

可用工具

get_service_status

获取MCP服务的当前状态以及可选的系统信息。

参数:

  • include_system_info (布尔值,可选):是否包含详细系统信息

示例:

// Basic status
get_service_status()

// With system info  
get_service_status({ include_system_info: true })

建筑学(或简称为“建筑”)

status-mcp-server/
├── src/
│   ├── index.js           # Main server entry point
│   └── tools/
│       ├── index.js       # Tool registry
│       └── statusTool.js  # Status monitoring tool
├── config/
│   ├── lm-studio-config.json  # LM Studio configuration
│   └── README.md             # Setup instructions
├── examples/
│   └── new-tool-template.js  # Template for new tools
└── package.json

添加新工具

第一步:创建你的工具

使用模板中的(内容/方法) examples/new-tool-template.js:

// src/tools/myNewTool.js
export class MyNewTool {
  constructor() {
    this.name = "my_new_tool";
    this.description = "What my tool does";
    this.inputSchema = {
      type: "object",
      properties: {
        // Define parameters
      }
    };
  }

  async execute(args = {}) {
    // Tool implementation
    return {
      content: [{ type: "text", text: "Result" }]
    };
  }

  getToolDefinition() {
    return {
      name: this.name,
      description: this.description,
      inputSchema: this.inputSchema
    };
  }
}

步骤2:注册您的工具

添加到 src/tools/index.js:

import { MyNewTool } from './myNewTool.js';

export const tools = {
  statusTool: new StatusTool(),
  myNewTool: new MyNewTool()  // Add here
};

步骤3:重启服务器

您的新工具将自动提供给MCP客户端使用。

发展

在开发模式下运行

npm run dev  # Auto-restarts on file changes

手动测试

npm start    # Runs server in stdio mode

扩展思路/想法

  • 过程监控监控运行中的进程
  • 文件系统工具目录列表,文件操作
  • 网络工具端口扫描,连接性检查
  • 数据库工具连接测试,查询执行
  • API 工具HTTP请求,Webhook处理

许可证

麻省理工学院(MIT)