Nexla MCP Document Q&A Server
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., "@Nexla MCP Document Q&A ServerWhat are the key conclusions in the climate report?"
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.
Nexla Technical Assignment: MCP Document Q&A Server
This repository contains my implementation of a Model Context Protocol (MCP) server designed to provide document intelligence over PDF files. The server allows an AI client (such as Claude Desktop or the MCP Inspector) to query unstructured PDF documents and retrieve grounded answers with source citations.
I built the system using a local-first Python stack. All PDF parsing, vector search, and LLM inference run entirely on-device with zero external API calls.
1. System Design and Component Choices
When designing this system, I focused on creating a clean, modular pipeline with a clear separation of concerns between ingestion, retrieval, prompt orchestration, and tool exposure.
+-------------------+
| MCP Client |
| (Claude Desktop) |
+---------+---------+
| stdio / JSON-RPC
+---------v---------+
| MCP Server |
| (src/server.py) |
+----+---------+----+
| |
+-----------------+ +-----------------+
| |
+--------v---------+ +---------v---------+
| Vector Retriever | | Active Metadata |
| (ChromaDB + | | Engine |
| MiniLM-L6-v2) | | (Nexset Profile) |
+--------+---------+ +-------------------+
|
| Relevant Context
+--------v---------+
| RAG Generator |
| (Ollama llama3.2)|
+------------------+Component Selection Table
Layer | Selection | Justification |
MCP Framework |
| Clean Python decorators for tool registration while adhering strictly to standard MCP JSON-RPC protocol |
PDF Extraction |
| High-speed C-backed page parsing. Benchmarked faster than |
Embeddings |
| Generates 384-dimensional dense vectors locally on CPU with minimal latency (~90MB model size) |
Vector Store |
| Persistent on-disk vector database using cosine distance metrics with zero extra server setup |
Local LLM |
| Runs locally on CPU/GPU. Setting temperature to |
Related MCP server: PDF RAG MCP Server
2. Nexla Architecture Alignment
Nexla emphasizes metadata-driven integrations and virtualized data products called Nexsets. I structured this MCP server to reflect those core concepts:
Virtual Data Product Abstraction (Nexset Profiles)
Rather than treating PDFs as plain text strings, my ingestion pipeline computes a NexsetMetadataProfile for every document. It infers topic tags, extracts structural headings, counts words, and calculates estimated reading time.
Agents can inspect this schema using the get_nexset_schema tool before running queries.
Grounded Context Compounding
To prevent hallucinations, the generator constructs a strict system prompt. The LLM is instructed to answer questions using only the retrieved passages. If the context does not contain enough information, the model states that explicitly. Each source reference includes the document title, page number, and vector relevance score.
3. Tool Reference
The server exposes four MCP tools for AI agents:
Tool Name | Purpose | Key Inputs | Expected Output |
| Grounded Q&A over indexed PDFs |
| Answer string + list of source citations (document, page, score) |
| Inspect auto-generated Nexset profile |
| Metadata JSON with topic tags, word metrics, headings, and governance tags |
| List index registry & statistics | None | JSON summary of indexed documents, total pages, and chunk counts |
| Executive document summary |
| High-level summary of main topics and referenced page numbers |
4. Setup and How to Run
Requirements
Python 3.10 or higher
Ollama installed and running (
ollama pull llama3.2)
Installation Steps
Clone the repository and enter the directory:
git clone https://github.com/Bhanunikhil/MCP-Server_Nexla.git cd MCP-Server_NexlaSet up a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate pip install -r requirements.txtPlace PDF documents in the
data/folder.
Running the Server
Standard MCP Server (for Claude Desktop or standard clients):
python -m src.serverInteractive Command Line Tool:
python ask.pyMCP Web Inspector:
fastmcp dev src/server.py
5. Technical Challenges Addressed in My Implementation
When building this MCP server, I focused on solving common technical obstacles that arise when integrating unstructured enterprise PDF data with AI models. The table below outlines these challenges and the specific technical solutions I engineered in this codebase:
Real-World Challenge | Problem Impact | Technical Solution Implemented |
Nested Directory Hierarchies | Enterprise document drops use nested subfolders ( | Implemented recursive pattern discovery ( |
Vector Memory Overflow on Large Files | Indexing multi-hundred page PDFs in a single call causes memory spikes and payload exceptions in vector stores. | Implemented batched upserts ( |
Metadata Invisibility & Token Waste | Basic RAG models treat PDFs as dumb text strings, forcing LLMs to spend expensive context tokens just to discover document structure. | Built the |
Context Fragmentation from Naive Chunking | Slicing text at rigid character limits cuts sentences in half, causing fragmented context and degraded embedding quality. | Built a sentence-aware chunker in |
6. My Workflow and Use of AI Tooling
I used AI coding tools during development to speed up repetitive tasks while staying actively involved in architecture, debugging, and system tuning.
Engineering Decisions & AI Matrix
Task / Focus Area | AI Assistance | My Engineering Decisions & Overrides |
Directory Discovery | Generated flat | Modified to recursive globbing ( |
Vector Indexing | Generated unbatched | Refactored to batch upserts ( |
Metadata Engine | Defaulted to plain text chunking | Designed |
Windows Console I/O | Hardcoded Unicode emojis in print statements | Sanitized console print statements to standard text to avoid |
6. Project Layout
MCP-Server_Nexla/
├── README.md # Documentation and technical overview
├── interaction_log.md # Sample Q&A interactions with source citations
├── requirements.txt # Python dependencies
├── pyproject.toml # Project packaging settings
├── .env.example # Environment configuration template
├── ask.py # CLI script for interactive testing
├── data/ # Directory containing sample PDF documents
├── src/
│ ├── config.py # Configuration loading logic
│ ├── ingestion.py # PDF text extraction, chunking, and metadata engine
│ ├── retriever.py # Embedding generation and ChromaDB vector search
│ ├── generator.py # Ollama RAG prompt handling
│ ├── tools.py # MCP tool definitions
│ └── server.py # FastMCP entry point
└── tests/
└── test_tools.py # Unit testsThis 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.
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/Bhanunikhil/MCP-Server_Nexla'
If you have feedback or need assistance with the MCP directory API, please join our Discord server