Logmcp

io.github.kascada由 GitHub 账号 kascada 发布v0.7.7更新于 Oct 25, 2026

MCP server — read-only log access for AI assistants, without giving AI shell access.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

一个本地 MCP 服务器,让 AI 助手以只读、令牌认证的方式访问 Linux 服务器上的日志文件和 systemd journal,无需 shell 权限。

可以做什么
列出服务器配置为可访问的日志文件(包括作为虚拟日志源的 journald),并显示文件大小、行数和最后修改时间等元数据。按头部、尾部、偏移量或时间窗口读取日志行,并按正则表达式搜索日志,可附带上下文行和时间过滤。执行服务器端健康检查(配置、TLS、白名单、syslog),并显示当前配置以及 MCP 层和已注册扩展的运行状态。使用通过扩展接入的额外工具,这些扩展可包装外部 CLI 程序或基于 Redis 的 worker,也可使用 YAML 定义的组合宏工具。
适用场景
适合需要对 Linux 服务器日志进行 AI 辅助排障、但不想给助手 SSH 或 shell 权限的场景,例如生产服务器、客户机器或强调最小权限的加固环境。
运行要求
作为本地进程运行在用户机器上(仅桌面端),连接 Linux 主机上的 LogMCP 服务器。服务器端需要 logmcp 二进制或 .deb 包、bearer 令牌,以及 TLS(自签名、自定义证书或置于反向代理之后)或 SSH 隧道。访问日志文件需要属于 adm 或 systemd-journal 等用户组;配置位于 YAML 文件中,可引用环境变量。
安装前请注意
服务器保存控制客户端访问的 bearer 令牌;quickstart 生成的令牌和证书是临时的,令牌每次启动都会变化。扩展可将任意外部程序暴露为工具,传入的 bearer 令牌会被转发给扩展,启用前应审查扩展。访问会通过 syslog 审计,但审计记录不包含日志内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Logmcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

LogMCP

[License: MIT] [logmcp MCP server]

MCP server — read-only log access for AI assistants. Debug your Linux server with AI, without giving the AI shell access.

No SSH. No write permissions. The AI reads your logs over HTTPS and helps you diagnose problems, while your server stays fully under your control.

LogMCP is an open-source MCP server that exposes log files on a remote Linux server to AI assistants (Claude Code, VS Code, Claude Desktop). Access is read-only, token-authenticated, and fully audited via syslog.

Get Started

Option A: Quickstart (no root required)

Try LogMCP in under a minute — no config file, no root, no systemd:

sh
logmcp quickstart

The command checks your group memberships (adm, systemd-journal), generates a bearer token and a self-signed TLS certificate, starts the server, and prints a ready-to-paste claude mcp add command.

Running as root? Pass --user <name> and LogMCP will add the user to the required groups and re-launch as that user — root is not needed for future starts.

Note: Token and certificate are ephemeral. The token changes on every start. For a permanent setup use Option B.

sh
logmcp quickstart --port 7789 --token mytoken   # optional flags

After testing, remove the server from Claude Code:

sh
claude mcp remove logmcp-quickstart

Option B: Permanent installation (recommended)

1. Install

sh
go install github.com/kascada/logmcp@latest

Or install the pre-built .deb (replace x.y.z with the latest version):

sh
curl -LO https://github.com/kascada/logmcp/releases/download/vx.y.z/logmcp_x.y.z_amd64.debsudo dpkg -i logmcp_x.y.z_amd64.deb

2. Run the setup wizard

sh
sudo logmcp setup

Guides you through TLS mode, bearer token, and systemd service — then prints a ready-to-paste client config snippet.

3. Add to your AI client

sh
logmcp client-config claude-code   # or: vscode | claude-desktop

Paste the output into your MCP client config. Done — your AI can now read the server's logs.


The Key Advantage: Let the AI Debug Without Touching Your Server

You give the AI a read-only window into your logs. That's it.

  • No SSH access required — the AI connects like any HTTPS client
  • No write permissions — the AI cannot change, delete, or execute anything
  • No shell access — not even read access beyond the whitelisted log paths
  • Works from anywhere — your laptop, Claude Desktop, a remote CI agent
  • Every access is audited via syslog on the server

This makes LogMCP ideal for situations where you need AI-assisted debugging but cannot or do not want to grant shell access: production servers, customer machines, hardened environments, or any setup where least-privilege matters.

SSH is also supported. If your AI client is Claude Code running locally with an SSH key, you can use LogMCP over an SSH tunnel instead of a public HTTPS endpoint. See SSH Tunnel Setup below.

Features

  • Read-only access to log files — the AI cannot modify anything
  • Whitelist/blacklist glob patterns for fine-grained access control
  • systemd journal (journald://) as a virtual log source
  • Multi-token auth — per-client bearer tokens with revocation
  • External authenticator support — delegate token verification to any CLI program
  • TLS support: self-signed, custom cert, or behind Caddy reverse proxy
  • Audit trail via syslog (access only, no log content)
  • Guided interactive setup wizard
  • Systemd service integration
  • Extensions — expose external CLI tools or Redis-RPC workers as additional MCP tools
  • Macros — define composite MCP tools as YAML files, no code required
  • fail2ban integration and in-process rate limiting

Setup Details

The wizard (sudo logmcp setup) covers:

  • Deployment mode (direct TLS or behind Caddy)
  • Port and bearer token configuration
  • Systemd service installation
  • Client configuration snippets for Claude Code, VS Code, and Claude Desktop

Whitelist/blacklist and journald are configured directly in /etc/logmcp/config.yaml after setup.

Environment variable substitution

Any value in config.yaml can reference environment variables using ${VAR} or $VAR syntax. The substitution happens before the file is parsed, so it works everywhere — tokens, paths, DSNs, etc.

yaml
auth:  tokens:    - name: claude      token: ${LOGMCP_TOKEN}      scopes: [read]
extensions:  clitool:    - name: switchboard      command: /usr/local/bin/switchboard      timeout_seconds: 10

Unset variables expand to an empty string. To keep a literal $ in a value, use $$.

After setup, start the server:

sh
sudo systemctl start logmcp

Commands

CommandDescription
logmcp serveStart the MCP server (default)
logmcp quickstartStart instantly without config file (no root required)
logmcp setupInteractive setup wizard
logmcp checkVerify configuration and environment
logmcp token listList configured bearer tokens
logmcp token add --name <n>Add a new bearer token
logmcp token remove <name>Remove a bearer token
logmcp token renew <name>Generate a new value for an existing token
logmcp logs listList accessible log files
logmcp logs read <path>Read a log file or journald://
logmcp logs search <path>Search a log file or journald://
logmcp logs info <path>Show log file metadata
logmcp service installInstall systemd service
logmcp service removeRemove systemd service
logmcp service statusShow service status
logmcp service caddy-snippetPrint Caddyfile configuration
logmcp client-config claude-codePrint Claude Code MCP config
logmcp client-config vscodePrint VS Code MCP config
logmcp client-config claude-desktopPrint Claude Desktop MCP config
logmcp security install-fail2banInstall fail2ban filter and jail for logmcp

MCP Tools

These are the tools LogMCP exposes to AI assistants:

ToolDescription
list_logsList all log files the server has been configured to expose
read_logRead lines from a log file — head, tail, offset, or time window
search_logSearch a log file by regexp with optional context lines and time filter
log_infoFile metadata: size, line count, last modified
check_environmentServer-side health checks (config, TLS, whitelist, syslog, databases)
check_configShow current server configuration and optional parameters at their defaults
server_statusRuntime status of the MCP layer and registered extensions

Extensions may add further tools — their names are prefixed with the extension name (e.g. myapp_status for an extension named myapp).

Extensions — Wrapping External Tools as MCP

LogMCP can expose any external program or service as additional MCP tools — no custom MCP server required. The AI sees them alongside the built-in log tools.

CLI extension

Any program that implements the clitool interface (list / call subcommands) can be registered. LogMCP calls <command> list at startup to discover tools, and forwards each tool call to <command> call <tool> --token-stdin.

yaml
extensions:  clitool:    - name: myapp      command: /usr/local/bin/myapp-ctl      timeout_seconds: 10

This spawns a subprocess per call — suitable for any program on the same or a remote host.

RPC extension (Redis)

For programs running on the same host, the RPC variant avoids the per-call process-startup overhead (relevant for Python programs where interpreter startup and imports add noticeable latency). Instead of spawning a subprocess, LogMCP pushes a request onto a Redis list and waits for the worker's reply.

yaml
extensions:  clitool:    - name: myapp      command: /usr/local/bin/myapp-ctl   # still used for `list` at startup      mode: rpc      redis_addr: "127.0.0.1:6379"      timeout_seconds: 5

The worker reads requests from a Redis list and pushes its reply to a per-request reply key. See docs/RPC.md for the full protocol.

Auth flow

The bearer token from each incoming MCP request is forwarded to the extension — either via stdin (CLI mode) or as caller metadata in the RPC envelope. The extension can verify it or trust the pre-resolved identity.


Case Studies

Real-world scenarios where LogMCP makes the difference — see docs/case-studies.md:

SSH Tunnel Setup

If you are using Claude Code locally and already have SSH access to the server, you can run LogMCP without a public HTTPS endpoint:

sh
# Forward remote port 7788 to localhostssh -L 7788:127.0.0.1:7788 user@yourserver
# Then point your MCP client at https://localhost:7788

LogMCP still requires a bearer token over the tunnel — the SSH layer adds transport security, the token controls which client can connect.

License

MIT License — see LICENSE.

来源:README.md,提交 672c2fe

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.7.7最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分