Skip to content

bennypowers/mansplain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mansplain

Well, ACTUALLY, the --recursive flag...

An MCP server that gives your LLM agents access to Unix man pages, GNU info pages, and Gentoo eclass docs. Because you can lead an AI to documentation, but you can't make it RTFM.

What's in a man?

mansplain wraps man, apropos, info, tldr, and Gentoo eclass docs as MCP tools so your coding agents can look up documentation on their own. No more hallucinating flags that don't exist. Probably.

Tools

Tool What it does
man_lookup Fetch a man page by name and section
man_search Search for man pages via apropos
info_lookup Fetch a GNU info page by topic/node
tldr_lookup Get the tldr summary for a command
eclass_lookup Fetch Gentoo eclass documentation (doc comments)

MCP Resources

mansplain also exposes man page sections as MCP resource templates, so agents can browse documentation by section:

man://{page}/{section_name}    e.g. man://ssh/DESCRIPTION

Smart section delivery

Some man pages are... comprehensive (looking at you, emerge(1) at 1500+ lines). For big pages, mansplain returns the NAME and SYNOPSIS along with a table of contents, then lets the agent request specific sections:

> man_lookup(page: "emerge")
NAME
    emerge - Command-line interface to the Portage system

SYNOPSIS
    emerge [options] [action] [ebuild | tbz2 | file | ...set | atom]

This man page is large. Available sections:
  - NAME (3 lines)
  - SYNOPSIS (11 lines)
  - DESCRIPTION (8 lines)
  - OPTIONS (854 lines)      <-- the big one
  - SEE ALSO (8 lines)
  ...

Call man_lookup again with the `sections` parameter to read specific sections.

> man_lookup(page: "emerge", sections: ["OPTIONS"])
OPTIONS
    --ask (-a)
    ...

No more flooding your agent's context window with 1500 lines when it just needed to know what --deep does. That's what we call a deep cut.

Installation

go install bennypowers.dev/mansplain@latest
opencode mcp add mansplain -- mansplain
claude mcp add mansplain -- mansplain

Gentoo

Available in the bennypowers overlay:

emerge app-misc/mansplain

Features

  • ANSI stripping -- strips bold/underline overstrike and escape codes so your agent gets clean text, not a formatting crime scene
  • Section-aware delivery -- large man pages get a table of contents instead of a context-window-sized wall of text
  • mandb detection -- if apropos fails because the index isn't built, mansplain gently reminds the user to run sudo mandb
  • Section numbers -- pass section: "3" when you want printf(3) the C function, not printf(1) the shell builtin. We've all been burned

Requirements

  • man and apropos -- you almost certainly have these. If not, you have bigger problems than documentation access
  • info -- optional, for info_lookup. For the pages man forgot
  • tldr -- optional, for tldr_lookup. Short attention span sold separately
  • Gentoo portage tree -- optional, for eclass_lookup. Reads from /var/db/repos/gentoo/eclass/

Development

go test ./... -count=1
golangci-lint run ./...

FAQ

Q: Why is it called mansplain? A: Because it explains man pages. That's it. That's the joke.

Q: Does it support info pages? A: Yes! We worked up the courage. Use info_lookup.

Q: Can it explain sendmail.cf? A: Some things are beyond the help of any tool, mortal or artificial.

License

GPLv3