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
- 01Serve tools over MCP
- 02Use an SSE MCP client
- 03Answer queries with OpenAI
- 04Call tools directly without an LLM
- 05Edit the JSON knowledge base
Use cases
- 01Answer questions using stored MCP-related content
- 02Try direct tool calls without an LLM
- 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.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Knowledge Base
A simple MCP client-server
Requirements
- Python 3.9 or higher
- Poetry for dependency management
- OpenAI API key
Setup
- 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 toolsclient-sse.py: MCP client implementation with LLM capabilitiesdata/kb.json: Knowledge base data with MCP-related Q&Apyproject.toml: Poetry configuration file
Running the Application
-
Start the server:
poetry run python server.py -
In a separate terminal, run the client:
poetry run python client-sse.py
Using the Client
The client has two modes:
-
Direct tool calls:
- Uncomment the
asyncio.run(test_direct_tool_calls())line inclient-sse.py - This directly calls the tools without using an LLM
- Uncomment the
-
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.pyby creating additional functions with the@mcp.tool()decorator - Modify the knowledge base by updating
data/kb.json - Change the OpenAI model by modifying the
modelparameter in theMCPClientclass
Comments
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.