lens
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@lenssearch for websocket reconnect"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π lens
Token-efficient code & doc retrieval for agents.
The biggest token sink for a coding agent is reading whole files to find a few relevant lines. lens fixes that: index a repo once, then search for ranked snippets, get a symbol outline of a file, or do a surgical line read β pulling just enough context instead of the whole file.
Part of tools-for-agents. Zero dependencies β Node standard library + built-in node:sqlite with FTS5 (BM25 ranking).
Why
Without lens | With lens |
|
|
Read a file just to learn its structure |
|
Re-read whole files after each edit | incremental reindex touches only changed files |
Related MCP server: PAMPA
CLI
node src/cli.js index . # build the index (incremental on re-run)
node src/cli.js search "websocket reconnect" -k 6 --tokens 1500 --glob 'src/*'
node src/cli.js outline src/server.js # symbol map, no full read
node src/cli.js read src/server.js 40 80 # surgical line range
node src/cli.js stats # index statsIndex location is ./.lens/index.db (override with LENS_DB).
MCP server (for agents)
{
"mcpServers": {
"lens": { "command": "node", "args": ["/abs/path/to/lens/mcp/mcp-server.js"],
"env": { "LENS_DB": "/abs/path/to/repo/.lens/index.db" } }
}
}Tools
Tool | Use it to⦠|
| Index / refresh a path (incremental: only changed files re-read). |
| Get ranked snippets within a token budget β use instead of reading files. |
| Get a file's symbol map (functions/classes/headings) with line numbers. |
| Read an exact line range. |
| List indexed files + language breakdown. |
| Index statistics. |
How it works
Walks a tree (skipping
node_modules,.git, build dirs, binaries, huge files).Chunks each file into overlapping line windows and stores them in an FTS5 virtual table.
searchruns an FTS5MATCHranked by bm25, then fills results up to a token budget (β4 chars/token).outlineis regex-based per language (js/ts, py, go, rust, java, ruby, sql, markdownβ¦).indexis incremental β files unchanged since last index (by mtime) are skipped.
MIT licensed.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tools-for-agents/lens'
If you have feedback or need assistance with the MCP directory API, please join our Discord server