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.9.tar.gz (40.1 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.9-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llm4s-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ba1d0c2d934fbba02bd29d92bd770fdbd59c4027ce89a76025d815f356de5d57
MD5 7c88b17d874ce5f7ceb5bcf237848796
BLAKE2b-256 3da34147e3add937ab0e600bffe942c05e1277aa64e41d55a15e1ed625a8d54a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for llm4s-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a6f5514b095af156cc0cc96fd88def6c7194795c7329d111785e68a7e2762bd5
MD5 ef097aa0e9043f47ace713c60c59342c
BLAKE2b-256 7cc87d2669da5bb70372096cc10fa5af7cd5980bca59ddb5f9a4152e7d4fdcc6

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