MCP Knowledge Base Assistant

MCP Knowledge Base Assistant

mcp-get-started•bykofiadom

A demonstration project pairing an MCP knowledge base server, which exposes company-policy Q&A as a tool, with an OpenAI-powered MCP client.

License: MIT License•Runtime: Awaiting documentation review•Category: ai agents-models

WHAT IT DOES

  • •Exposes a single MCP tool named get_knowledge_base that retrieves information from a JSON knowledge base of company policy question-answer pairs.
  • •Runs the MCP server over SSE transport on port 8050 and can be containerized with Docker.
  • •Includes a client that connects via SSE, retrieves the available tools, sends queries to OpenAI, and executes tool calls when the model requests them.

BEST FOR

  • •Answering natural-language questions about company policies using a local knowledge base.
  • •Learning how to build an MCP server, client, and OpenAI integration as a demonstration.

ABOUT MCP-GET-STARTED

MCP Knowledge Base Assistant is cataloged as an MCP server attributed to kofiadom. A demonstration project pairing an MCP knowledge base server, which exposes company-policy Q&A as a tool, with an OpenAI-powered MCP client. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP Knowledge Base Assistant are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the knowledge base be extended with additional information?

Yes, the README states that more question-answer pairs can be added to the data/kb.json file to expand the knowledge base.

How can more tools be added to the MCP server?

Additional tools can be added by defining functions with the @mcp.tool() decorator in server.py.

Upstream README

View this exact version on GitHub

README.md · 95e78bdc8c32 · Fetched 2026-11-13 13:33:03 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

MCP Knowledge Base Assistant

A demonstration of the Model Context Protocol (MCP) that connects an OpenAI-powered client to a knowledge base server. This project showcases how to build a simple but powerful AI assistant that can answer questions about company policies by accessing a knowledge base through MCP.

📋 Overview

This project demonstrates:

  1. How to build an MCP server that exposes a knowledge base as a tool
  2. How to create an MCP client that connects to the server
  3. How to integrate OpenAI's API to create a natural language interface
  4. How to use Docker to containerize the server component

The system allows users to ask questions in natural language about company policies, and the AI will retrieve relevant information from the knowledge base to provide accurate answers.

🏗️ Architecture

The project follows the MCP client-host-server architecture:

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  OpenAI Model   │◄────┤  MCP Client     │◄────┤  MCP Server     │
│  (GPT-4o)       │     │  (client.py)    │     │  (server.py)    │
│                 │     │                 │     │                 │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                                                        │
                                                        ▼
                                               ┌─────────────────┐
                                               │                 │
                                               │  Knowledge Base │
                                               │  (kb.json)      │
                                               │                 │
                                               └─────────────────┘
  • MCP Server: Exposes the knowledge base as a tool that can be queried
  • MCP Client: Connects to the server and integrates with OpenAI's API
  • OpenAI Model: Processes natural language queries and generates responses
  • Knowledge Base: JSON file containing Q&A pairs about company policies

🚀 Getting Started

Prerequisites

  • Python 3.11 or higher
  • Docker (optional, for containerized server)
  • OpenAI API key

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd MCP-Get-Started
    
  2. Create a virtual environment and install dependencies:

    python -m venv venv
    
    # On Windows
    venv\Scripts\activate
    
    # On macOS/Linux
    source venv/bin/activate
    
    pip install -r requirements.txt
    
  3. Create a .env file in the project root with your OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key_here
    

Running the Server

Option 1: Run directly with Python

python server.py

Option 2: Run with Docker

# Build the Docker image
docker build -t mcp-server .

# Run the container
docker run -p 8050:8050 mcp-server

Running the Client

With the server running, open a new terminal and run:

python client.py

📝 Usage

The client will connect to the server and ask a sample question about the company's equal opportunity policy. You can modify the query in client.py to ask different questions about company policies.

Example output:

Connected to server with tools:
  - get_knowledge_base: Retrieve the entire knowledge base as a formatted string.

Query: What is the company's equal opportunity policy?

Response: The company's equal opportunity policy is as follows: The company is an equal opportunity employer and prohibits discrimination based on race, gender, age, religion, disability, or any other protected characteristic.

🔧 Project Structure

  • server.py: MCP server implementation that exposes the knowledge base
  • client.py: MCP client that connects to the server and integrates with OpenAI
  • data/kb.json: Knowledge base containing company policy Q&A pairs
  • Dockerfile: Configuration for containerizing the server
  • requirements.txt: Python dependencies

🧩 How It Works

MCP Server (server.py)

The server exposes a single tool called get_knowledge_base that retrieves information from the knowledge base file (data/kb.json). It runs using the SSE (Server-Sent Events) transport on port 8050.

MCP Client (client.py)

The client:

  1. Connects to the MCP server using SSE transport
  2. Retrieves the list of available tools
  3. Takes a natural language query from the user
  4. Sends the query to OpenAI along with the available tools
  5. If OpenAI decides to use a tool, the client executes the tool call
  6. Returns the final response to the user

Knowledge Base (data/kb.json)

The knowledge base is a simple JSON file containing question-answer pairs about company policies. This can be extended with additional policies or information as needed.

🔄 Lifecycle Management

The client implements proper lifecycle management using Python's async context managers:

async with MCPOpenAIClient() as client:
    await client.connect_to_server()
    response = await client.process_query("What is the policy?")
# Resources are automatically cleaned up when exiting the context

This ensures that all resources are properly initialized and cleaned up, following MCP best practices.

🛠️ Customization

Adding More Knowledge

To expand the knowledge base, simply add more question-answer pairs to the data/kb.json file.

Adding More Tools

You can add more tools to the server by defining additional functions with the @mcp.tool() decorator in server.py.

Changing the Model

To use a different OpenAI model, modify the model parameter in the MCPOpenAIClient class in client.py.

📚 Learn More About MCP

The Model Context Protocol (MCP) is a standardized way for LLMs to interact with external tools and services. It provides:

  • Reusability: Build a server once, use it with any MCP-compatible client
  • Composability: Combine multiple servers to create complex capabilities
  • Ecosystem growth: Benefit from servers created by others

For more information, visit the MCP documentation.

📄 License

MIT License

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP Knowledge Base Assistant from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-get-started)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related ai agents-models MCP Servers

Alternative and complementary servers in the same category

View all in ai agents-models →
Knowledge Graph Memory
@modelcontextprotocol/server-memory•Model Context Protocol

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

create_entitiescreate_relationsadd_observations+6 more
92K
AI & Multi-Agent
Sequential Thinking
@modelcontextprotocol/server-sequential-thinking•Model Context Protocol

Organize problem solving into revisable, branching thought steps through an MCP tool.

sequential_thinking
92K
AI & Multi-Agent

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.

146
AI & Multi-Agent