HM

hetparekh21/mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

0 stars 0 forks Качество 43 Тренд 0

A lightweight MCP server (sysmon) and a TypeScript MCP client (mcp-client) that demonstrate integrating local LLMs (via an OpenAI-compatible client) with a set of system and weather tools.

Обзор

A lightweight MCP server (sysmon) and a TypeScript MCP client (mcp-client) that demonstrate integrating local LLMs (via an OpenAI-compatible client) with a set of system and weather tools. The server exposes tools over the MCP protocol and the client connects to a running MCP server over stdio, forwards LLM requests to a local LLM endpoint, and executes tool calls via the MCP SDK. : Example / demo code. Use for experimentation and extension. - : An MCP server that registers system- and weather-related tools. - : A TypeScript MCP client that connects to a server, talks to a local LLM (OpenAI-compatible API), and orchestrates tool calls. : @modelcontextprotocol/sdk, openai (client configured for local LLM), systeminformation, zod, dotenv. - The sysmon server registers the following tools (see sysmon/src/tools): - get-system-info — CPU, RAM, and network stats using systeminformation. - list-processes — list running processes. - kill-process — terminate a process by PID.

README

Показан фрагмент оригинального README. Открыть оригинал.

MCP (Model Context Protocol) — sysmon + mcp-client

A lightweight MCP server (sysmon) and a TypeScript MCP client (mcp-client) that demonstrate integrating local LLMs (via an OpenAI-compatible client) with a set of system and weather tools. The server exposes tools over the MCP protocol and the client connects to a running MCP server over stdio, forwards LLM requests to a local LLM endpoint, and executes tool calls via the MCP SDK.

Status: Example / demo code. Use for experimentation and extension.

Contents

  • sysmon/: An MCP server that registers system- and weather-related tools.
  • mcp-client/: A TypeScript MCP client that connects to a server, talks to a local LLM (OpenAI-compatible API), and orchestrates tool calls.

Key dependencies: @modelcontextprotocol/sdk, openai (client configured for local LLM), systeminformation, zod, dotenv.

Quick overview

  • The sysmon server registers the following tools (see sysmon/src/tools):
    • get-system-info — CPU, RAM, and network stats using systeminformation.
    • list-processes — list running processes.
    • kill-process — terminate a process by PID.
    • get-alerts — fetch active weather alerts for a US state (NWS API).
    • get-forecast — fetch forecast for latitude/longitude (NWS API).
  • The mcp-client connects to a running MCP server (stdio transport), calls an LLM via an OpenAI-compatible client configured to a local LLM endpoint, and maps model function/tool calls to MCP tool invocations.

Requirements

  • Node.js (v18+ recommended)
  • npm or yarn
  • A local LLM endpoint compatible with the openai client (an HTTP endpoint that accepts the OpenAI-like chat completion surface). Set LLM_BASE_URL to point at it.

Environment variables

Create a .env file at the repository root or in mcp-client when running the client. Important env vars used by the client:

LLM_BASE_URL=http://localhost:11434/   # required — local LLM endpoint
API_KEY=sk-local-llm                     # optional — API key for local LLM
LLM_MODEL=llama3.1                       # optional — model name passed to the LLM
SYSTEM_PROMPT=                            # optional — additional system prompt content
LOG_FILE=mcp-client.log                  # optional — client log file

The server (sysmon) writes tool usage logs to logs/tool-usage.log in the repository working directory.

Build & Run

  1. Install dependencies at the repo root or per-package
# from repo root
cd sysmon
npm install
npm run build

cd ../mcp-client
npm install
npm run build
  1. Run the server (stdio transport) — this starts the MCP server which communicates over STDIO:
# from repo root
node sysmon/build/index.js
# or if installed globally via the package's bin: ./sysmon/build/index.js
  1. Run the client and point it to the server script you want to spawn/connect to (the client expects a server script path):
cd mcp-client
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →