Skip to main content
Glama
vianel

MCP Knowledge Base Server

by vianel

MCP Knowledge Base Server

This folder contains the MCP server and unstructured-text ingestion pipeline for the support-ticket triage demo.

The server exposes knowledge-base articles and sample tickets through MCP tools. The search tool is backed by a local SQLite vector index built from Markdown files in data/kb/.

Files

mcp/
├── main.py              # FastMCP server
├── pipeline.py          # Ingest, chunk, embed, and store KB documents
├── vector_store.py      # SQLite vector search helpers
├── models.py            # Pydantic models returned by tools
└── data/
    ├── kb/              # Source knowledge-base articles
    ├── tickets/         # Sample support tickets
    └── index.db         # Generated SQLite index

Related MCP server: Tiger Salesforce MCP Server

Tools

The MCP server currently exposes:

  • search_kb(query: str) -> list[Chunk] Semantic search over indexed KB chunks.

  • get_article(name: str) -> str Fetch a full KB article by filename.

  • list_tickets(status: str) -> list[Ticket] List sample tickets by status.

Setup

Install dependencies:

uv sync

Set the Gemini API key used for embeddings:

export GEMINI_API_KEY="..."

Build The Index

Run the ingestion pipeline:

uv run python pipeline.py

The pipeline:

  1. Reads Markdown files from data/kb/.

  2. Normalizes and chunks each document.

  3. Creates embeddings with gemini-embedding-001.

  4. Stores chunks and embeddings in data/index.db.

  5. Uses SHA-256 hashes to skip unchanged documents on reruns.

Run The Server

Start the MCP server over stdio:

uv run python main.py

Most clients, including the ADK agent in ../agent, launch this command as a subprocess instead of running it manually.

Client Config Snippet

Example stdio client configuration:

{
  "mcpServers": {
    "kb-server": {
      "command": "/Users/vianel/Workspace/samples/mcp/.venv/bin/python",
      "args": ["/Users/vianel/Workspace/samples/mcp/main.py"],
      "env": {
        "GEMINI_API_KEY": "${GEMINI_API_KEY}"
      }
    }
  }
}

Smoke Tests

Rebuild the index and check that reruns skip unchanged files:

uv run python pipeline.py
uv run python pipeline.py

Then run the agent-side discovery script from ../agent:

cd ../agent
uv run python discovery.py

You should see the MCP tools discovered by the client.

Available Tools

4 tools
addD
ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_articleB

Responsible to obtain an article Args: name: the filename of the article Returns: the content of the article in string

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description is the sole source of behavioral info. It only mentions returning the content as a string, but lacks disclosure of side effects, authentication requirements, rate limits, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and to the point, with three lines covering purpose, parameters, and returns. No wasted words, though it could be slightly more structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no annotations), the description covers the basic functionality and return format. However, it omits usage context, error handling, and any additional behavioral details, making it adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter 'name' with no description (0% schema coverage). The description clarifies that 'name' is the filename of the article, adding meaning beyond the schema. This adequately compensates for the lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool obtains an article by filename and returns its content. It distinguishes from sibling tools like list_tickets (listing) and search_kb (searching) by specifying getting a single article. However, it could be more explicit about its specific use case.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like add, list_tickets, or search_kb. It only describes the basic function without context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_ticketsC

List all the tickets by status Args: a: The status of the ticket Returns: The ticket content

ParametersJSON Schema
NameRequiredDescriptionDefault
statusYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It states it lists tickets and returns content, but lacks details on side effects (e.g., read-only), pagination, or limits. As a list tool, it is likely safe but not transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short, with the main purpose upfront. However, the 'Args:' and 'Returns:' section uses a non-standard parameter name, and the structure could be clearer. Slightly wordy due to the redundant format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With one required parameter and an output schema (unspecified), the description only states 'The ticket content' for returns, which is vague. It doesn't address pagination, limits, or how the list is ordered. Given the existence of siblings, it is minimally complete but not thorough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning for the parameter by saying 'The status of the ticket', but uses the wrong name 'a' instead of the schema's 'status'. Schema has 0% description coverage, so description partially compensates but with an error.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it lists tickets by status, which distinguishes it from siblings like 'add' and 'search_kb'. However, the description uses 'a' instead of 'status' for the parameter name, which could cause minor confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implied usage: when you need to list tickets filtered by status. No explicit guidance on when not to use it (e.g., for search or other operations). No mention of alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_kbA
    Semantic search over the knowledge base. Pass a natural-language question or problem 
    description; returns the most relevant document chunks ranked by similarity, each with 
    its source doc_id, a text snippet, and a score (higher = more relevant).
    for matches
ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries burden. Discloses semantic search, ranking by similarity, and output fields. Does not mention authentication, rate limits, or potential side effects, but as a read-only search, this is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, first states purpose, second describes output. No wasted words, front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with one parameter, description covers input, output fields, and ranking. Output schema exists, so return value details are sufficiently covered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter 'query' has 0% schema description coverage; description adds that it is a natural-language question, providing meaning beyond the bare type 'string'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it performs semantic search over the knowledge base, specifying input as natural-language question and output as relevant chunks with doc_id, snippet, and score. Distinct from siblings (add, get_article, list_tickets).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to pass a natural-language question, implying use for searching KB. Does not provide explicit when-not-to-use or alternatives, but siblings are sufficiently different to infer context.

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.

  1. 4 tool updatesv0.1.0
    • First observedadd
    • First observedget_article
    • First observedlist_tickets
    • First observedsearch_kb

TDQS

C2.4/5.0

Scored across 4 tools

Disambiguation3/5

Tools cover different functions (articles, tickets, search), but 'add' is ambiguous and could be confused with creating articles or tickets. 'get_article' and 'search_kb' both relate to articles but serve different retrieval needs.

Naming Consistency3/5

Three tools follow verb_noun pattern, but 'add' is a single verb without a noun, breaking consistency. Additionally, 'search_kb' uses an abbreviation while others use full words.

Tool Count4/5

With 4 tools, the server is lean but covers basic operations. The count is not excessive, though it feels slightly thin for a knowledge base server.

Completeness2/5

Obvious gaps: no update or delete for articles or tickets, no list articles tool, and 'add' is underspecified. The search is strong, but core CRUD operations are incomplete.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides a semantic search interface that enables discovery and routing across over 1,000 local MCP tools using natural language queries. It leverages hybrid search and embeddings to accurately match user intent with tool names and descriptions.
    5 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic search of Salesforce case summaries using embeddings, accessible via MCP tools and REST API.
    23
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI coding assistants to semantically search and retrieve relevant code patterns, documentation, and implementations from a codebase via MCP tools.
    8
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables semantic search and AI-powered Q&A over ingested GitHub documentation repositories via MCP tools.
    -