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-rancher-log

v0.1.0

Published

MCP server for viewing Rancher pod logs

Downloads

111

Readme

mcp-rancher-log

查看 Rancher 集群中 Pod 日志的 MCP Server。

通过 Rancher 用户名和密码登录,支持按项目名搜索 Pod 并查看日志,可限制允许查询的命名空间。

功能

| Tool | 说明 | |------|------| | list_clusters | 列出所有集群 | | list_namespaces | 列出命名空间(dev/test/pre/prod 等环境) | | list_pods | 列出指定命名空间中的 Pod | | search_pods | 按关键词搜索 Pod | | get_pod_logs | 获取 Pod 日志(支持指定容器、行数、时间范围) | | get_pod_detail | 获取 Pod 详细信息 | | list_deployments | 列出 Deployment | | get_project_logs | 按项目名快捷获取日志(自动搜索 Pod) |

安装

cd mcp-rancher-log
uv venv && source .venv/bin/activate
uv pip install -e .

配置

环境变量

| 变量 | 说明 | 默认 | |------|------|------| | RANCHER_URL | Rancher 地址 | 必填 | | RANCHER_USERNAME | 登录用户名 | 必填 | | RANCHER_PASSWORD | 登录密码 | 必填 | | RANCHER_VERIFY_SSL | 是否验证 SSL 证书 | false | | RANCHER_NAMESPACES | 允许查询的命名空间,逗号分隔。留空则不限制 | 空(不限制) |

命名空间限制示例:

  • RANCHER_NAMESPACES=dev — 只能查 dev 环境
  • RANCHER_NAMESPACES=dev,test,pre — 只能查 dev、test、pre 三个环境
  • RANCHER_NAMESPACES= 或不设置 — 不限制,可查所有命名空间

VS Code / Copilot 配置

~/.vscode/mcp.json~/Library/Application Support/Code/User/mcp.json 中添加:

{
  "servers": {
    "rancher-log": {
      "type": "stdio",
      "command": "python",
      "args": ["-m", "mcp_rancher_log"],
      "env": {
        "RANCHER_URL": "https://rancher.example.com",
        "RANCHER_USERNAME": "your-username",
        "RANCHER_PASSWORD": "your-password",
        "RANCHER_VERIFY_SSL": "false",
        "RANCHER_NAMESPACES": "dev,test,pre"
      }
    }
  }
}

Cursor 配置

.cursor/mcp.json 中添加:

{
  "mcpServers": {
    "rancher-log": {
      "command": "python",
      "args": ["-m", "mcp_rancher_log"],
      "env": {
        "RANCHER_URL": "https://rancher.example.com",
        "RANCHER_USERNAME": "your-username",
        "RANCHER_PASSWORD": "your-password",
        "RANCHER_VERIFY_SSL": "false",
        "RANCHER_NAMESPACES": "dev,test,pre"
      }
    }
  }
}

使用示例

配置好 MCP 后,可以直接对话:

  • "查看 dev 环境 my-project 项目的日志"
  • "搜索 dev 命名空间中包含 my-service 的 Pod"
  • "获取 Pod my-app-jdk17-xxx 最近 5 分钟的日志"
  • "列出 test 环境的所有 Pod"

License

MIT