AI KB MCP Server
⚠️ Deprecated
AI KB now ships a built-in MCP server: create endpoints under "Settings → Publish & Integrations → MCP Server", each with its own token, knowledge-base scope and tool list, and connect clients to
/mcp/<endpoint_id>over Streamable HTTP. Prefer the built-in endpoint; this Python package may be removed in a future release.
A Model Context Protocol (MCP) server that gives access to the AI KB knowledge management API.
Quick start
We recommend following the MCP configuration guide instead of the steps below.
1. Install
pip install ai-kb-mcp
# Or run it with uvx without installing
uvx --from ai-kb-mcp ai-kb-mcp-server
The distribution is ai-kb-mcp; its command-line entry points are ai-kb-mcp-server and ai-kb-server.
The MCP packages on PyPI under the upstream project's name belong to that project and read its own variable names, not AIKB_*.
2. Set environment variables
# Linux/macOS
export AIKB_BASE_URL="http://localhost:8080/api/v1"
export AIKB_API_KEY="your_api_key_here"
# Windows PowerShell
$env:AIKB_BASE_URL="http://localhost:8080/api/v1"
$env:AIKB_API_KEY="your_api_key_here"
# Windows CMD
set AIKB_BASE_URL=http://localhost:8080/api/v1
set AIKB_API_KEY=your_api_key_here
Create the API key under Settings → Publish & Integrations → API Integration → API Keys.
| Variable | Default | Purpose |
|---|---|---|
AIKB_BASE_URL |
http://localhost:8080/api/v1 |
AI KB API base URL |
AIKB_API_KEY |
empty | API key, sent as X-API-Key |
AIKB_CHAT_TIMEOUT |
300 |
Chat stream read timeout in seconds |
AIKB_VERIFY_SSL |
true |
false disables TLS verification (development only) |
MCP_TRANSPORT |
stdio |
stdio, sse or http (same as --transport) |
MCP_HOST / MCP_PORT |
127.0.0.1 / 8000 |
Bind address for sse and http |
MCP_SERVER_AUTH_TOKEN |
empty | Required for sse and http; the server refuses to start without it |
MCP_ALLOWED_UPLOAD_DIRS |
working directory | Extra roots for local file uploads (see below) |
3. Run the server
ai-kb-mcp-server # stdio, for MCP clients that launch the server
ai-kb-mcp-server --help # show help
ai-kb-mcp-server --check-only # check the environment configuration only
ai-kb-mcp-server --verbose # enable verbose logging
ai-kb-mcp-server --version # show the version
Network transports
MCP_SERVER_AUTH_TOKEN=change_me ai-kb-mcp-server --transport http --host 0.0.0.0 --port 8000
The Streamable HTTP endpoint is /mcp; the SSE transport serves /sse and /sse/messages/.
Clients send Authorization: Bearer <token> or X-MCP-Auth-Token: <token>.
Run from a source checkout
From the mcp-server/ directory of the repository:
pip install -r requirements.txt
python main.py # same options as ai-kb-mcp-server
# Or install the checkout
pip install . # pip install -e . for development
uvx --from . ai-kb-mcp-server # without installing
python run_server.py, python run.py, python aikb_mcp_server.py and python -m aikb_mcp_server also start the server.
Build distribution packages
pip install build
python -m build
Test the module
python test_module.py
Features
The MCP server provides these tools:
Workspace management
create_tenant- create a workspacelist_tenants- list all workspaces
Knowledge base management
create_knowledge_base- create a knowledge baselist_knowledge_bases- list knowledge basesget_knowledge_base- get knowledge base detailslist_shared_knowledge_bases- list knowledge bases shared with youdelete_knowledge_base- delete a knowledge basehybrid_search- hybrid search
Knowledge management
create_knowledge_from_file- create knowledge from a local filecreate_knowledge_from_url- create knowledge from a URLcreate_knowledge_from_text- create knowledge from textupdate_knowledge_from_text- update manual Markdown knowledge, re-index it or save it as a draftlist_knowledge- list knowledgeget_knowledge- get knowledge detailsdelete_knowledge- delete knowledge
Model management
create_model- create a modellist_models- list modelsget_model- get model details
Session management
create_session- create a chat sessionget_session- get session detailslist_sessions- list sessionsdelete_session- delete a session
Chat
chat- send a chat messageagent_chat- call an agent for multi-step retrieval and tool calls
Both chat tools assemble events on SSE blank-line boundaries, so one event can span several data: lines.
An event still open when the connection ends (no blank line seen yet) is dropped. Each event's data buffer is capped at 8 MiB;
exceeding the cap returns an error and closes the response connection.
Agents
list_agents- list agentsget_agent- get agent details
Chunk management
list_chunks- list knowledge chunksdelete_chunk- delete a knowledge chunk
Wiki
wiki_search- search a knowledge base's wiki pageswiki_read_page- read one wiki page by slugwiki_index_view- show a knowledge base's wiki index
Troubleshooting
If you hit import errors, make sure that:
- All required dependencies are installed
- Your Python version is compatible (3.11 or newer)
- No file name conflicts (do not name a file
mcp.py)
Local upload directory boundary
All transports, including stdio, restrict local file uploads to the working
directory by default. Set MCP_ALLOWED_UPLOAD_DIRS to a comma-separated list of
trusted absolute directories when additional roots are needed. Starting in a
filesystem root requires an explicit directory configuration. Paths and symbolic
links resolving outside the selected roots are rejected.
Metadata
Release files for ai-kb-mcp 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai_kb_mcp-1.1.2.tar.gz | 29.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_kb_mcp-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.7 kB
Release files / ai_kb_mcp-1.1.2.tar.gz
| Download URL | ai_kb_mcp-1.1.2.tar.gz |
|---|---|
| Size | 29.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b42585427e32cfaf702efda71991aefd56af0966bc97a2048fcee0e976db07c
|
|
BLAKE2b-256 checksum How to use checksums |
72ef0f4db3324435ba659124ca37fd729f43ea1da700c824128fee8fd31345c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / ai_kb_mcp-1.1.2-py3-none-any.whl
| Download URL | ai_kb_mcp-1.1.2-py3-none-any.whl |
|---|---|
| Size | 26.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f892f1c896d831b2f90a7311f3a77d0f8bc42774c4fd78cdd09bd33a9b692ed8
|
|
BLAKE2b-256 checksum How to use checksums |
1797e92115febb7d05cae81b19e79aa2c1d02e5a212184c136753f419dc33622
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency log