Knowledge Assistant MCP Server
Provides integration with Google's Gemini models for natural language generation and embeddings, enabling the MCP server to perform LLM-based tasks and generate embeddings for document retrieval.
Provides integration with LangChain for building retrieval-augmented generation (RAG) pipelines, connecting to ChromaDB vector store and orchestrating document retrieval and synthesis.
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., "@Knowledge Assistant MCP ServerWhat is the main topic of the uploaded research paper?"
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.
Knowledge Assistant MCP Server
A multi-agent RAG (Retrieval-Augmented Generation) MCP server built with FastMCP in Python. It answers questions from your documents using a coordinator, retriever, and synthesizer agents, and includes a human-in-the-loop step where you approve or request edits before finalizing answers.
What it does
Query your knowledge base: Ask questions in natural language; the server retrieves relevant chunks and proposes an answer with citations.
Multi-agent pipeline: A coordinator decides whether to use the knowledge base, a retriever (RAG) fetches relevant documents, and a synthesizer produces a structured answer proposal.
Human-in-the-loop: You review the proposed answer and either approve it or request edits before the answer is finalized.
Add documents: Ingest text into the vector store (ChromaDB) so the assistant can answer from your own content.
Use cases: Internal knowledge assistant, FAQ over your docs, Q&A over notes or wikis, and similar RAG workflows that require a human approval step.
Related MCP server: Modular RAG System
Project Structure
knowledge-assistant-mcp/
├── src/
│ ├── server.py # FastMCP app entry point
│ ├── config/
│ │ └── settings.py # pydantic-settings (server name, API keys, model, RAG settings)
│ ├── routers/
│ │ ├── tools.py # Register MCP tools
│ │ ├── resources.py # Register MCP resources
│ │ └── prompts.py # Register MCP prompts
│ ├── tools/ # Tool implementations
│ ├── resources/ # Resource implementations
│ ├── prompts/ # Prompt content (workflow with human-in-the-loop)
│ ├── app/ # Core logic: RAG, LLM, orchestrator (coordinator/retriever/synthesizer)
│ ├── models/ # Pydantic schemas (structured outputs)
│ └── utils/ # Helpers (e.g. Opik)
├── pyproject.toml
├── .env.sample
├── Dockerfile
└── README.mdSetup
Prerequisites: Python 3.13, uv.
Clone the repository
git clone https://github.com/YOUR_USERNAME/knowledge-assistant-mcp.git
cd knowledge-assistant-mcpInstall dependencies with uv
uv syncThis creates a virtual environment (Python 3.13) and installs dependencies from pyproject.toml.
Configure environment variables
cp .env.sample .envEdit .env and set at least:
GOOGLE_API_KEY(required): Used for Gemini (LLM and embeddings).
Get it from Google AI Studio.
Optional:
OPIK_API_KEY: For observability (tracing). Get it from Opik.OPIK_PROJECT_NAME: Opik project name (default:knowledge-assistant).MODEL_NAME: Gemini model (default:gemini-2.0-flash).CHROMA_PERSIST_DIR: Directory for ChromaDB (default:./chroma_data).CHROMA_COLLECTION: Collection name (default:knowledge_base).RAG_TOP_K: Number of chunks to retrieve (default:5).EMBEDDING_MODEL: Google embedding model for RAG (default:models/gemini-embedding-001). Override if your API uses a different model.
Run the server
Stdio (for Cursor / Claude Desktop):
uv run python -m src.server --transport stdioHTTP:
uv run python -m src.server --transport http --port 8000Or use the entry point:
uv run knowledge-assistant-mcp --transport stdioYou should see the FastMCP banner and the process waiting for connections; stop with Ctrl+C.
Environment variables
Variables you can set in .env, and where to get API keys:
Environment variables summary
Variable | Required | Description |
| Yes | Google AI (Gemini) API key – Google AI Studio |
| No | Opik API key for observability – Opik |
| No | Opik project name (default: |
| No | Gemini model (default: |
| No | ChromaDB persistence directory (default: |
| No | ChromaDB collection name (default: |
| No | Number of chunks to retrieve (default: |
| No | Google embedding model for RAG (default: |
Connecting from Cursor (or another MCP client)
Add this to your Cursor MCP settings (e.g. .cursor/mcp.json), replacing the path and API key as needed:
{
"mcpServers": {
"knowledge-assistant": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/knowledge-assistant-mcp",
"run",
"python",
"-m",
"src.server",
"--transport",
"stdio"
],
"env": {
"GOOGLE_API_KEY": "your-google-api-key-here"
}
}
}
}You can also rely on a .env file in the project directory and omit env or only set ENV_FILE_PATH if your client supports it.
How to use
Once the server is running and connected (e.g. in Cursor):
Add documents (optional but needed for RAG answers)
Use the add_documents tool: passtext(the content to ingest) and optionallysource(e.g."Context Engineering Book"). The server chunks and embeds the text into ChromaDB. You can add more documents anytime.Ask a question
Use the query_knowledge_base tool with your question. The server runs the multi-agent pipeline (coordinator → retriever → synthesizer) and returns a proposed answer with citations.Human-in-the-loop
Review the proposal, then call approve_or_edit_answer:To accept:
approved=True, sameproposal_answeras returned.To request changes:
approved=False, sameproposal_answer, and setuser_feedbackto your requested edits. The server can then produce a revised answer.
You can also use search_knowledge_base to only search the vector store (no generated answer), and the knowledge_assistant_workflow prompt as a step-by-step guide. The resource knowledge-assistant://server_info exposes server metadata and RAG settings.
Features
Core:
FastMCP server (src/server.py) with tools (query_knowledge_base, approve_or_edit_answer, add_documents, search_knowledge_base), one workflow prompt (knowledge_assistant_workflow) with a human-in-the-loop step (review proposal → approve or edit via approve_or_edit_answer), uv-based setup, and the structure above. No API keys in the repo; .env.sample and .gitignore are included.
Additional:
Multi-agent orchestration – Coordinator, retriever (RAG), and synthesizer agents in
src/app/orchestrator.py.RAG with vector database – ChromaDB + LangChain + Google embeddings;
search_knowledge_baseandadd_documents; persistence viaCHROMA_PERSIST_DIR.MCP resource –
knowledge-assistant://server_infoexposes server name, version, collection, and RAG settings.Human-in-the-loop validation – Workflow returns a proposal; the user approves or requests edits with
approve_or_edit_answerbefore finalizing.Structured outputs – Pydantic models (
AnswerProposal,SearchResult,RetrievedChunk,SynthesisResult) for synthesizer and API responses.Observability (Opik) – Optional tracing when
OPIK_API_KEYis set.
Docker
Build and run with Docker:
docker build -t knowledge-assistant-mcp .
docker run --rm -e GOOGLE_API_KEY=your-key -v $(pwd)/chroma_data:/app/chroma_data knowledge-assistant-mcp --transport stdioFor HTTP on port 8000:
docker run --rm -p 8000:8000 -e GOOGLE_API_KEY=your-key -v $(pwd)/chroma_data:/app/chroma_data knowledge-assistant-mcp --transport http --port 8000License
MIT (or your chosen license).
Available Tools
4 toolsadd_documentsA
Add a document (text) to the knowledge base. Use source to label where it came from.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| source | No | user_input |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description does not disclose any behavioral traits beyond the basic action. It does not mention whether the operation is idempotent, requires authentication, overwrites existing documents, or how it handles duplicates—critical context for a write operation.
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 two concise sentences with no filler or redundant information. It front-loads the primary action and then clarifies the optional parameter in a direct, efficient manner.
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 is simple with only two parameters and an output schema exists, so the description does not need to explain return values. However, the lack of behavioral transparency (e.g., side effects, permissions) leaves gaps for a write operation, making the description minimally complete for its complexity.
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?
With 0% schema description coverage, the description adds value by explaining that 'text' is the document content and 'source' is a label for provenance. This goes beyond the schema's type and default information, providing meaningful semantic context for both 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 clearly states the tool's function: adding a text document to the knowledge base. It uses a specific verb ('Add') and resource ('knowledge base'), and the purpose is distinct from sibling tools that query, search, or approve.
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 provides clear context that this tool is for adding documents, implying it should be used when you want to insert new content rather than retrieve or edit existing content. It does not explicitly mention alternatives or exclusions, but the purpose is self-evident enough to guide usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
approve_or_edit_answerA
Human-in-the-loop: approve the proposed answer from query_knowledge_base, or request edits. Set approved=True to accept, or approved=False and provide user_feedback for changes.
| Name | Required | Description | Default |
|---|---|---|---|
| approved | Yes | ||
| user_feedback | No | ||
| proposal_answer | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It explains the decision logic (approved=True/False) and that user_feedback is needed for edits, which is useful. However, it does not disclose side effects, whether approval modifies the knowledge base, or any permissions/irreversibility. The tool's outcome beyond the parameters is left implicit.
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 two sentences with no filler. It front-loads the core purpose ('Human-in-the-loop') and immediately provides the usage pattern. Every phrase contributes to understanding the tool's function.
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 tool's moderate complexity (3 params, 2 required) and the existence of an output schema, the description is adequate but not rich. It covers the branching logic and references the source (query_knowledge_base), but omits preconditions, post-conditions, or what happens next in the pipeline. This leaves room for agent confusion about workflow integration.
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 explains 'approved' (accept or request changes) and 'user_feedback' (changes to request), but 'proposal_answer' is only indirectly referenced as 'the proposed answer'. While this adds meaning beyond the empty schema, one parameter remains underspecified.
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 tool's purpose: to approve or request edits for an answer proposed by query_knowledge_base. It uses a specific verb ('approve', 'request edits') and identifies the resource ('the proposed answer'), distinguishing it from sibling tools like query_knowledge_base, add_documents, and search_knowledge_base.
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 use case: after obtaining a proposal from query_knowledge_base, this tool decides on acceptance or revision. It gives clear context ('Human-in-the-loop') and ties the tool to a parent process, but does not explicitly name alternatives or state when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
query_knowledge_baseA
Ask the knowledge assistant a question. Runs a multi-agent pipeline: coordinator -> retriever (RAG) -> synthesizer. Returns a proposed answer for your review. After reviewing, call approve_or_edit_answer to approve or request edits (human-in-the-loop).
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| top_k | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It goes beyond a simple query by revealing the multi-agent orchestration, the fact that the answer is only a proposal, and the human-in-the-loop requirement. This gives the agent a clear understanding of the tool's non-final and collaborative nature.
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 three sentences long, each serving a distinct purpose: stating the action, explaining the internal pipeline, and providing the next-step workflow. It is front-loaded with the primary purpose and contains no redundant or irrelevant information.
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 description is largely complete for a query tool: it covers the action, the pipeline, and the follow-up workflow. The existence of an output schema means return values need not be detailed. However, the missing parameter semantics for 'top_k' and the lack of explicit contrast with search_knowledge_base leave minor gaps in overall completeness.
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 for parameter meaning. The 'query' parameter is implicitly explained as the question to ask, but 'top_k' is not mentioned at all, leaving its role (e.g., number of retrieved documents) ambiguous. This is a significant gap given the lack of schema descriptions.
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 ('Ask') and resource ('knowledge assistant'), and clearly explains the multi-agent pipeline (coordinator -> retriever -> synthesizer). It distinguishes the tool from siblings by mentioning it returns a proposed answer for review, which is unlike a direct search or an approval tool.
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 provides clear workflow context by instructing the user to call approve_or_edit_answer after reviewing, which implicitly indicates a sequential use. However, it does not explicitly differentiate when to use this tool versus search_knowledge_base, missing the 'when-not' guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_knowledge_baseA
Search the knowledge base only (retriever); returns chunks without generating an answer.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| top_k | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the key behavioral trait that this is a retriever-only tool returning chunks, which is significant. However, it does not detail output format or any limitations, but the output schema exists.
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 is front-loaded and contains no unnecessary words. It effectively communicates the core behavior.
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?
For a simple search tool with an output schema, the description is fairly complete. It clearly states the retriever-only nature and what is returned (chunks), but could more explicitly address when to use it over siblings. Still, the phrase 'only (retriever)' provides a hint.
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%, and the description does not explain what 'query' or 'top_k' mean. While 'query' is self-evident from the tool name, 'top_k' is ambiguous. The description provides no additional meaning beyond the schema.
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 tool searches the knowledge base and returns chunks without generating an answer. This distinguishes it from sibling tools like query_knowledge_base, which presumably generates answers.
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 when to use this tool ('only retriever', 'without generating an answer') but does not explicitly name alternatives or provide exclusion criteria. It gives clear context, though a direct pointer to query_knowledge_base would be stronger.
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.
4 tool updates
v0.1.0- First observed
add_documents - First observed
approve_or_edit_answer - First observed
query_knowledge_base - First observed
search_knowledge_base
TDQS
Each tool has a clearly distinct purpose: query_knowledge_base runs the full RAG pipeline and returns a proposed answer, search_knowledge_base performs raw retrieval only, approve_or_edit_answer handles the human-in-the-loop review step, and add_documents ingests new content. Although query and search both access the knowledge base, their outputs and workflows are fundamentally different and clearly described.
All tool names follow a consistent verb_noun pattern in snake_case: query_knowledge_base, approve_or_edit_answer, add_documents, search_knowledge_base. The naming is uniform and predictable, with no mixed conventions or ambiguous verbs.
With exactly 4 tools, the server is well-scoped for its purpose. Each tool addresses a distinct stage of the knowledge assistant workflow (ingestion, retrieval, synthesis, and review), and the count feels neither sparse nor bloated for the domain.
The core workflow is covered: add documents, search raw chunks, generate a proposed answer, and approve/request edits. However, there are minor gaps in document lifecycle management—no tools for deleting, updating, or listing documents—which could force workarounds in some use cases.
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
Human-in-the-loop for AI agents over MCP: durable approvals with a hosted review page & audit trail
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for agentverse documentation, generated by doc2mcp.
Related MCP Servers
- AlicenseAqualityAmaintenanceA multi-agent Retrieval-Augmented Generation system exposed as an MCP server. Ask a question and a LangGraph pipeline plans the retrieval, pulls evidence from a pgvector knowledge base, optionally augments it with live web research, drafts a cited answer, and then self-critiques it for grounding — revising until the answer is supported by the sources.31MIT
- FlicenseNot gradedqualityBmaintenanceMCP server for a modular RAG system that enables natural language question answering over enterprise documents with intent-aware routing, adaptive retrieval, and citation-backed responses.-
- AlicenseNot gradedqualityAmaintenanceMCP server for local RAG over personal notes, PDFs, and documents, enabling plain-English querying and hybrid search with multi-hop context expansion.MIT
- AlicenseNot gradedqualityBmaintenanceMCP server providing tools for entity extraction, query refinement, and relevance checking to build Agentic RAG applications.MIT
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/SMGilliatt/knowledge-assistant-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server