Skip to main content

K9s-inspired observability control tower for LLM & MCP Servers

Project description

LLM4s (MCP-Lens)

Python 3.10+ License: MIT

K9s-inspired observability tool for LLM & MCP Server communication.

LLM4s intercepts JSON-RPC traffic between LLM clients (Claude Desktop, etc.) and MCP servers, providing real-time monitoring, debugging, and replay capabilities — all from a terminal UI.

Architecture

Claude Desktop / LLM Client
    ↓ stdin
InterceptorProxy  ←→  SilentLogger (asyncio.Queue → SQLite WAL)
    ↓ stdout
MCP Server
    ↕
Textual TUI (real-time polling)

Key Design: Zero-overhead logging via async queue — no impact on LLM ↔ Server communication speed.

Quick Start

# 1. Install
pip install llm4s

# 2. Register API keys (optional — env vars also work)
llm4s config --add gemini YOUR_KEY
llm4s config --add openai YOUR_KEY

# 3. Run proxy (intercepts MCP server traffic)
llm4s proxy -- node /path/to/mcp-server/index.js

# 4. Launch TUI dashboard (in another terminal)
llm4s tui

TUI Navigation

LLM4s follows a 3-tier hierarchy inspired by K9s:

Tier View Description
1 Providers Registered LLM providers & API key status
2 Sessions Individual agent execution sessions
3 Logs JSON-RPC packet details & payload inspector

Key Bindings

Key Action
Enter Drill down to next tier
Esc Go back to previous tier
/ Search / Semantic filter
e Edit payload (Log detail)
r Replay edited message
x Export logs to Markdown
n Rename session
d Delete session
R Refresh data
F10 / Q Quit

Semantic Filter (Advanced Search)

In the log view, use structured queries to filter precisely:

method:tools/call       # Filter by method name
tokens>100              # Token count threshold
dir:C2S                 # Direction filter (C2S or S2C)
method:call tokens>50   # Combine multiple filters

Replay & Edit

Select any logged message, press e to edit the JSON payload, then r to re-inject it into the MCP server. Replayed messages appear with a [REPLAY] tag.

CLI Commands

llm4s proxy -- <command>     # Intercept MCP server
llm4s tui                     # Launch dashboard
llm4s config --add <p> <key>  # Register API key
llm4s config --list           # List providers
llm4s doctor                  # System health check
llm4s add-server <name> --command <cmd> -- <args>
llm4s list-servers            # View registered servers

Tech Stack

Component Technology
UI Textual — async TUI framework
Database SQLite (WAL mode) via aiosqlite
Backend FastAPI
Core Python asyncio — non-blocking interceptor

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm4s-0.1.11.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm4s-0.1.11-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file llm4s-0.1.11.tar.gz.

File metadata

  • Download URL: llm4s-0.1.11.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for llm4s-0.1.11.tar.gz
Algorithm Hash digest
SHA256 91f12368d234c203c55ebbf6bbd9652fca7e7497f67f2db7c2dc9585eda3cc57
MD5 edb378edc8806f2fc8f326ccee4b639c
BLAKE2b-256 98f66bb92083398b949001fce02766762baaf36eeac1087325f8aa0f41228272

See more details on using hashes here.

File details

Details for the file llm4s-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: llm4s-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 42.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for llm4s-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 bdfcd7376014451bdf1fc36364e02d687ef096db632ed8933ea2fe8c3039bae9
MD5 d1ffeae7b8ae0352e2a236fa13ea5105
BLAKE2b-256 d808ff00c389313554e5880092c2b1ec98c102d1ac0f4320486fd390356e06f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page