Skip to main content
RAGLight supports the Model Context Protocol (MCP), allowing your RAG pipeline to act as an agent that can query external databases, fetch live data, or execute code.

MCP Configuration

In this example, we connect the RAG agent to a local MCP server running on port 8001.
agentic_rag.py
from raglight.config.agentic_config import AgenticRAGConfig
from raglight.rag.agentic_api import AgenticPipeline
from raglight.config.settings import Settings

# Define MCP Server connection
mcp_servers = [
    {"url": "http://127.0.0.1:8001/sse"}
]

# Configure Agentic RAG
config = AgenticRAGConfig(
    provider=Settings.OPENAI,
    model="gpt-4o",
    k=10,
    mcp_config=mcp_servers,
    knowledge_base="./company_data"
)

# The agent now has access to both your documents AND the MCP tools
agent = AgenticPipeline(config)
agent.build()

# Complex query requiring both retrieval and tool use
response = agent.chat("Check the database for user 'Alice' and summarize her recent support tickets from the docs.")
print(response)