Hashgrid DNA (local)

ai.hashgrid由 hashgrid.ai 發布v1.3.0更新於 Oct 31, 2026

Search that learns from feedback, over text and images: embeds locally, sends DNA only vectors.

發布方自己的服務:Hashgrid DNA

已驗證STDIO僅桌面知識與記憶AI 與機器學習

概覽

AI 產生的概覽

Hashgrid DNA 的本機 MCP 伺服器:以回饋學習的文字與圖片搜尋索引,內容留在本機,只上傳向量。

可以做什麼
  • 把文字或圖片項目加入可搜尋的網格,以路徑鍵儲存,方便用前綴縮小範圍
  • 用文字查詢或圖片檔搜尋項目,並繼續取得後續結果
  • 為結果打 -1 到 1 的分數,讓之後的搜尋排序更準確
  • 為此伺服器建立網格,或徹底刪除網格及其所有項目與分數
  • 刪除單一項目及其在索引中的內容
適用情境
適合需要小型私有搜尋索引、用來檢索自己的筆記、文件或圖片,並能透過相關性回饋逐步改善結果的情境,而非一般網頁搜尋。
執行需求
透過 uvx 從 PyPI 的 hashgrid 套件在本機執行(Python)。需設定嵌入模型(HASHGRID_EMBEDDER,例如 fastembed、openai 或 voyage)與本機 sqlite 索引路徑(HASHGRID_INDEX)。需要網格 API 金鑰(HASHGRID_API_KEY)或使用 create_grid;若選用 openai 或 voyage 嵌入模型,還需 OPENAI_API_KEY 或 VOYAGE_API_KEY。
安裝前請注意
需妥善保管金鑰 HASHGRID_API_KEY、OPENAI_API_KEY 與 VOYAGE_API_KEY。內容留在本機,但向量會傳送給 Hashgrid;使用 openai 或 voyage 嵌入模型時,文字或圖片會傳送給對應服務。delete_item 與 delete_grid 會永久刪除資料,delete_grid 需以網格名稱確認。自行註冊的網格最多容納 1024 個項目。

安裝

在 SourceWeft 中

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

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

hashgrid

The Python client for Hashgrid DNA, a search engine that learns from your grades. You store items, ask a question, get the items that fit it best, and grade them with an LLM, a smaller model or your users. Each grade improves the results for every question.

bash
pip install hashgrid

Sign up

Each grid has its own API key (hg-…). DNA.signup makes a grid, no key needed, and returns its key:

python
from hashgrid import DNA
api_key = DNA.signup("mine")print(api_key)   # shown only now: store it, e.g. as $HASHGRID_API_KEY

DNA(api_key) opens the grid, and DNA() opens it from $HASHGRID_API_KEY. A grid made this way holds up to 1024 items, queries included (dna.info().max_items), and each address can sign up a few times a day. Need more? Write to [email protected].

The loop

python
from hashgrid import DNA
dna = DNA()
dna.put("cities/lisbon", "Lisbon, a hilly coastal capital")dna.put("cities/oslo", "Oslo, between fjords and forest")
query = dna.query("a capital by the sea")results = query.results(limit=2, prefix="cities/")results[0].key                      # "cities/lisbon"query.grade(results[0], 1.0)        # a good resultquery.grade(results[1], -0.5)       # a poor one
  • Items live at keys, like 42 or tools/42. prefix narrows results and listings to keys that start with it. Results return keys and metadata, not content: map the keys back to your own data.
  • Queries have an id. To ask the same question again, reopen it with dna.query(id=query.id), so its grades add up.
  • Grades run from -1 (wrong) to 1 (right). You can grade any item, not only those a query returned. Only grades train DNA, and a grade shows in results within a few seconds.

Content

An item or a query is text (str), a record (a dict), an image (its bytes, or a Path to its file), or an embedding from the grid's model (a list of floats). DNA embeds the rest itself.

python
from pathlib import Path
dna.put("tools/search", {"name": "search", "description": "Search the web"})dna.put("photos/beach", Path("beach.jpg"))dna.put("raw", '{"a": 1}', type="text/plain")   # text that looks like JSON

DNA keeps only what it matches on: text and records up to 8 KB, images as a 512 px WebP. dna.get(key) reads one item back, as kept.

Everything else

methodroute
DNA.signup(name), returns the API keyPOST /
dna.info()GET /
dna.delete_grid()DELETE /
dna.put(key, content, type=, if_match=, if_none_match=), dna.put_many({key: content})PUT /items/{key}
dna.get(key)GET /items/{key}
dna.delete(key)DELETE /items/{key}
dna.items(prefix), every pageGET /items
dna.query(content), or dna.query(id=…) to reopen onePOST /queries
query.results(limit, prefix, ungraded=)GET /queries/{id}/results
query.grade(key, score)PUT /queries/{id}/grades/{key}
query.grades(), as {key: score}GET /queries/{id}/grades
query.delete_grade(key)DELETE /queries/{id}/grades/{key}
query.delete()DELETE /queries/{id}

Methods take a key or the Item / Result itself. AsyncDNA and AsyncQuery have the same methods, awaited. Errors are subclasses of DNAError: Unauthorized (401), Forbidden (403, the grid is full), NotFound (404), PreconditionFailed (412), TooLarge (413), UnsupportedType (415), Invalid (422) and TooManyRequests (429).

For agents, DNA has a hosted MCP server at https://dna.hashgrid.ai/mcp.

License

MIT

來源:README.md,提交 aeb2def

工具

7

add_item

Add an item to search: `text`, or `image`, the path of an image file (images need an image embedder). `key` is a path unique in the grid (e.g. "/docs/intro"), so searches can narrow by prefix; left out, it is a hash of the content, and adding the same content again changes nothing. Returns the item's id and key.

輸入參數keytextimage

more_results

The next `k` results of a search (1 to 50), not shown before; empty when none are left.

輸入參數kprefixquery_id必填

score

Score how well item `item_id` fits search `query_id`, from -1 (wrong) to 1 (perfect): a result of the search, or any item. Only scores train DNA; a new score replaces the last.

輸入參數score必填item_id必填query_id必填

delete_item

Delete an item, its content in the index and its scores.

輸入參數item_id必填

create_grid

Create a DNA grid for this server, when it has none (no key needed): its API key is saved in the local index, and the other tools use it from then on.

輸入參數name

delete_grid

Delete this server's grid, every item and score in it and its content in the local index, for good. `confirm` must be the grid's name. Only when the user asks for it.

輸入參數confirm必填

版本歷史

3
  1. v1.3.0最新Oct 24, 2026
  2. v1.1.0Oct 19, 2026
  3. v1.0.0Oct 19, 2026

評分

已滿足適用檢查項的 90%

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

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Hashgrid 整合