list_sources
List all sources (documents, URLs) indexed in the "Knowledge Base" knowledge base
Turn your own documents into a queryable knowledge base an assistant can ask questions of — two tools, one to query and one to see what is indexed.
LABSCO SUMMARY
The characteristic failure of a retrieval system is answering from adjacent material and sounding identical to answering from the right document. Being able to enumerate what was indexed lets a caller check whether the question is even in scope before trusting the answer. The surface is deliberately two tools because the interesting part is the SDK behind it — this is what your knowledge base looks like once built, and the building is where the work is.
The server side of an SDK for building knowledge bases from arbitrary sources: the tools query the base in natural language and list what has been indexed into it.
OPENAI_API_KEY — retrieval runs against OpenAI, so queries bill to that account.
One command plus a key — npm install akyn-ai, then supply credentials
USE CASES
Query in natural language rather than composing a search over the corpus.
List what is actually indexed before trusting a confident answer that might be from adjacent material.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
list_sourcesList all sources (documents, URLs) indexed in the "Knowledge Base" knowledge base
queryQuery the "Knowledge Base" knowledge base with a natural language question. Returns relevant context chunks from the indexed content.
BEFORE YOU INSTALL
2 tools when we connected.
CONTEXT COST
Rated by the size of the 2 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npm install akyn-aimy-kb.ts is a script you write yourself with the SDK: create a KnowledgeBase, add your sources (addDirectory, addFile, addURL or addText) and end with kb.serveStdio(), as in the project's Basic Usage example. <YOUR_PATH_TO_KB> below is the full path to that file.
{
"mcpServers": {
"my-docs": {
"command": "npx",
"args": [
"ts-node",
"./my-kb.ts"
],
"env": {
"OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
}
}
}
}my-kb.ts is a script you write yourself with the SDK: create a KnowledgeBase, add your sources (addDirectory, addFile, addURL or addText) and end with kb.serveStdio(), as in the project's Basic Usage example. <YOUR_PATH_TO_KB> below is the full path to that file.
{
"mcpServers": {
"my-docs": {
"command": "npx",
"args": [
"ts-node",
"<YOUR_PATH_TO_KB>"
],
"env": {
"OPENAI_API_KEY": "<YOUR_OPENAI_API_KEY>"
}
}
}
}No code needed: this indexes a folder and serves it over stdio. In your client's configuration, use npx as the command and the rest of this line as its arguments, with the folder as a full path and OPENAI_API_KEY in the env.
npx akyn-ai --dir ./docs --name "My Docs"