
mcp rag server
使用本地 LLM 和 Ollama 查询 PDF 文档的简单工具,支持语义搜索和金融数据回退。
Repository Info
About This Server
使用本地 LLM 和 Ollama 查询 PDF 文档的简单工具,支持语义搜索和金融数据回退。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
PDF RAG Application with FastMCP, Ollama, and LangChain
A simple application for querying PDF documents using Retrieval-Augmented Generation (RAG) with local LLMs via Ollama, with a fallback to the Financial Times API for financial data.
How it Works
- Load PDFs: The app reads PDF files from a
data/folder. - Chunking: Text from PDFs is split into smaller, manageable chunks.
- Embedding: Ollama converts these text chunks into numerical representations (embeddings).
- Vector Store: Embeddings are stored in a FAISS vector store for semantic search.
- Querying: When a question is asked (e.g., the default question), the app:
- Converts the question to an embedding.
- Finds the most relevant text chunks from the PDF.
- Sends these chunks and the question to the Ollama LLM.
- Returns an answer based on the PDF context.
- If no answer is found in the PDF, it queries the Financial Times API for relevant data.
- Output: The answer and its sources (PDF pages or FT API) are printed to the console.
Prerequisites
- Python 3.11: Download Python 3.11
- Poetry: For Python package management. Installation instructions
- Ollama: For running local LLMs.
- Download from ollama.com/download
- Pull the model:
ollama pull llama3
- PDF File: A PDF file (e.g.,
Barclays-PLC-Annual-Report-2020.pdf) in thedata/folder.
Setup Instructions
-
Clone/Download the Project:
- Ensure all files (
main.py,pyproject.toml,.env.example) are in the project root.
- Ensure all files (
-
Install Dependencies:
- Open a terminal in the project root and run:
poetry env use python3.11 poetry install
- Open a terminal in the project root and run:
Quick Start
Clone the repository
git clone https://github.com/dariocostanzo/mcp-rag-serverInstall dependencies
cd mcp-rag-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.