Skip to main content
Glama
simple-MCP

simple-MCP

by ygdcz

simple-MCP

一个最小的 MCP (Model Context Protocol) server 示例,通过 stdio 暴露一个查询本机硬件信息的工具。

依赖

  • Python >= 3.13

  • uv

Related MCP server: mcpscope

安装

uv sync

运行

uv run main.py

server 以 stdio 传输方式启动,等待 MCP 客户端连接。

工具

get_host_info

无参数,返回结构化的主机信息:

字段

类型

说明

system

string

操作系统名称,如 Darwin / Linux / Windows

release

string

内核版本号

machine

string

CPU 架构,如 x86_64 / arm64

processor

string

处理器标识,部分平台可能为空

memory_gb

number

物理内存总量,单位 GB

cpu_count

integer

逻辑核心数,无法探测时为 -1

cpu_model

string

CPU 型号名称,无法探测时为 Unknown

返回类型是 pydantic model HostInfo,MCP 会据此生成自描述的 output schema,客户端无需解析字符串。

CPU 型号按平台探测:macOS 用 sysctl machdep.cpu.brand_string,Linux 读 /proc/cpuinfo,Windows 读 PROCESSOR_IDENTIFIER,全部失败时回退到 platform 模块。

客户端配置

{
  "mcpServers": {
    "hostInfoMcp": {
      "command": "uv",
      "args": ["--directory", "/path/to/simple-MCP", "run", "main.py"]
    }
  }
}

本地验证

uv run tools.py    # 直接打印主机信息 JSON

Available Tools

1 tool
get_host_infoA

获取本机硬件与操作系统信息。

返回 system(系统名)、release(内核版本)、machine(架构)、 processor(处理器标识)、memory_gb(总内存 GB)、 cpu_count(逻辑核心数)、cpu_model(CPU 型号)。

Inputs: no named parameters. Returns: 主机硬件与操作系统信息。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of confusion with other tools. The tool's purpose is clearly defined.

    Naming Consistency5/5

    The single tool follows a clear verb_noun pattern (get_host_info), which is consistent and descriptive.

    Tool Count3/5

    One tool is on the low end, but given the server's name 'simple-MCP', it is reasonable for a focused purpose. However, it is borderline for general utility.

    Completeness5/5

    The tool returns comprehensive host hardware and OS information (system, kernel, architecture, processor, memory, CPU), covering the domain well with no obvious gaps.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that publishes CLI tools on your machine for discoverability by LLMs
      7 npm
      1
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      A simple local MCP server that provides greeting and integer addition tools.
      2
      -
    • F
      license
      A
      quality
      D
      maintenance
      Lightweight MCP server that exposes tools for system information and weather lookup, designed for agent integration via stdio.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      A minimal MCP server that provides a single 'hello' tool returning 'Hello, world!'.
      2
      9 npm
      MIT