SuperAPIAI Directory

logmcp

github.com · AI developer platforms

Read-only access to whitelisted log files on a Linux server: search and read logs without shell access, with token auth and syslog auditing.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

LogMCP is an open-source MCP server that lets AI assistants access log files on remote Linux servers in a read-only manner, thereby assisting with debugging without granting the AI shell access. The AI connects over HTTPS, and the server remains fully controllable.

Purpose LogMCP is intended for scenarios where AI-assisted debugging is needed but shell access cannot or will not be granted, such as production servers, customer machines, hardened environments, or any deployment that values least privilege. The AI can connect like an ordinary HTTPS client, with no SSH, no write permissions, and no ability to execute anything, not even to read content outside the whitelisted log paths. Every access is audited via syslog on the server.

Key capabilities

  • Read-only access to log files; the AI cannot modify anything.
  • Whitelist/blacklist glob patterns for fine-grained access control.
  • Expose the systemd journal (journald://) as a virtual log source.
  • Multi-token authentication: each client uses an independent bearer token, with support for revocation.
  • External authenticator support: token verification can be delegated to any CLI program.
  • TLS support: self-signed certificates, custom certificates, or placement behind a Caddy reverse proxy.
  • Audit trail via syslog (records access only, not 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 in YAML files without writing code.
  • fail2ban integration and in-process rate limiting.

How to use LogMCP offers two installation methods.

Method A: Quick start (no root required) Can be tried in less than a minute, with no configuration file, root, or systemd required. The command checks the user's groups (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. If run as root, you can pass --user <name>, and LogMCP will add the user to the required groups and restart as that user; subsequent starts no longer require root. Note: Tokens and certificates are temporary; the token changes on every startup. For permanent settings, use Method B. After testing, the server can be removed from Claude Code.

Method B: Permanent installation (recommended) Install the prebuilt .deb package (replace x.y.z with the latest version). Then run the setup wizard, which guides you through TLS mode, bearer token, and systemd service configuration, and prints client configuration snippets that can be pasted directly. Finally, paste the output into the MCP client configuration, and the AI can read the server logs.

The setup wizard (sudo logmcp setup) covers: deployment mode (direct TLS or behind Caddy), port and bearer token configuration, systemd service installation, and client configuration snippets for Claude Code, VS Code, and Claude Desktop. Whitelists/blacklists and journald are configured directly in /etc/logmcp/config.yaml after setup.

Configuration supports environment variable substitution: any value in config.yaml can reference environment variables using ${VAR} or $VAR syntax. Substitution happens before the file is parsed, so tokens, paths, DSNs, etc. can all be used. Unset variables expand to an empty string; to keep a literal $, use $$.

Start the server after setup is complete. LogMCP exposes built-in tools to the AI assistant; extensions may add more tools, whose names are prefixed with the extension name (for example, an extension named myapp provides myapp_status).

Extensions: Wrapping external tools as MCP LogMCP can expose any external program or service as an additional MCP tool without a custom MCP server. The AI sees them just like the built-in log tools. 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. This spawns a subprocess on every call, and works for any program on the same host or a remote host.

RPC extension (Redis) For programs running on the same host, the RPC variant avoids the per-call process startup overhead (especially noticeable for Python programs, where interpreter startup and imports introduce perceptible latency). Instead of spawning a subprocess, LogMCP pushes requests to a Redis list and waits for the worker to reply. The worker reads requests from the Redis list and pushes replies to the reply key corresponding to each request. See docs/RPC.md for the full protocol.

The bearer token of every incoming MCP request is forwarded to the extension—via stdin in CLI mode, and as caller metadata in the RPC envelope in RPC mode. The extension can verify it, or trust the already-resolved identity.

SSH tunnel setup If you use Claude Code locally and already have SSH access to the server, you can run LogMCP without a public HTTPS endpoint. When tunneling, LogMCP still requires a bearer token: the SSH layer provides transport security, and the token controls which client can connect.

Use cases See docs/case-studies.md for real-world examples, including: Asterisk/VoIP debugging package compilation and dependency errors; a production web server installation using a Caddy reverse proxy; and standalone operation using its own TLS.

Limitations LogMCP provides read-only access only; the AI cannot modify, delete, or execute anything, nor can it read anything outside the whitelisted log paths. In quick-start mode, tokens and certificates are temporary, and the token changes on every startup. Auditing records access only, not log contents.

License MIT License, see LICENSE for details.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools