npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-log-query-server

v3.7.0

Published

MCP Server for querying server logs via SSH jump host and Grafana Loki API

Downloads

1,496

Readme

Log Query MCP Server

通过 SSH 堡垒机查询 Kubernetes 容器日志的 MCP Server。

功能

  • query_log: 查询服务容器的最近日志
  • search_log: 在日志中搜索关键词
  • list_services: 列出可用服务
  • test_connection: 测试 SSH 连接

安装

cd mcp-log-query
npm install

配置

1. 修改服务器配置

编辑 config.js 文件,配置:

  • JUMP_HOST: 堡垒机连接信息
  • K8S_SERVER: K8s 服务器信息
  • SERVICES: 服务/容器映射

2. 添加到 VSCode MCP 配置

在 VSCode 设置中添加 MCP Server 配置:

方式一:settings.json

{
  "augment.advanced": {
    "mcpServers": [
      {
        "name": "log-query",
        "command": "node",
        "args": ["D:/project/main/aug2api-master/mcp-log-query/index.js"],
        "env": {}
      }
    ]
  }
}

方式二:mcp.json

在项目根目录创建 .augment/mcp.json

{
  "mcpServers": {
    "log-query": {
      "command": "node",
      "args": ["./mcp-log-query/index.js"]
    }
  }
}

使用示例

查询日志

帮我查一下 clife-senior-health 的最近 200 行日志

AI 会调用:

{
  "tool": "query_log",
  "arguments": {
    "service": "clife-senior-health",
    "lines": 200
  }
}

搜索错误

搜索 health 服务的 error 日志

AI 会调用:

{
  "tool": "search_log",
  "arguments": {
    "service": "health",
    "keyword": "error"
  }
}

列出服务

有哪些服务可以查日志?

AI 会调用:

{
  "tool": "list_services",
  "arguments": {}
}

添加新服务

config.jsSERVICES 对象中添加:

'new-service': {
  name: 'new-service',
  description: '新服务描述',
  namespace: 'saas-itest',
  podPattern: 'new-service-app',
  logPath: '/www/logs/new-service-app/normal_logs/',
  aliases: ['new', '新服务']
}

故障排除

连接超时

  1. 检查网络是否能访问堡垒机
  2. 确认堡垒机账号密码正确
  3. 增加 DEFAULTS.connectTimeout

命令执行失败

  1. 确认 K8s 服务器 IP 正确
  2. 确认 Pod 名称模式正确
  3. 确认日志路径存在

调试模式

运行时查看 stderr 输出:

node index.js 2>&1