# libragen
## 基本信息
- Slug: `libragen-libragen`
- Source: modelscope
- Publisher: @libragen/libragen
- Categories: rag-systems / documentation-access / developer-tools
- Hosted: No
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/@libragen/libragen
## 简介
暂无描述。
## 安装提示

```bash
npm install -g @libragen/cli
```

## MCP Server 详情

<p align="center">
  <img src="packages/website/public/favicon.svg" alt="Libragen Logo" width="80" height="80">
</p>

<h1 align="center">libragen</h1>

<p align="center">
  <em>(pronounced "LIB-ruh-jen")</em>
</p>

<p align="center">
  <strong>Stop your AI from hallucinating code, and ground it in your actual documentation</strong>
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/@libragen/cli"><img src="https://img.shields.io/npm/v/@libragen/cli.svg?label=cli" alt="npm cli"></a>
  <a href="https://www.npmjs.com/package/@libragen/core"><img src="https://img.shields.io/npm/v/@libragen/core.svg?label=core" alt="npm core"></a>
  <a href="https://www.npmjs.com/package/@libragen/mcp"><img src="https://img.shields.io/npm/v/@libragen/mcp.svg?label=mcp" alt="npm mcp"></a>
  <a href="https://github.com/libragen/libragen/actions"><img src="https://github.com/libragen/libragen/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://github.com/libragen/libragen/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
</p>

<p align="center">
  <a href="https://libragen.dev">Documentation</a> 
  <a href="https://libragen.dev/docs/getting-started">Getting Started</a> 
  <a href="https://github.com/libragen/libragen/discussions">Discussions</a>
</p>

---

Create private, local RAG libraries that ground your AI in real documentationnot 2-year-old training data. No cloud, no API keys, just single files you can share with your whole team.

> **What's RAG?** Retrieval-Augmented Generation lets AI retrieve relevant context before responding, instead of relying solely on training data. libragen packages your docs into searchable libraries your AI can query.

##  Why libragen?

- **Ground AI in truth**  Give your coding agents authoritative docs to cite, dramatically reducing hallucinations
- **Always current**  Rebuild libraries when docs change; your AI gets the latest APIs, not stale training data
- **Private & local**  Everything runs on your machine. No API keys, no cloud bills, no data leaving your network
- **Shareable**  Single `.libragen` files work anywhere. Share via git, S3, or install from curated collections

##  Features

- ** Hybrid Search**  Combines vector similarity with BM25 keyword matching
- ** Reranking**  Optional cross-encoder reranking for improved relevance
- ** Portable**  Single-file SQLite databases with embedded vectors
- ** Smart Chunking**  Language-aware splitting that respects code boundaries
- ** Multiple Sources**  Build from local files or git repositories
- ** MCP Native**  Works directly in Claude Desktop, VS Code, and any MCP client

##  Packages

| Package | Description |
|---------|-------------|
| [`@libragen/core`](./packages/core) | Core library for embedding, chunking, storage |
| [`@libragen/cli`](./packages/cli) | Command-line interface for building and querying |
| [`@libragen/mcp`](./packages/mcp) | Model Context Protocol server for AI assistants |

##  Quick Start

### Installation

```bash
npm install -g @libragen/cli
```

### Build a Library

```bash
# From your internal docs
libragen build ./internal-api-docs --name internal-api

# From a private git repository
libragen build https://github.com/your-org/private-docs -o company-docs.libragen

# From any public repo
libragen build https://github.com/facebook/react -o react.libragen
```

### Query a Library

```bash
libragen query "how to authenticate users" -l my-project.libragen
```

### Use with AI Assistants

Install the MCP server globally:

```bash
npm install -g @libragen/mcp
```

Add to your Claude Desktop config (on macOS:
`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
   "mcpServers": {
      "libragen": {
         "command": "npx",
         "args": ["-y", "@libragen/mcp"]
      }
   }
}
```

Then install libraries to make them available:

```bash
libragen install my-project.libragen
```

##  CLI Commands

| Command | Description |
|---------|-------------|
| `build <source>` | Build a library from files or git repo |
| `query <query>` | Search a library for relevant content |
| `info <library>` | Display library metadata |
| `list` | List installed libraries and collections |
| `install <source>` | Install a library or collection |
| `uninstall <name>` | Remove an installed library or collection |
| `update [name]` | Update installed libraries to newer versions |
| `collection create` | Create a collection file |
| `config` | Display configuration and paths |
| `completions <action>` | Manage shell completions (bash, zsh, fish) |

##  Collections

Collections are JSON files that group libraries together for easy installation:

```json
{
   "name": "my-stack",
   "description": "Libraries for my project",
   "version": "1.0.0",
   "items": [
      { "library": "https://example.com/react.libragen" },
      { "library": "https://example.com/typescript.libragen" },
      { "library": "https://example.com/testing.libragen", "required": false },
      { "collection": "https://example.com/base-web.json" }
   ]
}
```

Create a collection:

```bash
# Initialize a template
libragen collection init my-stack.json

# Or create with libraries directly
libragen collection create my-stack.json \
   -l ./react.libragen \
   -l ./typescript.libragen \
   -o ./testing.libragen
```

Install a collection:

```bash
libragen install ./my-stack.json        # Required libraries only
libragen install ./my-stack.json --all  # Include optional libraries
```

Collections support:

- **Nesting**  Collections can include other collections
- **Deduplication**  Libraries are only installed once
- **Optional items**  Mark libraries as `"required": false`
- **Reference counting**  Uninstalling removes only unreferenced libraries

##  Configuration

### Storage Location

By default, libragen stores libraries and configuration in a platform-specific directory:

| Platform | Default Location                                         …

