MCPcopy
hub / github.com/SciPhi-AI/R2R

github.com/SciPhi-AI/R2R @v3.6.5 sqlite

repository ↗ · DeepWiki ↗ · release v3.6.5 ↗
3,294 symbols 13,307 edges 307 files 1,446 documented · 44%
README

Screenshot 2025-03-27 at 6 35 02 AM

The most advanced AI retrieval system. Agentic Retrieval-Augmented Generation (RAG) with a RESTful API.

  <a href="https://r2r-docs.sciphi.ai/"><strong>Docs</strong></a> ·
  <a href="https://github.com/SciPhi-AI/R2R/issues/new?assignees=&labels=&projects=&template=bug_report.md&title="><strong>Report Bug</strong></a> ·
  <a href="https://github.com/SciPhi-AI/R2R/issues/new?assignees=&labels=&projects=&template=feature_request.md&title="><strong>Feature Request</strong></a> ·
  <a href="https://discord.gg/p6KqD2kjtB"><strong>Discord</strong></a>









<a href="https://r2r-docs.sciphi.ai"><img src="https://img.shields.io/badge/docs.sciphi.ai-3F16E4" alt="Docs"></a>
<a href="https://discord.gg/p6KqD2kjtB"><img src="https://img.shields.io/discord/1120774652915105934?style=social&logo=discord" alt="Discord"></a>
<a href="https://github.com/SciPhi-AI"><img src="https://img.shields.io/github/stars/SciPhi-AI/R2R" alt="Github Stars"></a>
<a href="https://github.com/SciPhi-AI/R2R/pulse"><img src="https://img.shields.io/github/commit-activity/w/SciPhi-AI/R2R" alt="Commits-per-week"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-purple.svg" alt="License: MIT"></a>

About

R2R is an advanced AI retrieval system supporting Retrieval-Augmented Generation (RAG) with production-ready features. Built around a RESTful API, R2R offers multimodal content ingestion, hybrid search, knowledge graphs, and comprehensive document management.

R2R also includes a Deep Research API, a multi-step reasoning system that fetches relevant data from your knowledgebase and/or the internet to deliver richer, context-aware answers for complex queries.

Usage

# Basic search
results = client.retrieval.search(query="What is DeepSeek R1?")

# RAG with citations
response = client.retrieval.rag(query="What is DeepSeek R1?")

# Deep Research RAG Agent
response = client.retrieval.agent(
  message={"role":"user", "content": "What does deepseek r1 imply? Think about market, societal implications, and more."},
  rag_generation_config={
    "model"="anthropic/claude-3-7-sonnet-20250219",
    "extended_thinking": True,
    "thinking_budget": 4096,
    "temperature": 1,
    "top_p": None,
    "max_tokens_to_sample": 16000,
  },
)

Getting Started

# Quick install and run in light mode
pip install r2r
export OPENAI_API_KEY=sk-...
python -m r2r.serve

# Or run in full mode with Docker
# git clone git@github.com:SciPhi-AI/R2R.git && cd R2R
# export R2R_CONFIG_NAME=full OPENAI_API_KEY=sk-...
# docker compose -f compose.full.yaml --profile postgres up -d

For detailed self-hosting instructions, see the self-hosting docs.

Demo

https://github.com/user-attachments/assets/173f7a1f-7c0b-4055-b667-e2cdcf70128b

Using the API

1. Install SDK & Setup

# Install SDK
pip install r2r  # Python
# or
npm i r2r-js    # JavaScript

2. Client Initialization

from r2r import R2RClient
client = R2RClient(base_url="http://localhost:7272")
const { r2rClient } = require('r2r-js');
const client = new r2rClient("http://localhost:7272");

3. Document Operations

# Ingest sample or your own document
client.documents.create(file_path="/path/to/file")

# List documents
client.documents.list()

Key Features

  • 📁 Multimodal Ingestion: Parse .txt, .pdf, .json, .png, .mp3, and more
  • 🔍 Hybrid Search: Semantic + keyword search with reciprocal rank fusion
  • 🔗 Knowledge Graphs: Automatic entity & relationship extraction
  • 🤖 Agentic RAG: Reasoning agent integrated with retrieval
  • 🔐 User & Access Management: Complete authentication & collection system

Community & Contributing

Our Contributors

Extension points exported contracts — how you extend this code

R2RClientOptions (Interface)
(no doc)
js/sdk/src/r2rClient.ts
UnprocessedChunk (Interface)
(no doc)
js/sdk/src/types.ts
ResultsWrapper (Interface)
(no doc)
js/sdk/src/types.ts
PaginatedResultsWrapper (Interface)
(no doc)
js/sdk/src/types.ts
GenericBooleanResponse (Interface)
(no doc)
js/sdk/src/types.ts

Core symbols most depended-on inside this repo

get
called by 513
py/core/providers/database/prompts_handler.py
_make_request
called by 216
py/sdk/sync_client.py
_get_table_name
called by 200
py/core/providers/database/graphs.py
create
called by 158
py/sdk/sync_methods/users.py
makeRequest
called by 119
js/sdk/src/r2rClient.ts
auth_wrapper
called by 104
py/core/base/providers/auth.py
execute_query
called by 80
py/core/providers/database/base.py
login
called by 68
py/sdk/sync_methods/users.py

Shape

Method 2,088
Function 532
Class 506
Route 120
Interface 47
Enum 1

Languages

Python92%
TypeScript8%

Modules by API surface

py/shared/utils/splitter/text.py99 symbols
py/tests/unit/retrieval/test_database_filters.py90 symbols
py/tests/unit/retrieval/test_rag_processing.py74 symbols
py/core/providers/database/graphs.py66 symbols
py/core/main/services/management_service.py55 symbols
py/core/main/api/v3/users_router.py55 symbols
py/tests/unit/retrieval/test_citations.py53 symbols
py/core/main/api/v3/graph_router.py53 symbols
py/core/main/api/v3/documents_router.py49 symbols
js/sdk/src/types.ts46 symbols
py/tests/unit/agent/test_agent_citations_old.py43 symbols
py/tests/unit/agent/test_agent_citations.py43 symbols

Dependencies from manifests, versioned

@jest/globals29.7.0 · 1×
@rrweb/record2.0.0-alpha.17 · 1×
@rrweb/types2.0.0-alpha.17 · 1×
@types/jest29.5.14 · 1×
@types/node20.17.9 · 1×
@types/uuid10.0.0 · 1×
axios1.8.4 · 1×
form-data4.0.1 · 1×
jest29.7.0 · 1×
prettier3.4.2 · 1×
rrweb-snapshot2.0.0-alpha.4 · 1×
ts-jest29.2.5 · 1×

Datastores touched

hatchetDatabase · 1 repos
postgresDatabase · 1 repos
test_dbDatabase · 1 repos

For agents

$ claude mcp add R2R \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact