mcp-document-assistant
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-document-assistantlist the available documents"
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 Document Assistant
A local AI document assistant demonstrating the Model Context Protocol (MCP) using Python, FastMCP, Ollama, and Qwen3:4B.
This project was developed while studying Anthropic's Introduction to Model Context Protocol course. The original course examples use Claude; this implementation explores the same MCP concepts using a locally hosted Qwen3:4B model through Ollama.
Overview
The project demonstrates how an AI application can communicate with external capabilities through the Model Context Protocol.
The implementation contains:
An MCP server built with FastMCP
An MCP client
MCP tools
MCP resources
MCP prompts
A local Qwen3:4B model running through Ollama
An interactive command-line interface
MCP Inspector for testing and debugging
The document assistant uses a simple in-memory document store to demonstrate how an LLM can discover, retrieve, modify, and work with external information through MCP.
Related MCP server: Docalyze
Architecture
┌───────────────────┐
│ User │
│ CLI Interface │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Qwen3:4B │
│ Ollama │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ MCP Client │
│ │
│ Tools │
│ Resources │
│ Prompts │
└─────────┬─────────┘
│
MCP / STDIO
│
▼
┌───────────────────┐
│ MCP Server │
│ FastMCP │
└─────────┬─────────┘
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
Tools Resources Prompts
│ │ │
└──────────────┼──────────────┘
│
▼
┌───────────────────┐
│ Document Store │
└───────────────────┘MCP Tools
The MCP server exposes three document-related tools.
list_documents
Returns a list of all available document IDs.
read_document
Reads the contents of a document using its document ID.
edit_document
Updates the contents of an existing document.
Tool Workflow
User Request
│
▼
Qwen3
│
▼
MCP Client
│
▼
MCP Server
│
▼
Tool Execution
│
▼
Tool Result
│
▼
Qwen3
│
▼
Final ResponseMCP Resources
The MCP server exposes document resources:
docs://documents
docs://documents/{doc_id}docs://documents
Returns the list of available document IDs.
docs://documents/{doc_id}
Returns the contents of a specific document.
Tools vs Resources
The project demonstrates the distinction between MCP tools and resources.
Tools perform actions or operations:
list_documents
read_document
edit_documentResources provide data or contextual information:
docs://documents
docs://documents/{doc_id}In simple terms:
MCP Primitive | Purpose |
Tools | Perform actions |
Resources | Provide data/context |
Prompts | Provide reusable instructions/workflows |
MCP Prompts
The project also demonstrates MCP prompts.
A prompt is a reusable instruction or workflow exposed by the MCP server.
For example:
/format report.pdfA formatting workflow can instruct the model to:
Identify the requested document.
Retrieve the document.
Understand its contents.
Format the content using Markdown.
Preserve the original meaning.
Apply appropriate headings, lists, tables, and other Markdown structures.
Update the document when required.
The purpose is to demonstrate how MCP prompts can provide standardized workflows to an AI application.
Example Documents
The demonstration server contains:
deposition.md
report.pdf
financials.docx
outlook.pdf
plan.md
spec.txtFor demonstration purposes, these documents are represented using an in-memory Python dictionary.
Example Interaction
List Available Documents
> list the available documents
Response:
deposition.md
report.pdf
financials.docx
outlook.pdf
plan.md
spec.txtReference a Document
> What does @plan.md say?
Response:
The plan outlines the steps for the project's implementation.The @ syntax allows the user to reference a document directly from the CLI.
Read and Summarize a Document
> Read plan.md and summarize it.The application retrieves the document and provides its contents to the model so that the model can generate a response.
Local LLM with Ollama
This implementation uses:
Qwen3:4Bthrough:
OllamaThe model runs locally instead of requiring a cloud-hosted LLM API.
The relationship is:
Qwen3:4B
│
▼
Ollama
│
▼
MCP-enabled Application
│
▼
MCP Client
│
▼
MCP ServerCheck installed models:
ollama listPull Qwen3:4B if necessary:
ollama pull qwen3:4bClaude vs Qwen3
The original Anthropic course examples use Claude.
This implementation uses Qwen3:4B through Ollama to demonstrate that MCP is not inherently tied to Claude.
Course Architecture
Claude
│
▼
MCP Client
│
▼
MCP ServerLocal Implementation
Qwen3:4B
│
▼
Ollama
│
▼
MCP Client
│
▼
MCP ServerThe important concept is that the LLM, MCP client, and MCP server are separate components.
The MCP server can therefore provide capabilities independently of the underlying model provider.
MCP Inspector
MCP Inspector is a graphical development and debugging interface for MCP servers.
It can be used to inspect:
Server connectivity
Available tools
Tool descriptions
Tool input schemas
Tool calls
Tool results
Resources
Resource contents
Prompts
Prompt arguments
Start MCP Inspector with:
uv run mcp dev mcp_server.pyThe command starts the Inspector and provides a local browser URL.
The Inspector was used during development to verify that the MCP server correctly exposes its capabilities.
Project Structure
mcp-document-assistant/
│
├── core/
│ ├── __init__.py
│ ├── chat.py
│ ├── claude.py
│ ├── cli.py
│ ├── cli_chat.py
│ ├── ollama.py
│ └── tools.py
│
├── main.py
├── mcp_client.py
├── mcp_server.py
├── pyproject.toml
├── uv.lock
├── README.md
└── .gitignoreMain Components
mcp_server.py
Defines the MCP server using FastMCP.
The server contains:
Document data
MCP tools
MCP resources
MCP prompts
mcp_client.py
Implements the MCP client.
The client handles:
Starting the MCP server process
Establishing the MCP transport
Initializing the MCP session
Listing available tools
Calling tools
Listing prompts
Retrieving prompts
Reading resources
Closing the MCP connection
core/chat.py
Contains the main chat workflow.
The general workflow is:
User Query
│
▼
LLM
│
▼
Tool Request
│
▼
MCP Client
│
▼
MCP Server
│
▼
Tool Result
│
▼
LLM
│
▼
Final Responsecore/tools.py
Manages MCP tool discovery and execution.
It handles:
Tool discovery
Finding the appropriate MCP client
Tool execution
Processing tool results
core/cli_chat.py
Provides document-specific chat functionality.
It handles:
Document references using
@MCP resources
MCP prompts
Document retrieval
Prompt processing
core/cli.py
Provides the interactive command-line interface.
It includes:
Command completion
Resource completion
Prompt completion
Command history
Keyboard bindings
Interactive chat
core/ollama.py
Provides the local Ollama model integration used by the application.
Requirements
Python 3.10+
uvOllama
Qwen3:4B
MCP Python SDK
prompt-toolkit
python-dotenv
Installation
Clone the repository:
git clone https://github.com/SamamaSaleem/mcp-document-assistant.git
cd mcp-document-assistantInstall dependencies:
uv syncPull Qwen3:4B:
ollama pull qwen3:4bVerify the model:
ollama listExpected model:
qwen3:4bRunning the Application
From the project directory:
uv run main.pyThe application provides an interactive CLI.
Example:
> list the available documents
Response:
deposition.md
report.pdf
financials.docx
outlook.pdf
plan.md
spec.txtReference a document:
> What does @plan.md say?Ask the assistant to retrieve and summarize a document:
> Read plan.md and summarize it.Running MCP Inspector
To inspect the MCP server independently:
uv run mcp dev mcp_server.pyMCP Inspector provides a graphical interface for testing the server's MCP capabilities.
The server exposes:
Tools
├── list_documents
├── read_document
└── edit_document
Resources
├── docs://documents
└── docs://documents/{doc_id}
Prompts
└── formatLearning Objectives
This project was built to gain practical understanding of:
Model Context Protocol
MCP client/server architecture
FastMCP
MCP tools
MCP resources
MCP prompts
Tool discovery
Tool execution
Resource discovery
Resource retrieval
Prompt retrieval
Prompt-based workflows
MCP Inspector
Local LLM inference
Ollama
Qwen3
Async Python
uvLLM tool calling
Key Architectural Takeaway
The most important concept demonstrated by this project is the separation between the LLM, MCP client, and MCP server.
The LLM provides reasoning and language understanding.
The MCP client provides the connection between the AI application and MCP servers.
The MCP server exposes capabilities through standardized MCP primitives.
LLM
│
│ reasoning / tool selection
▼
MCP Client
│
│ MCP communication
▼
MCP Server
│
┌──────────┼──────────┐
│ │ │
▼ ▼ ▼
Tools Resources Prompts
│ │ │
└──────────┼──────────┘
│
▼
External Data
/ CapabilitiesThis separation allows MCP servers to be used independently of a particular model provider.
Course
This project was developed while completing:
Introduction to Model Context Protocol (MCP)
Anthropic Academy
The course provided the conceptual and practical foundation for the MCP components demonstrated in this repository.
The project also explores adapting the course architecture to a local Qwen3:4B model through Ollama.
Status
Educational / Portfolio Project
The current implementation demonstrates MCP concepts using:
Python
FastMCP
MCP Client
MCP Server
Qwen3:4B
Ollama
MCP InspectorThe document store is currently implemented in memory for demonstration purposes.
Future Improvements
Potential future improvements include:
Persistent document storage
Real PDF parsing
Real DOCX parsing
File-system based MCP resources
Additional document manipulation tools
Streaming responses
Multiple MCP servers
Database MCP tools
Search MCP tools
Web MCP tools
RAG integration
Vector database integration
Persistent conversation history
More advanced agentic workflows
MCP authentication and authorization
Support for additional local LLMs
Support for cloud-hosted LLM providers
License
This project is intended for educational and portfolio purposes.
Available Tools
3 toolsedit_documentC
Edit the contents of an existing document.
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | ||
| content | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description is the sole source for behavioral disclosure. It does not mention whether the edit overwrites the entire content, creates a new version, or handles missing documents, and it gives no indication of required permissions or side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no unnecessary words. It is appropriately concise for a simple tool, though it lacks supporting detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has two required parameters and an output schema, but the description is minimal. It does not cover preconditions, side effects, or behavior on failure, leaving the agent underinformed for a tool that modifies state.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema lists 'doc_id' and 'content' with zero description coverage. The description adds no additional meaning beyond the word 'contents,' failing to clarify the expected format of 'content' or the role of 'doc_id.'
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states 'Edit the contents of an existing document,' which clearly names the action (edit), the resource (document), and the scope (existing). This directly distinguishes it from sibling tools 'list_documents' and 'read_document'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives, nor any exclusion criteria. The description only states what it does, leaving usage implied at best.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_documentsA
Return a list of all available document IDs.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for behavioral disclosure. It states the tool returns a list of all available document IDs, which implies a read-only action, but it does not explicitly mention side effects, safety, or any limitations. It is transparent about the primary behavior but lacks detail beyond that.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and easy to parse, earning a perfect score for conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the zero-parameter schema and existence of an output schema, the description adequately captures the tool's function. It does not explain nuances like 'available' or provide retrieval context, but for a simple list tool with no inputs, the description is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and the schema confirms this with 100% coverage. Per the scoring rule, a baseline of 4 is appropriate because the description cannot add value for nonexistent parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Return a list' and identifies the resource 'document IDs', clearly distinguishing it from sibling tools read_document and edit_document. This is a precise and unambiguous statement of the tool's function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is used to obtain document IDs for subsequent read/edit operations, but it does not explicitly state when to use it versus alternatives or provide exclusions. Contextual clues from sibling names suggest the use case, but guidance is not explicitly provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_documentA
Return the contents of a document given its document ID.
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the behavioral disclosure burden. It states the core read operation but does not mention error behavior, return format, or any other side effects. The read-only nature is implied by the name, but no additional context is provided. It neither contradicts annotations nor adds significant depth beyond the obvious.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no filler. It states the action and the key input in minimal words, earning every word. It is concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a simple tool with one parameter and an output schema, so the description need not explain return values. It sufficiently covers the core function and identifies the required input. However, it could be more complete by explicitly guiding when to use this tool versus siblings, which would elevate the contextual guidance.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does so by explaining that doc_id is the 'document ID' that identifies the document to read. This gives the parameter meaning beyond the bare schema property name, though it does not specify how to obtain the ID (e.g., from list_documents) or the expected format.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Return the contents'), the resource ('a document'), and the condition ('given its document ID'). It is immediately distinguishable from siblings list_documents (listing) and edit_document (modifying), so the purpose is specific and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The usage is implied: if you have a document ID and need its contents, use this tool. However, there is no explicit guidance on when not to use it or which alternative (e.g., list_documents for metadata) to choose. No alternatives are named, so it does not fully meet the 'explicit when/when-not' standard.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v0.1.0- First observed
edit_document - First observed
list_documents - First observed
read_document
TDQS
Each tool has a clearly distinct purpose: listing document IDs, reading a document's contents, and editing an existing document. There is no overlap or ambiguity between them.
All tool names follow a consistent verb_noun pattern: list_documents, read_document, edit_document. The naming is predictable and easy to infer.
With only 3 tools, the server is tightly focused on core document operations. Each tool serves a distinct need, and the count is well within the ideal range.
The tool surface covers listing, reading, and editing documents but lacks create and delete operations, which are fundamental to document lifecycle management. This is a significant gap that will likely force agents to rely on external processes for these actions.
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
DocBase MCP server for AI agents
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI assistants to perform semantic searches over local document collections using multi-context organization and automatic OCR. It supports various file formats including PDF, DOCX, and images, ensuring all data processing remains local and private.7MIT
- AlicenseBqualityDmaintenanceAn MCP server that lets AI assistants read and visually analyze local documents — PDFs, Excel spreadsheets, CSV files, Word documents, PowerPoint presentations, and images.466MIT
- AlicenseNot gradedqualityDmaintenanceA simple MCP server for local documentation with RAG capabilities, enabling AI assistants to access and search local documents.2MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Google Docs and Sheets that enables AI assistants to read, create, edit, style, export, and collaborate on documents using local OAuth authentication.26MIT
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/SamamaSaleem/mcp-document-assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server