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.12.tar.gz (42.6 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.12-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm4s-0.1.12.tar.gz
  • Upload date:
  • Size: 42.6 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.12.tar.gz
Algorithm Hash digest
SHA256 fa5866ad80949a827466db65a2be086f74e91bbdaba0edc276c5b99d1a5812c1
MD5 bb54136c5849aef60c58392c8c43d32f
BLAKE2b-256 6caef0503d61123b3054a3906090e89744778aa58680ead3a58d7efca6d4209c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm4s-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 42.9 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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1cda98f9e9574d555fdf57c0cb8c9925371385f89f606670036060a0c90e09
MD5 1bd56fbc716633d007b3ec2b1fbbb191
BLAKE2b-256 08eb9b5b069c44adb031e74e70234ab7a24f9d10b1aabebb99899c477402938c

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