An MCP server that enables AI assistants to access up-to-date documentation for Python libraries like LangChain, LlamaIndex, and OpenAI through dynamic fetching from official sources.
This project implements a Model Context Protocol (MCP) server that enables AI assistants to access up-to-date documentation for various Python libraries, including LangChain, LlamaIndex, and OpenAI. By leveraging this server, AI assistants can dynamically fetch and provide relevant information from official documentation sources. The goal is to ensure that AI applications always have access to the latest official documentation.
The Model Context Protocol is an open standard that enables developers to build secure, two-way connections between their data sources and AI-powered tools. The architecture is straightforward: developers can either expose their data through MCP servers or build AI applications (MCP clients) that connect to these servers.
git clone https://github.com/Sreedeep-SS/docret-mcp-server.git cd docret-mcp-server
On macOS/Linux:
python3 -m venv env source env/bin/activate
On Windows:
python -m venv env .\env\Scripts\activate
With the virtual environment activated, install the required dependencies:
pip install -r requirements.txt
or if you are using uv:
uv sync
Before running the application, configure the required environment variables. This project uses the SERPER API for searching documentation and requires an API key.
Create a .env
file in the root directory of the project.
Add the following environment variable:
SERPER_API_KEY=your_serper_api_key_here
Replace your_serper_api_key_here
with your actual API key.
Once the dependencies are installed and environment variables are set up, you can start the MCP server.
python main.py
This will launch the server and make it ready to handle requests.
The MCP server provides an API to fetch documentation content from supported libraries. It works by querying the SERPER API for relevant documentation links and scraping the page content.
To search for documentation on a specific topic within a library, use the get_docs
function. This function takes two parameters:
query
: The topic to search for (e.g., "Chroma DB")library
: The name of the library (e.g., "langchain")Example usage:
from main import get_docs result = await get_docs("memory management", "openai") print(result)
This will return the extracted text from the relevant OpenAI documentation pages.
You can integrate this MCP server with AI assistants like Claude or custom-built AI models. To configure the assistant to interact with the server, use the following configuration:
{ "servers": [ { "name": "Documentation Retrieval Server", "command": "python /path/to/main.py" } ] }
Ensure that the correct path to main.py
is specified.
The server currently supports the following libraries:
To add support for additional libraries, update the docs_urls
dictionary in main.py
with the library name and its documentation URL:
docs_urls = { "langchain": "python.langchain.com/docs", "llama-index": "docs.llamaindex.ai/en/stable", "openai": "platform.openai.com/docs", "new-library": "new-library-docs-url.com", }
š Roadmap
Surely this is really exciting for me and I'm looking forward to build more on this and stay updated with the latest news and ideas that can be implemented
This is what I have on my mind:
docs_urls
dictionary with additional libraries.functools.lru_cache
GPT-4
, BART
, or T5
for summarizing scraped documentation.Claude 3 Haiku
, Gemini 1.5 Pro
, GPT-4-mini
, Open-mistral-nemo
, Hugging Face Models
and many more that can be used. All of which are subject to debate.For more details on MCP servers and their implementation, refer to the guide:
This project is licensed under the MIT License. See the LICENSE file for more details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!