Librarian

Librarian

Provides AI agents with persistent knowledge storage, enabling them to store, search, and retrieve text, documents, and files using semantic and keyword search via MCP tools.

Category
访问服务器

README

Agent Library

A personal knowledge library for AI agents, built on Arcade for the Model Context Protocol (MCP).

Status. Agent Library is a community project built by Arcade.dev engineers. It is not an official Arcade.dev product and is not covered by Arcade.dev support or SLAs. See Support below for what to expect.

Naming. The package is Agent Library (agent-library on PyPI, librarian as the Python module). The MCP server inside it identifies itself as Librarian — that's the role your agent talks to, and it's why the exposed tools are named Librarian_SearchLibrary, Librarian_AddToLibrary, and so on.

Overview

Agent Library provides AI agents with persistent storage for text, documents, and knowledge. Agents can store information and retrieve it later through semantic and keyword search, maintaining context across conversations.

graph LR
    A[Agent Stores Info] --> B[Parser]
    B --> C[Chunker]
    C --> D[Embedder]
    D --> E[(SQLite + vec)]
    F[Agent Queries] --> G[Hybrid Search]
    E --> G
    G --> H[Relevant Context]

Features

  • Persistent knowledge storage for AI agents
  • SQLite storage with sqlite-vec for vector search
  • Full-text search using FTS5 with BM25 ranking
  • Hybrid search combining semantic and keyword matching
  • Max Marginal Relevance (MMR) for diverse results
  • Configurable embedding models (local or OpenAI-compatible API)
  • Header-aware text chunking with overlap
  • Time-bounded search filters
  • CLI and MCP server interfaces

Multi-Modal Support

Agent Library supports indexing and searching across multiple file types:

Asset Type File Extensions Features
Text .md, .txt Frontmatter extraction, header-aware chunking
Code .py, .js, .ts, .go, .rs, .java, .cpp, and more Symbol extraction (classes, functions, methods)
PDF .pdf Page-based text extraction
Image .png, .jpg, .jpeg, .gif, .webp Metadata and EXIF extraction, optional OCR

Installation

The recommended way to install Agent Library is as a uv tool, which gives you the libr CLI and the MCP server in an isolated environment:

uv tool install 'agent-library[all]'

The [all] extra pulls in optional support for PDFs, images, OCR, and code-aware embeddings. If you'd rather install only what you need:

uv tool install agent-library                # core only (text + code)
uv tool install 'agent-library[pdf]'         # add PDF support
uv tool install 'agent-library[vision]'      # add image support
uv tool install 'agent-library[ocr]'         # add OCR for image-based PDFs

Installing from source

If you want to contribute or run from a clone:

git clone https://github.com/arcadeai-labs/agent-library.git
cd agent-library
./setup.sh

Or install manually with the dev extras:

uv pip install -e ".[dev,all]"

CLI Usage

# Add files to the library
libr add ~/notes

# Search the library
libr search "machine learning concepts"

# List sources
libr list

# View library statistics
libr index

# Rebuild the index
libr index build

MCP Server

Start the server for AI assistant integration:

# stdio transport (Claude Desktop, CLI)
libr serve stdio

# HTTP transport (Cursor, VS Code)
libr serve http --port 8000

See the Arcade MCP documentation for integration details.

Available Tools

Core Tools (always enabled):

Tool Description
Librarian_SearchLibrary Unified search with mode selection (hybrid/semantic/keyword), asset type filtering, and timeframe support
Librarian_AddToLibrary Store new content in the library
Librarian_UpdateLibraryDoc Update existing content
Librarian_ReadFromLibrary Read full document content
Librarian_RemoveFromLibrary Remove content from the library
Librarian_ListLibraryContents List all stored content
Librarian_IndexDirectoryToLibrary Bulk import files from a directory

Optional Tools (enable with LIBRARIAN_ENABLE_OPTIONAL_TOOLS=true):

Tool Description
Librarian_GetLibraryOverview Inspect the library — view selects sections (default; storage locations + doc counts), stats (totals + config), or tree (recursive filesystem walk)
Librarian_SuggestLibraryLocation AI-powered suggestions for where to store content

Configuration

Set via environment variables:

Variable Default Description
DOCUMENTS_PATH ./documents Root directory for files
DATABASE_PATH ~/.librarian/index.db SQLite database location
EMBEDDING_PROVIDER openai local or openai
EMBEDDING_MODEL all-MiniLM-L6-v2 Local model name
OPENAI_API_BASE http://localhost:7171/v1 OpenAI-compatible API URL
OPENAI_EMBEDDING_MODEL qwen3-embedding-06b API model name
CHUNK_SIZE 512 Max characters per chunk
CHUNK_OVERLAP 50 Overlap between chunks
SEARCH_LIMIT 10 Default results limit
MMR_LAMBDA 0.7 MMR diversity (0=diverse, 1=relevant)
HYBRID_ALPHA 0.7 Vector vs keyword weight (1=vector only)

Project Structure

librarian/
├── cli.py           # Command-line interface
├── server.py        # MCP server and tool definitions
├── config.py        # Configuration management
├── indexing.py      # Document indexing service
├── types.py         # Shared type definitions
├── storage/
│   ├── database.py  # SQLite operations
│   ├── vector_store.py  # sqlite-vec search
│   └── fts_store.py     # FTS5 search
├── processing/
│   ├── embed/       # Embedding providers
│   ├── parsers/     # Document parsers (md, code, pdf, image)
│   └── transform/   # Text chunking
├── retrieval/
│   └── search.py    # Hybrid search + MMR
└── utils/
    └── timeframe.py # Time filter utilities

Development

make install    # Install dependencies
make test       # Run tests
make lint       # Run linter
make format     # Format code
make typecheck  # Type checking
make check      # All checks
make evals      # Run evaluations

Resources

Support

Agent Library is a community project built by Arcade.dev engineers. It is not an official Arcade.dev product and is not covered by Arcade.dev support or SLAs.

  • GitHub issues are monitored on a best-effort basis. Expect response times in days-to-weeks, not hours.
  • Pull requests are welcome. See CONTRIBUTING.md for how to file one and what we're likely to accept.
  • Security vulnerabilities should be reported privately per SECURITY.md, not via public issues.

If you're using Agent Library in something important, snapshot the SQLite index (~/.librarian/index.db) before anything you can't easily redo. The index is a single file — cp is your friend.

Contributing

See CONTRIBUTING.md. Issues, PRs, and new parsers/embedders are all welcome.

License

Apache License 2.0 - see LICENSE for details.

Agent Library was originally developed by Arcade.dev. See NOTICE for attribution requirements when redistributing.

Contact

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选