mcpField
M
MCP Knowledge Base

MCP Knowledge Base

Local
github.com/gmogmzGithubAI & Agents1Updated 79w ago

About MCP Knowledge Base

MCP Knowledge Base is a Python project pairing an MCP server with an SSE client that can use OpenAI to answer questions from a JSON knowledge base. It supports both LLM-directed tool use and direct tool calls.

Key features

  1. 01Serve tools over MCP
  2. 02Use an SSE MCP client
  3. 03Answer queries with OpenAI
  4. 04Call tools directly without an LLM
  5. 05Edit the JSON knowledge base

Use cases

  1. 01Answer questions using stored MCP-related content
  2. 02Try direct tool calls without an LLM
  3. 03Add tools or update knowledge base entries

MCP support

The project includes an MCP server with custom tools and an SSE client. The client can invoke tools directly or use OpenAI to select tools in response to queries.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP Knowledge Base

A simple MCP client-server

Requirements

  • Python 3.9 or higher
  • Poetry for dependency management
  • OpenAI API key

Setup

  1. Install dependencies using Poetry:
    poetry install
    

2Create a .env file in the project root or parent directory with your OpenAI API key:

OPENAI_API_KEY=your_api_key_here

Project Structure

  • server.py: MCP server implementation with tools
  • client-sse.py: MCP client implementation with LLM capabilities
  • data/kb.json: Knowledge base data with MCP-related Q&A
  • pyproject.toml: Poetry configuration file

Running the Application

  1. Start the server:

    poetry run python server.py
    
  2. In a separate terminal, run the client:

    poetry run python client-sse.py
    

Using the Client

The client has two modes:

  1. Direct tool calls:

    • Uncomment the asyncio.run(test_direct_tool_calls()) line in client-sse.py
    • This directly calls the tools without using an LLM
  2. LLM-powered interactions (default):

    • Uses OpenAI to interpret queries and call appropriate tools
    • Ask questions like "What is MCP?" or "What is the difference between stdio and SSE transports?"

Customizing

  • Add new tools to server.py by creating additional functions with the @mcp.tool() decorator
  • Modify the knowledge base by updating data/kb.json
  • Change the OpenAI model by modifying the model parameter in the MCPClient class

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.