code-context
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CX_ROOT | No | default repo root for the MCP server / CLI when not run from the repo | current directory |
| CX_NO_EMBED | No | keyword-only mode for the MCP server (skip the vector stage) | off |
| CX_SEARCH_K | No | default number of hits `search` returns (also settable per call and via the CLI `-k` flag) | 10 |
| CX_AUTO_SYNC | No | 0 disables the MCP server's background staleness sync | on |
| CX_INDEX_DIR | No | where the index lives | <repo>/.infino |
| CX_MAX_FILES | No | indexing cap on number of files | 20000 |
| CX_AUTO_INDEX | No | 0 makes a query on an unindexed repo error instead of building the index inline on the first `search`/`sql` | on |
| CX_NO_RECEIPT | No | 1 turns off usage accounting - the per-call receipt on results and the `cx usage` ledger | off |
| CX_MAX_FILE_BYTES | No | indexing cap on file size | 1MB |
| CX_SYNC_INTERVAL_SECS | No | auto-sync debounce between staleness checks | 30 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
code-context is a local index of this repository: every file's lines are in it, and what the repository holds is in the sql tool's text, so begin with these tools, not with ls, cat or a look at CLAUDE.md. Which tool for which question:
find - every line containing an exact string, where you would grep.
search - how does X work, where is Y handled, code by meaning.
sql - counts, rankings, and aggregates across the repo, Ranking files by how much of them is about a topic goes through hybrid_search, not bm25, when the topic is a concept; a total over a search relation is the top k's matched lines, never a file's length - sizes and whole-repo counts come from the chunks table with no search function.
read - the numbered lines of the files the index named, several paths in one call; a range with from and to. Look with the index first: find, search and sql cover every file in one call and return the lines themselves, the files they name are one read away, every path in one call, and the lines of any file or row are one sql statement away (SELECT start_line, content FROM chunks WHERE path = '...' ORDER BY start_line), and ranked when you want the lines about something rather than all of them - hybrid_search, bm25_search or vector_search inside the statement (SELECT path, start_line, content FROM hybrid_search('chunks', 'content', '', 'embedding', {{q}}, 50) WHERE ...). Do not open the checkout with Grep, Glob, Bash or Read for what they can answer. Be efficient: prefer few, well-chosen tool calls, and hand a sweep across many files to a tool built for it rather than searching by hand. Independent calls go in one reply, never one per turn: several finds, searches or statements as one call with queries, or side by side; and once the index has named the files, read them with read, every path in one call, never one Read per file. Hits carry the code: when a hit answers the question, answer from it. A hit's content shows each line with its own number in the file, so cite a place as path:line or path:start-end from those numbers and only where the thing you name sits - never the hit's whole line range, which spans the chunk. Cite the places your tool results gave you exactly as they gave them - the path and line numbers copied, never recalled or adjusted. Each hit's cite is its place in that form: keep its path exactly as it is there, and narrow the numbers to the lines the content numbers. A question that asks how many (a count, a total, which have the most) is answered with the aggregated values themselves: a statement that returns each count beside the column naming its group, and an answer that states them. Read the files the index named with read, every path in one call; Claude's own Read only for a hit marked truncated. Every tool takes an optional 'path' (an absolute repo root) to target another repository. A 'partial' marker means files over the index cap were left out, so a missing match is not proof of absence. Before you write the final answer to a task, list every explicit ask in it - each deliverable and its file name, who it is addressed to, every section, table, rating or count it names, every question it poses - and check your draft against that list; an ask the draft does not meet is fixed before you answer, never left out. search is off on this server: this machine has no Infino account, or has not agreed to uploads. find, sql and read run on the local index and need nothing. To turn search on, the person - not you - runs once, in a terminal:
npx -y @infino-ai/code-context login --platform <the platform's URL>. It asks them first, creates a free account (no email, no card), stores its key on this machine, and every directory they open after that has search too once the session restarts. Do not run that command yourself, and never ask for or paste a key. Call each tool by the name your client lists for it - in Claude Code that is mcp__code-context__search, mcp__code-context__sql, mcp__code-context__find and so on - never by the bare name written here, which the client refuses as no such tool.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| findA | Every line in the repository containing an exact string, like grep -n: complete and unranked, written as grep writes it (path:line:text, one line per match, the enclosing definition in brackets when known), with the repo-wide total and the per-file counts after the matches (the grep -c answer). Literal text within one line, case-sensitive unless ignoreCase. Use it where you would grep: every use or definition of an identifier, an error message, a config key. Set defines to get only where a name is defined rather than everywhere it appears. Find a definition by its bare name with defines - |
| sqlA | Read-only SQL, one SELECT or WITH, over chunks(path, start_line, end_line, lang, symbol, content[, embedding]) - lang is the file extension, e.g. 'rs' - for counts, rankings, and GROUP BY across the whole repo. The search functions are table-valued: a ranked search is a relation, so WHERE, GROUP BY, ORDER BY and joins compose with it in one pass, and one query replaces the several round trips of searching, then filtering, then counting. Rank through a search relation rather than scanning the whole table - with ILIKE, LIKE, regexp_like, or a bare filter on path or lang: a scan has no relevance ranking, reads every chunk, and answers 'contains this substring' when the question asked which code is about something. Rank with hybrid_search('chunks','content','terms','embedding', {{q}}, k) - 'terms' and {{q}} are yours to fill in, not literals to copy - unless you have a reason not to: it fuses exact terms with meaning, so it reaches the code whether or not the question's words are the code's words, and they rarely are. That covers a concept, a subsystem, 'code about X', 'files that do Y' - the shape of almost every ranking question. A question asking what is related to something is a join or a question of meaning: include hybrid_search or vector_search in the statement or the search. Keep every condition the question names in the statement: a question about some of the rows (the village articles, one project's files) is answered over those rows alone, never over the whole table. Put as much of the question as you can into one statement: WITH, UNION ALL, joins, CASE, GROUP BY and window functions such as ROW_NUMBER() OVER (PARTITION BY ...) compose in one, so a question in several parts - several things each counted, the top rows of each group, a count beside the rows it counts - is one statement, never a query per part. Finding rows is a hybrid_search, whatever the question names - a figure, a topic, a kind of thing, a word it says the rows mention: the rows rarely use the question's words, scanned and typed text misspells them, and the keyword half of the search still ranks an exact hit first. The keyword functions - token_match, bm25_search, LIKE on an indexed column - are for one thing only, counting or listing every exact occurrence of a literal, where a ranked top k would be incomplete. A question with no text in it - how many rows, the largest values, a total - is plain SQL with no search function. bm25_search('chunks','content','terms', k) is keyword only: reach for it when the topic is itself a literal string you know appears in the source and you want counts a reader can check as occurrences. vector_search('chunks','embedding', {{q}}, k) is meaning alone - for a question whose words will not be the code's words: SELECT path, start_line, content FROM vector_search('chunks','embedding', {{q}}, 20). token_match('chunks','content','the terms','and') is every row holding every WORD given, unranked and complete - a count a reader can check: SELECT count() FROM token_match('chunks','content','','and'). Its unit is the word: in_bulk is the two words in and bulk, and 122 Django files hold both where 30 hold the identifier. An identifier, an error text, an exact phrase is find's, never token_match's. Several terms counted at once are one token_match per term, side by side in a UNION ALL - SELECT 'a' AS term, COUNT() AS n FROM token_match('chunks','content','a','and') UNION ALL SELECT 'b', COUNT() FROM token_match('chunks','content','b','and') - so a row holding two of them counts for both. exact_match('chunks','content','value') is the rows whose whole value equals the string - a lookup on a short indexed column, never on content. The {{name}} placeholders are filled server-side from the embed map, so they cost you nothing but the name. The whole question as one statement, each clause one job - filter, keyword and meaning search, group, count - with your own words in place of the example's: SELECT path, SUM(end_line - start_line + 1) AS ranked_lines, COUNT() AS chunks FROM hybrid_search('chunks','content','merge small superfiles','embedding', {{q}}, 300) WHERE path LIKE 'src/%' AND lang = 'rs' GROUP BY path ORDER BY ranked_lines DESC LIMIT 15, with embed {"q":"how small superfiles are merged into larger ones"}: the terms are the keyword job and the {{q}} text the meaning job, the WHERE the filter, the GROUP BY with its aggregates the which and the how many; a second table joins into the same statement (FROM ... AS chunks JOIN ON ) where the database has one - one call, not a search, then a filter, then a count. Where the topic is a literal string you want counted as occurrences, the same shape over bm25_search('chunks','content','compaction', 300) instead - every row then holds the word, so a reader can check it. What such a total means: a search relation holds only the top k chunks of that query, so a SUM or COUNT over it is the lines or chunks that ranked within the top k - a share of the file about the topic - and never the file's length or the repository's count; report it as 'lines ranked in the top 300 for ', and expect files outside the top k, including large ones, to be missing from it. A question with no topic in it - a file's length, the largest files, a count over the whole repository - comes from chunks with no search function: SELECT path, MAX(end_line) AS lines FROM chunks WHERE lang IN ('rs','ts','py') GROUP BY path ORDER BY lines DESC. Name the languages you mean, as that example does, on any question about code: an unfiltered ranking over a real repository comes back topped by generated data - benchmark result JSON, fixtures, vendored blobs - which genuinely are the longest files and are never the answer. |
| readA | The numbered lines of the files named - several files in one call, from the index, each line as path:line. Use it after find, search or sql have named the files you want, for every file at once, in place of one Read per file. from and to cut every file to a line range; lists in both name several ranges in one call, paired in order (from [559, 1938], to [610, 1975] reads 559-610 and 1938-1975), for the windows around several places in a file - never one read per range. A file over 400 lines, or past the result's budget, comes back a page at a time, with more saying where its next page starts, and the result's next lists the read calls that fetch the rest of every file cut short - make them, all in one reply. A path the index does not hold comes back as a miss beside the others. The result includes a 'usage' field, a one-line receipt of tokens returned and files. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 3 tools
The three tools have heavily overlapping capabilities: find and sql both locate occurrences (exact substring vs token_match/exact_match), and sql also reads file lines just like read. The extremely long descriptions do provide explicit guidance on when to use each, which prevents total confusion, but the boundaries remain subtle and easy to misapply.
Names follow mixed conventions: find and read are verbs, while sql is a noun/technology label. The set is short enough to remain readable, but there is no predictable verb_noun or single consistent pattern.
Three broad capabilities (literal grep, SQL over indexed chunks, and file reads) cover a lot of ground and each broadly earns its place. However, the heavy overlap between them suggests the surface could have been consolidated or more cleanly separated.
For a read-only code-context server, the set covers exact search, semantic/keyword search, counting/ranking via SQL, and file reading. Minor gaps exist around directory/tree exploration and first-class symbol lookup, but SQL can approximate most of these through queries over the chunks table.