| Crates.io | peeker |
| lib.rs | peeker |
| version | 1.2.0 |
| created_at | 2025-12-06 01:06:42.86982+00 |
| updated_at | 2025-12-06 03:55:02.897458+00 |
| description | A library and CLI tool for extracting code structure using Tree-sitter |
| homepage | |
| repository | https://github.com/xandwr/peeker |
| max_upload_size | |
| id | 1969486 |
| size | 70,845 |
A fast CLI tool for extracting code structure from source files using Tree-sitter.
--exports-onlycargo install peeker
# Analyze a file
peeker peek src/main.rs
# JSON output
peeker peek src/main.rs --format json
# Markdown output
peeker peek src/main.rs --format markdown
# Show only public items
peeker peek src/lib.rs --exports-only
Peeker can run as an MCP (Model Context Protocol) server, exposing its code analysis capabilities to AI tools and agents.
# Start MCP server (JSON-RPC over stdio)
peeker mcp
Add to your mcpd configuration:
{
"peeker": {
"command": "peeker",
"args": ["mcp"]
}
}
| Tool | Description |
|---|---|
peek |
Analyze source code structure. Parameters: file (required), exports_only (optional) |
src/parser.rs
Imports
use anyhow::Result; (line 1)
use tree_sitter::Parser; (line 2)
Structs/Classes
pub struct CodeStructure (lines 8-14)
imports: Vec<Import>
structs: Vec<StructDef>
functions: Vec<FunctionDef>
Functions
pub fn parse_file(path: &Path) -> Result<CodeStructure> (lines 20-45)
MIT