Lancelot

io.github.ayers-software-repair由 GitHub 帳號 ayers-software-repair 發布v0.3.3更新於 Oct 30, 2026

An MCP server for search and retrieval over a local LanceDB database

已驗證Streamable HTTP可網頁執行資料庫知識與記憶

概覽

AI 產生的概覽

讓助理在本地 LanceDB 文件庫中檢索並回傳相關段落,支援文字搜尋或 OpenAI 向量搜尋。

可以做什麼
  • 搜尋 LanceDB 資料表,回傳含來源的排序結果與簡短片段
  • 針對一個問題取回若干文字區塊,合併成受字元預算限制的上下文
  • 回報連線狀態、各資料表與列數,以及是否可使用向量嵌入
  • 顯示 Lancelot 版本與已啟用的功能
適用情境
當你已把一批 Markdown、文字或 HTML 文件索引進 LanceDB 資料庫,並希望助理據此回答問題並附上出處時適用。也適用於已含文字與向量的 AnythingLLM 風格資料表。
執行需求
本機執行需 Node.js 20 或更新版本;也可連線託管端點查詢公開的 Ayers 文件。需要一個已存在的 LanceDB 資料庫資料夾,透過 LANCEDB_PATH 指定;索引需另用 lancelot-index 指令完成。可選 OPENAI_API_KEY 啟用向量搜尋,未設定時使用文字搜尋。
安裝前請注意
設定 OPENAI_API_KEY 後,查詢文字會傳送給 OpenAI 計算嵌入。託管端點會收到你送出的查詢,但不會讀取你的檔案。HTTP 模式沒有身分驗證,對外開放時應置於具驗證的代理之後;Origin 與 Host 允許清單會生效。索引指令會取代同名資料表,請保留原始文件。資料庫內容會回傳給你所連線的 MCP 用戶端。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Lancelot,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.ayers-software-repair%2Flancelot/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "lancelot": {
      "type": "http",
      "url": "https://mcp.ayers.repair/lancelot"
    }
  }
}

README

Lancelot

Search your documents from any MCP-compatible assistant. Lancelot connects an agent to a local LanceDB database and returns matching passages with their sources.

  • Local text search works without an API key.
  • Vector search uses OpenAI embeddings when configured, with text search as a fallback.
  • Read-only tools retrieve documents and report database status. Indexing is a separate command.
  • Stdio and Streamable HTTP support local clients, shared servers and AWS Lambda.

Quickstart · Install · Index documents · Tools · HTTP hosting · Privacy

Quickstart

Requires Node.js 20 or later. First, create a local LanceDB database from your documents (replace ./docs with a folder containing .md, .txt or .html files):

bash
npx -y --package @ayerselectronics/lancelot lancelot-index ./docs ./lancelot-db

This creates the documents table in ./lancelot-db for local text search; no API key is needed. Running it again replaces that table with the folder's current contents.

Then, from the same directory, add the server to Claude Code using that database's absolute path:

bash
claude mcp add --env LANCEDB_PATH="$PWD/lancelot-db" --transport stdio lancelot -- npx -y @ayerselectronics/lancelot

Ask Claude to search your documents with lancedb_search. For other MCP clients, see Install; for table options, see Index your documents.

Try the hosted server

Connect an MCP client to https://mcp.ayers.repair/lancelot to search the public Ayers documentation. This hosted instance does not read your files. To search your own documents, run the local server below.

Install

Requires Node.js 20 or later and a LanceDB database folder. If you do not have a database, index a folder of documents first. Use the database's absolute path in your client configuration.

Claude Code, using the stdio form from the Claude Code MCP documentation:

bash
claude mcp add --env LANCEDB_PATH=/path/to/db --transport stdio lancelot -- npx -y @ayerselectronics/lancelot

--transport stdio sits between the last --env and the server name on purpose: the CLI reads a name that follows --env directly as another variable. Everything after -- runs the server.

For vector search, add --env OPENAI_API_KEY=YOUR_KEY before --transport. Your table must contain vectors created with the configured embedding model. Query text is then sent to OpenAI.

Other MCP clients take the same command in their mcpServers configuration:

json
{  "mcpServers": {    "lancelot": {      "command": "npx",      "args": ["-y", "@ayerselectronics/lancelot"],      "env": {        "LANCEDB_PATH": "/path/to/db"      }    }  }}

Install links

Open one of these in a browser or on the command line to add the server to the editor. Set LANCEDB_PATH to your database folder afterwards.

  • VS Code: vscode:mcp/install?%7B%22name%22%3A%22lancelot%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40ayerselectronics%2Flancelot%22%5D%2C%22env%22%3A%7B%22LANCEDB_PATH%22%3A%22%2Fpath%2Fto%2Fdb%22%7D%7D
  • Cursor: cursor://anysphere.cursor-deeplink/mcp/install?name=lancelot&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBheWVyc2VsZWN0cm9uaWNzL2xhbmNlbG90Il0sImVudiI6eyJMQU5DRURCX1BBVEgiOiIvcGF0aC90by9kYiJ9fQ==

The link formats are from the VS Code MCP guide and the Cursor install links documentation.

Registry

MCP Registry identity: io.github.ayers-software-repair/lancelot.

Setup command

lancelot-init asks for the database folder and an OpenAI API key, and stores them for later runs. The key goes to the operating system keychain through keytar, or to an encrypted file when keytar is not available. Run it with npx -p @ayerselectronics/lancelot lancelot-init. Environment variables override what it stored.

Index your documents

lancelot-index builds the table the server reads from a folder of .md, .txt and .html files:

bash
npx -p @ayerselectronics/lancelot lancelot-index ./docs ./dbnpx -p @ayerselectronics/lancelot lancelot-index ./docs ./db --table documents

Rebuilding replaces the named table. Keep the original documents and choose a separate database folder for each collection you want to manage independently.

It walks the folder and its subfolders (skipping names that start with a dot), strips HTML to text, and splits each file into chunks of about 1,200 characters on paragraph boundaries. A paragraph longer than that is cut at a space. Each chunk becomes a row { id, path, title, text }: id is the relative path and chunk number, path is the relative path, and title is the first Markdown heading of the file, or the file name. There are no vectors, so search is text search.

--table names the table (default documents). The command replaces that table if it exists, so running it again rebuilds the table from the folder. It is the only part of the package that writes to a database; the server never does. Point LANCEDB_PATH at the database folder afterwards.

Tools

ToolWhat it does
lancedb_searchSearches a table and returns ranked hits with short snippets.
lancedb_queryRetrieves chunks for a question and returns them as one block of context, cut to a character budget.
lancedb_statusReports the connection, the tables with row counts, and whether embeddings are available.
lancedb_versionReports the Lancelot version, the MCP protocol version of the SDK it is built on, and what is enabled.

lancedb_search

ParameterTypeRequiredMeaning
querystringyesThe search text.
limitnumbernoMaximum hits, 1 to 200. Default: LANCEDB_DEFAULT_LIMIT, which is 20.
searchTypevector, text or autonovector embeds the query with OpenAI. text matches words in the text column. auto (the default) uses vector search when an API key is set and text search otherwise.
tablestringnoTable to search. Default: LANCEDB_TABLE.
textColumnstringnoColumn holding the text. Default: LANCEDB_TEXT_COLUMN.
vectorColumnstringnoColumn holding the vectors. Default: LANCEDB_VECTOR_COLUMN.

The reply is JSON. Its searchType field is the search that produced the hits, vector or text. When that is not the search you asked for, a note field says why: no API key, the vector search failed, or (in auto) it found nothing. For vector hits score is the distance, so lower is closer. For text hits score is the share of query words found in the hit, so higher is better.

Text search is a case-insensitive substring match on the words of the query. It does not use a full-text index and does not stem words.

lancedb_query

ParameterTypeRequiredMeaning
questionstringyesThe question to retrieve context for.
contextBudgetnumbernoMaximum characters of context. Default: LANCEDB_CONTEXT_BUDGET, which is 8000.
warmStartbooleannoRetrieve a general project overview instead of answering question. Default: false.
tablestringnoTable to query. Default: LANCEDB_TABLE.
limitnumbernoMaximum chunks to retrieve, 1 to 200. Default: LANCEDB_DEFAULT_LIMIT.

The reply is a Markdown block: a header (mode, search type, query), then one section per chunk with its title, source and text. Chunks that would pass the budget are left out and the block says how many.

lancedb_status

ParameterTypeRequiredMeaning
verbosebooleannoInclude the column names of each table. Default: false.

lancedb_version

No parameters.

Table layout

Lancelot reads the text from the text column (text by default). It reads title for the title, and chunkSource, docSource or path for the source, when a row has them; the first two are the layout AnythingLLM writes, and path is what lancelot-index writes. Other columns come back as metadata. Vector search needs vectors made with the same model as EMBEDDING_MODEL.

HTTP mode

bash
npx -y @ayerselectronics/lancelot --http                      # http://127.0.0.1:3000/mcpnpx -y @ayerselectronics/lancelot --http 8080npx -y @ayerselectronics/lancelot --http 8080 --host 0.0.0.0  # all interfaces

Without --http the server uses stdio. With it, the server uses MCP Streamable HTTP. The SDK negotiates the protocol version with each client. --http takes an optional port (default 3000). The server binds 127.0.0.1 unless --host names another address, as the specification advises for a local server. The endpoint is /mcp; any other path is 404.

  • Origin. The specification says the server must validate the Origin header. A request that carries an Origin not listed in LANCELOT_ALLOWED_ORIGINS gets 403. With the variable unset, every request that carries an Origin gets 403. A request with no Origin header is allowed; an absent header is not an authentication check; the SDK's own origin check refuses those, so Lancelot does the check itself.
  • Host. LANCELOT_ALLOWED_HOSTS lists the Host header values that may call, for DNS rebinding protection. Left unset on a loopback bind, it defaults to 127.0.0.1:<port>, localhost:<port> and [::1]:<port>. Left unset with --host 0.0.0.0, the Host header is not checked and a warning goes to stderr. A request with a Host not listed gets 403.
  • Stateless. No session id is issued. Each POST gets its own MCP server and transport, closed when the response ends, and answers with one JSON object. GET (the optional event stream) and DELETE (ending a session) answer 405 with Allow: POST, which the specification permits.
  • Limits. A body over 64 KB is 413. A body that is not JSON is 400.
  • Protocol version. The MCP-Protocol-Version header is checked by the SDK: a version it does not support is 400, and a missing header is taken as 2025-03-26, as the specification says.

Both variables take comma-separated lists, for example LANCELOT_ALLOWED_ORIGINS=https://app.example,https://other.example. HTTP mode has no authentication; the tools are read-only, and a server open to a network should sit behind something that has it.

AWS Lambda

dist/lambda.js exports handler(event) for an API Gateway HTTP API with payload format 2.0. It turns the event into the request the SDK's transport expects and returns { statusCode, headers, body }. It reads LANCEDB_PATH, LANCELOT_BASE_PATH (the path the endpoint is served under, such as /lancelot; unset serves every path) and the two allow-list variables. The database connection is opened on the first invocation and reused on warm ones. The function may write only to /tmp, where Lancelot keeps its own settings file.

The Dockerfile builds the container image on the AWS Node.js 24 base image for arm64, with the handler dist/lambda.handler. Build dist first:

bash
docker buildx build --platform linux/arm64 --provenance=false -t lancelot-lambda .

Environment variables

Settings come from, in order: the environment, the file written by lancelot-init, the defaults. A variable that is empty or only whitespace counts as not set; the stored value is checked next. Text search is used when no OpenAI key is available from either source.

VariableDefaultMeaning
LANCEDB_PATHnoneThe LanceDB database folder. Required for the tools to work. It must exist; Lancelot does not create it.
LANCEDB_TABLEdocumentsTable used when a call names none.
LANCEDB_TEXT_COLUMNtextColumn holding the text.
LANCEDB_VECTOR_COLUMNvectorColumn holding the vectors.
LANCEDB_DEFAULT_LIMIT20Hits returned when a call sets no limit.
LANCEDB_CONTEXT_BUDGET8000Characters of context lancedb_query returns when a call sets no contextBudget.
OPENAI_API_KEYnoneEnables vector search. When unset, the credential store is checked next.
EMBEDDING_MODELtext-embedding-ada-002The OpenAI model used to embed queries.
EMBEDDING_DIMENSIONS1536Reported by lancedb_status. It is not sent to OpenAI.
LANCELOT_LOG_LEVELinfoOne of error, warn, info, http, verbose, debug, silly.
LANCELOT_ALLOWED_ORIGINSnoneHTTP mode: comma-separated Origin values that may call. See HTTP mode.
LANCELOT_ALLOWED_HOSTSloopback names on the portHTTP mode: comma-separated Host header values that may call.
LANCELOT_BASE_PATHany pathLambda only: the path the endpoint is served under, such as /lancelot.

Standard output

The MCP stdio transport says the server writes only valid MCP messages to stdout, and that it may write logs to stderr. Lancelot follows that:

  • Every log level goes to stderr. The logger has one transport, a winston Console transport with all seven levels listed in stderrLevels.
  • The server entry point points console.log, console.info and console.debug at stderr, so a library that prints does not corrupt the stream.
  • The server reads stdin until the client closes it, then exits.

HTTP mode keeps the same rule: it writes nothing to stdout either.

lancelot-init and lancelot-index write to stdout. They talk to a person at a terminal and are never started as a server.

Read-only

The four tools open a table and query it. No code the server runs creates a table, adds, updates or deletes rows, or builds an index, and the server does not create the database folder if the path is wrong. The one exception in src is src/bin/lancelot-index.ts, a separate command that builds a table (see Index your documents); the server never imports it. tests/readonly.test.ts scans the rest of the source for those calls, and tests/integration.test.ts compares every database file before and after all four tools run.

Lancelot keeps its own settings and credentials in the per-user configuration directory, never in the database folder.

Privacy

Local text search runs on your machine. When an OpenAI key is available from the environment or your saved credentials, vector search sends query text to OpenAI to compute embeddings. Database contents are returned to the MCP client you connected; that client controls how it uses them. The public hosted endpoint receives the queries you send to it.

Privacy policy and terms: the full statement, including what the hosted endpoint receives.

Development

bash
npm cinpm run check    # typecheck, lint, build, unit and integration tests

Node 20 or later. See CONTRIBUTING.md.

License

Apache-2.0. See LICENSE and NOTICE.

Published by Ayers Electronics.

來源:README.md,提交 057f6ec

工具

4

lancedb_query

RAG query with context retrieval from LanceDB

輸入參數limittablequestion必填warmStartcontextBudget

lancedb_status

Get LanceDB status and statistics

輸入參數verbose

lancedb_version

Show Lancelot version information

無需輸入參數。

版本歷史

3
  1. v0.3.3最新Oct 30, 2026
  2. v0.3.2Oct 30, 2026
  3. v0.3.1Oct 29, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分