MCP Docs Intelligence Server
Provides documentation retrieval and grounded question answering for LangChain by searching official docs, extracting clean content, and returning sources.
Provides documentation retrieval and grounded question answering for OpenAI by searching official docs, extracting clean content, and returning sources.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Docs Intelligence ServerWhat do the official Python docs say about using asyncio.gather?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ MCP Docs Intelligence Server
An asynchronous Model Context Protocol (MCP) server for searching, extracting, cleaning, and answering questions from official AI & Python ecosystem documentation.
โฆ Overview
MCP Docs Intelligence Server is a lightweight asynchronous documentation intelligence system built around the Model Context Protocol (MCP).
Instead of asking an LLM to answer from potentially stale or incomplete internal knowledge, this project dynamically retrieves information from the official documentation of supported libraries and uses that documentation as the grounding context for the final response.
The system combines:
FastMCP โ MCP server and tool interface
Serper โ web search restricted to official documentation domains
Trafilatura โ extraction and cleaning of useful page content
Groq โ fast LLM inference
GPT-OSS-20B โ response generation
httpx โ asynchronous web requests
Python async/await โ non-blocking architecture
python-dotenv โ environment-based configuration
The result is a clean pipeline that transforms:
Natural Language Query
โ
Official Documentation Search
โ
Documentation Retrieval
โ
HTML โ Clean Text
โ
Context Grounding
โ
Groq LLM
โ
Human-readable Answer๐ Why This Project?
Traditional documentation workflows often look like this:
Search Google
โ
Open multiple tabs
โ
Read long documentation pages
โ
Find the relevant section
โ
Understand the implementation
โ
Write the answerThis project compresses that workflow into a single intelligent interface:
โโโโโโโโโโโโโโโโโโโโโโโ
โ Developer Query โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Client โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ FastMCP Server โ
โ get_docs() โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Serper Search โ
โ Official Docs Only โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Documentation โ
โ Pages โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Trafilatura โ
โ HTML โ Clean Text โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Grounded Context โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Groq โ
โ GPT-OSS-20B โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Final Answer + โ
โ Sources โ
โโโโโโโโโโโโโโโโโโโโโโโโจ Key Features
Feature | Description |
๐ MCP-native architecture | Documentation retrieval is exposed as an MCP tool |
โก Async-first | Uses asynchronous HTTP and MCP execution |
๐ Official documentation search | Searches within trusted documentation domains |
๐งน HTML cleaning | Converts complex web pages into usable text |
๐ง Context-grounded generation | LLM answers are constrained to retrieved documentation |
๐ Source preservation | Source URLs are retained in the final response |
๐ค Groq inference | Fast model inference through Groq |
๐งฉ Library-aware queries | Supports different documentation ecosystems |
๐ ๏ธ Simple extensibility | New libraries can be added through configuration |
๐ Environment-based secrets | API keys are loaded through |
๐ป CLI-friendly | User can submit queries directly from the terminal |
๐๏ธ System Architecture
flowchart TB
U["๐จโ๐ป User"]
C["๐ฅ๏ธ MCP Client<br/>client.py"]
M["๐ FastMCP Server<br/>mcp_server.py"]
S["๐ Serper API"]
D["๐ Official Documentation"]
T["๐งน Trafilatura<br/>HTML Extraction"]
CTX["๐ฆ Clean Documentation Context"]
G["โก Groq API<br/>GPT-OSS-20B"]
A["๐ฌ Grounded Answer"]
U --> C
C --> M
M --> S
S --> D
D --> T
T --> CTX
CTX --> C
C --> G
G --> A
A --> U๐ End-to-End Request Flow
sequenceDiagram
actor User
participant Client as MCP Client
participant MCP as FastMCP Server
participant Serper as Serper Search API
participant Docs as Official Docs
participant Extractor as Trafilatura
participant Groq as Groq LLM
User->>Client: Enter query + library
Client->>MCP: call_tool("get_docs")
MCP->>Serper: Search official documentation
Serper-->>MCP: Search results
loop Top documentation results
MCP->>Docs: GET documentation page
Docs-->>MCP: HTML content
MCP->>Extractor: Extract readable text
Extractor-->>MCP: Clean documentation
end
MCP-->>Client: Documentation context + sources
Client->>Groq: Generate answer from context
Groq-->>Client: Grounded response
Client-->>User: Final answer + sources๐ง Core Design Principle
The system follows a simple but important principle:
Retrieve first. Generate second.
The LLM is not directly responsible for discovering documentation.
Instead:
SEARCH
โ
RETRIEVE DOCS
โ
CLEAN CONTENT
โ
BUILD CONTEXT
โ
GENERATEThis separation makes the system easier to reason about and reduces the possibility of unsupported answers.
๐งฉ Supported Libraries
The current implementation supports:
Library | Documentation Domain |
๐ฆ LangChain |
|
๐ฆ LlamaIndex |
|
๐ข OpenAI |
|
โก uv |
|
The mapping is maintained in mcp_server.py:
docs_urls = {
"langchain": "python.langchain.com/docs",
"llama-index": "docs.llamaindex.ai/en/stable",
"openai": "platform.openai.com/docs",
"uv": "docs.astral.sh/uv",
}Adding a new documentation source is intentionally simple.
Example:
docs_urls = {
"langchain": "python.langchain.com/docs",
"llama-index": "docs.llamaindex.ai/en/stable",
"openai": "platform.openai.com/docs",
"uv": "docs.astral.sh/uv",
"fastapi": "fastapi.tiangolo.com",
}๐ Project Structure
MCP-Docs-Intelligence/
โ
โโโ ๐ mcp_server.py
โ โโโ MCP server + documentation retrieval tool
โ
โโโ ๐ client.py
โ โโโ User-facing MCP client
โ
โโโ ๐ utils.py
โ โโโ HTML extraction + Groq LLM utility
โ
โโโ ๐ pyproject.toml
โ โโโ Project metadata and dependencies
โ
โโโ ๐ requirements.txt
โ โโโ pip-compatible dependency list
โ
โโโ ๐ README.md
โ โโโ Project documentation
โ
โโโ ๐ .env
โ โโโ Local API credentials
โ
โโโ ๐ .gitignore
โ โโโ Files excluded from Git
โ
โโโ ๐ .venv/
โโโ Python virtual environment๐ง Technology Stack
Related MCP server: MCPyDoc
FastMCP
FastMCP provides the MCP server abstraction and exposes:
@mcp.tool()
async def get_docs(query: str, library: str):This makes documentation retrieval available as a reusable MCP tool.
Serper
Serper is used for web discovery.
The search query is restricted to the selected documentation domain:
query = f"site:{docs_urls[library]} {query}"Example:
site:docs.astral.sh/uv How to publish a package with uvThis keeps the retrieval focused on the selected documentation ecosystem.
Trafilatura
Documentation pages contain navigation, scripts, menus, advertisements, and other irrelevant HTML.
Trafilatura extracts the useful text:
extracted = trafilatura.extract(
html,
include_comments=False,
include_tables=False,
favor_recall=False,
)Conceptually:
Raw HTML
โ
โโโ Navigation
โโโ Scripts
โโโ CSS
โโโ Footer
โโโ Menus
โโโ Documentation Content
โ
โผ
Trafilatura
โ
โผ
Clean DocumentationGroq
The final answer is generated using Groq's API.
Current model:
openai/gpt-oss-20bThe model receives:
System Instructions
+
User Query
+
Retrieved Documentation Contextand produces the final human-readable answer.
๐ Environment Variables
Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key
SERPER_API_KEY=your_serper_api_keyRequired credentials
Variable | Purpose |
| Authenticates requests to Groq |
| Authenticates web search requests |
Never commit your .env file.
Add this to .gitignore:
.env
.venv/
__pycache__/
*.pyc๐ฆ Installation
1. Clone the repository
git clone https://github.com/your-username/mcp-docs-intelligence.git
cd mcp-docs-intelligence2. Create a virtual environment
Windows
python -m venv .venv
.venv\Scripts\activateLinux / macOS
python3 -m venv .venv
source .venv/bin/activate3. Install dependencies
pip install -r requirements.txtOr with uv:
uv sync๐ Dependencies
The project requires:
fastmcp>=2.12.2
groq>=0.31.1
httpx>=0.28.1
python-dotenv>=1.1.1
trafilatura>=2.0.0
mcp>=1.16.0โถ๏ธ Running the Project
Start the client:
python client.pyThe client will ask:
Enter your documentation query:Example:
Enter your documentation query:
How do I publish a Python package with uv?
Enter library (langchain/openai/llama-index/uv):
uvThe client automatically launches the MCP server and executes the request.
๐ Example Request
Input
Query:
How do I publish a package with uv on GitLab?
Library:
uvInternal processing
1. Receive query
โ
2. Select uv documentation
โ
3. Build site-restricted search
โ
4. Query Serper
โ
5. Retrieve documentation pages
โ
6. Extract readable text
โ
7. Return context to client
โ
8. Send context to Groq
โ
9. Generate answer
โ
10. Display sources๐ง Grounded Answer Strategy
The client uses a system prompt similar to:
Answer ONLY using the provided context.
If information is missing, say you don't know.
Keep every 'SOURCE:' line exactly.
List sources at the end.This creates a clear separation between:
Retrieved Facts
โ
โผ
Documentation Context
โ
โผ
LLM Reasoning / Response FormattingThe model is instructed not to invent information that does not exist in the supplied context.
๐ MCP Tool
The server exposes one primary tool:
get_docs(query, library)Parameters
Parameter | Type | Description |
|
| Documentation question |
|
| Supported documentation ecosystem |
Example tool call
{
"query": "How do I create a virtual environment with uv?",
"library": "uv"
}Example response structure
SOURCE: https://docs.astral.sh/uv/...
Relevant documentation content...
SOURCE: https://docs.astral.sh/uv/...
Additional documentation content...๐ก๏ธ Error Handling
The server validates the selected documentation ecosystem:
if library not in docs_urls:
raise ValueError(
f"Library {library} not supported by this tool"
)The search request also raises HTTP errors when the external API fails:
response.raise_for_status()This prevents silent failures and makes external API problems visible.
โ๏ธ Async Architecture
The project uses Python's asynchronous execution model.
Web requests use:
async with httpx.AsyncClient() as client:The MCP tool is also asynchronous:
async def get_docs(query: str, library: str):This is important because the application is primarily I/O-bound.
Instead of blocking during network operations:
Application
โ
โโโ waiting for search API
โโโ waiting for docs page
โโโ waiting for another docs pagethe async architecture allows the runtime to manage I/O efficiently.
๐ Request Lifecycle
flowchart LR
Q["Query"] --> V["Validate Library"]
V --> S["Build site:<domain> Search"]
S --> W["Serper"]
W --> R["Top Search Results"]
R --> F["Fetch URLs"]
F --> C["Clean HTML"]
C --> X["Build Context"]
X --> L["Groq"]
L --> O["Grounded Answer"]๐งฑ Component Responsibilities
Component | Responsibility |
| Search, retrieval, cleaning orchestration and MCP tool exposure |
| User interaction, MCP execution and LLM call |
| HTML extraction and Groq API wrapper |
| Package metadata and dependencies |
| pip installation support |
| Secrets and configuration |
๐งช Example Queries
uv
How do I create and manage a virtual environment using uv?LangChain
How do I create a tool-calling agent in LangChain?LlamaIndex
How do I create a vector index in LlamaIndex?OpenAI
How do I use structured outputs with the OpenAI API?๐ Extending the Server
The architecture is deliberately simple to extend.
Add another documentation source
Update:
docs_urls = {
"langchain": "python.langchain.com/docs",
"llama-index": "docs.llamaindex.ai/en/stable",
"openai": "platform.openai.com/docs",
"uv": "docs.astral.sh/uv",
}Example:
"fastapi": "fastapi.tiangolo.com"The rest of the retrieval pipeline remains unchanged.
๐บ๏ธ Future Roadmap
The current implementation establishes the foundation for a much larger documentation intelligence platform.
Phase 1 โ Current
โ
MCP server
โ
Async retrieval
โ
Official documentation search
โ
HTML extraction
โ
Groq integration
โ
Source preservation
โ
Interactive clientPhase 2 โ Retrieval Intelligence
โฌ Multi-result ranking
โฌ Duplicate URL removal
โฌ Query rewriting
โฌ Better document chunking
โฌ Relevance scoring
โฌ Retry / timeout strategyPhase 3 โ Advanced RAG
โฌ Embedding-based retrieval
โฌ Vector database
โฌ Semantic search
โฌ Reranking
โฌ Persistent document cache
โฌ Citation-aware generationPhase 4 โ Developer Platform
โฌ Web UI
โฌ IDE integration
โฌ VS Code extension
โฌ Documentation diffing
โฌ Version-aware documentation
โฌ API migration assistant
โฌ Code generation from docs๐ฎ Possible Future Architecture
flowchart TB
USER["Developer"]
UI["Web / IDE / CLI"]
MCP["MCP Gateway"]
QUERY["Query Understanding"]
SEARCH["Hybrid Retrieval"]
WEB["Official Documentation"]
CACHE["Document Cache"]
VECTOR["Vector Database"]
RERANK["Reranker"]
CONTEXT["Context Builder"]
LLM["Groq / LLM"]
CITE["Citation Engine"]
ANSWER["Final Developer Answer"]
USER --> UI
UI --> MCP
MCP --> QUERY
QUERY --> SEARCH
SEARCH --> WEB
SEARCH --> CACHE
SEARCH --> VECTOR
WEB --> CONTEXT
CACHE --> CONTEXT
VECTOR --> RERANK
RERANK --> CONTEXT
CONTEXT --> LLM
LLM --> CITE
CITE --> ANSWER
ANSWER --> USER๐ฏ Design Philosophy
This project is built around four principles:
1. Trust the source
Prefer authoritative documentation rather than arbitrary online content.
2. Retrieve before generating
The model should work from current retrieved context rather than relying entirely on memorized knowledge.
3. Keep components replaceable
Search, extraction, MCP, and LLM layers are separated so individual components can evolve independently.
4. Make the system developer-friendly
The final interface should feel like asking a senior developer who knows where the official documentation is.
๐ Security Considerations
API keys
Never hardcode credentials:
os.getenv("GROQ_API_KEY")
os.getenv("SERPER_API_KEY")Environment files
Do not commit:
.envExternal content
Documentation retrieved from the web should be treated as external/untrusted input. Future versions should consider:
content size limits
URL allowlists
response validation
redirect validation
request retry policies
rate limiting
malicious content filtering
๐งฐ Troubleshooting
ModuleNotFoundError
Install dependencies:
pip install -r requirements.txtGROQ_API_KEY error
Verify .env contains:
GROQ_API_KEY=your_key_hereand that the project is being executed from the correct directory.
SERPER_API_KEY error
Verify:
SERPER_API_KEY=your_key_hereMCP server appears to hang
Running:
python mcp_server.pydirectly may appear to do nothing.
That is expected for a stdio MCP server because it waits for an MCP client to communicate with it.
Normally run:
python client.pyinstead.
No documentation results
Check:
The selected library is supported.
The Serper API key is valid.
The documentation domain is correct.
Internet connectivity is available.
๐ Environment Example
# Search provider
SERPER_API_KEY=your_serper_api_key
# LLM provider
GROQ_API_KEY=your_groq_api_key๐ Minimal API Flow
client.py
โ
โ call_tool()
โผ
mcp_server.py
โ
โ search_web()
โผ
Serper
โ
โ documentation URLs
โผ
fetch_url()
โ
โ raw HTML
โผ
clean_html_to_txt()
โ
โ clean text
โผ
MCP response
โ
โผ
Groq GPT-OSS-20B
โ
โผ
Final answer๐งโ๐ป Development
For local development:
git clone https://github.com/your-username/mcp-docs-intelligence.git
cd mcp-docs-intelligence
python -m venv .venvActivate the environment and install dependencies:
pip install -r requirements.txtThen configure .env and run:
python client.pyโ Project Checklist
[โ] MCP server implemented
[โ] FastMCP tool exposed
[โ] Async web requests
[โ] Serper integration
[โ] Official documentation restriction
[โ] HTML extraction
[โ] Groq integration
[โ] GPT-OSS-20B support
[โ] Environment variable configuration
[โ] Interactive query input
[โ] Source preservation
[โ] GitHub documentation
[โ] Architecture diagrams๐ What Makes This Project Different?
This is not simply a web scraper.
It is a small documentation intelligence layer that sits between a developer and the web.
The architecture creates a clear chain of responsibility:
Developer
โ
Question
โ
MCP
โ
Retrieval
โ
Official Source
โ
Content Extraction
โ
Context
โ
LLM
โ
Answer
โ
SourceThat separation is the foundation for turning this prototype into a larger developer knowledge infrastructure.
๐ Performance Characteristics
The application is primarily I/O-bound.
Potential latency contributors include:
Serper Search
+
Documentation HTTP Requests
+
HTML Extraction
+
LLM GenerationThe use of asynchronous HTTP requests reduces unnecessary blocking during network operations.
Future performance improvements can include:
Caching
Parallel fetching
Connection pooling
Result deduplication
Context compression
Persistent document storage๐ค Contributing
Contributions are welcome.
A typical contribution workflow:
git checkout -b feature/my-feature
# Make your changes
git add .
git commit -m "feat: add documentation source"
git push origin feature/my-featureThen open a pull request.
For larger architectural changes, document:
Problem
Proposed solution
Architectural impact
Backward compatibility
Testing strategy
๐ License
This project is licensed under the MIT License.
Add a LICENSE file containing the standard MIT License text before publishing the repository.
โญ Acknowledgements
Built using excellent open-source and developer infrastructure technologies:
Model Context Protocol
FastMCP
Groq
Serper
Trafilatura
httpx
Python
๐งญ Final Architecture Snapshot
โโโโโโโโโโโโโโโโโโโโโโ
โ DEVELOPER โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ MCP CLIENT โ
โ client.py โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FASTMCP SERVER โ
โ mcp_server.py โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ SERPER API โ โ DOCUMENTATION โ
โ Web Discovery โโโโโโโโโโถโ PAGES โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ TRAFILATURA โ
โ Content Cleaner โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ CONTEXT BUILDER โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ GROQ โ
โ GPT-OSS-20B โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ GROUNDED ANSWER โ
โ + SOURCES โ
โโโโโโโโโโโโโโโโโโโโโโโก Search. Extract. Ground. Answer.
MCP Docs Intelligence Server
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Versioned documentation registry and semantic search for AI tools and coding assistants.
@latest documentation and code examples to 9000+ libraries for LLMs and AI code editors in a singlโฆ
Provide your AI coding tools with token-efficient access to up-to-date technical documentation forโฆ
The documentation, as a tool your agent can call: 950+ AI-dev guides. Search + fetch tools.
Related MCP Servers
- FlicenseAqualityDmaintenanceProvides Large Language Models with real-time access to the latest documentation for Python libraries like Langchain, LlamaIndex, and OpenAI, enabling accurate and up-to-date code suggestions.1
- AlicenseNot gradedqualityCmaintenanceProvides real-time access to Python package documentation, source code, and symbol search to prevent AI hallucinations.6MIT
- FlicenseAqualityDmaintenanceEnables LLMs to dynamically search, scrape, and query official documentation of libraries like uv, OpenAI, LangChain, and LlamaIndex via Google Serper and Groq.1
- FlicenseBqualityDmaintenanceEnables AI assistants to query and search library documentation from GitHub repositories or web pages using RAG and web scraping.2
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/harmitprajapati2006/Get_Doc_MCP_Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server