Ahnlich MCP
An MCP server that exposes Ahnlich vector storage and semantic search to MCP-compatible agents.
Ahnlich MCP supports two profiles:
dbconnects directly to Ahnlich DB and accepts precomputed embeddings.aisends raw text through Ahnlich AI, which generates embeddings and stores them in Ahnlich DB.
Before you start
Ahnlich MCP connects to running Ahnlich services.
| Profile | Required services |
|---|---|
ai |
Ahnlich DB on port 1369 and Ahnlich AI on port 1370 |
db |
Ahnlich DB on port 1369 |
Follow the Ahnlich installation guide to start the required services.
The examples below use the ai profile. To supply your own embeddings, replace --profile ai with --profile db.
Install from PyPI
This is the recommended installation method. Install uv, then use uvx to run Ahnlich MCP directly from PyPI.
Verify that the required Ahnlich services are available:
uvx ahnlich-mcp doctor --profile ai
Claude Desktop
Open Settings → Developer → Edit Config and add:
{
"mcpServers": {
"ahnlich": {
"command": "uvx",
"args": [
"ahnlich-mcp",
"--profile",
"ai"
]
}
}
}
Restart Claude Desktop after saving the configuration.
If Claude Desktop cannot find uvx, run command -v uvx and use the returned absolute path as command.
Codex
Add the server from your terminal:
codex mcp add ahnlich -- uvx ahnlich-mcp --profile ai
Confirm that it was added:
codex mcp list
You can also use /mcp inside Codex to inspect the connection.
Run with Docker
Use Docker when you want the MCP server and its Python dependencies isolated in a container.
The Ahnlich services must already be running and accessible through their default host ports.
Pull the image:
docker pull ghcr.io/deven96/ahnlich-mcp:latest
Claude Desktop
Add the following to the Claude Desktop configuration:
{
"mcpServers": {
"ahnlich": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--add-host",
"host.docker.internal:host-gateway",
"-e",
"AHNLICH_AI_HOST=host.docker.internal",
"-e",
"AHNLICH_AI_PORT=1370",
"ghcr.io/deven96/ahnlich-mcp:latest",
"--profile",
"ai"
]
}
}
}
Restart Claude Desktop after saving the configuration.
Codex
codex mcp add ahnlich -- docker run --rm -i \
--add-host host.docker.internal:host-gateway \
-e AHNLICH_AI_HOST=host.docker.internal \
-e AHNLICH_AI_PORT=1370 \
ghcr.io/deven96/ahnlich-mcp:latest \
--profile ai
Install from source
Use this method when developing or contributing to Ahnlich MCP.
Clone the repository and install the locked dependencies:
git clone https://github.com/deven96/ahnlich.git
cd ahnlich/mcp
uv sync --locked --dev
Verify the setup:
uv run ahnlich-mcp doctor --profile ai
The stdio command for MCP clients is:
uv --directory /absolute/path/to/ahnlich/mcp run ahnlich-mcp --profile ai
For Claude Desktop:
{
"mcpServers": {
"ahnlich": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/ahnlich/mcp",
"run",
"ahnlich-mcp",
"--profile",
"ai"
]
}
}
}
For Codex:
codex mcp add ahnlich -- \
uv --directory /absolute/path/to/ahnlich/mcp \
run ahnlich-mcp --profile ai
Configuration
Command-line profile selection overrides AHNLICH_PROFILE.
| Variable | Default | Description |
|---|---|---|
AHNLICH_PROFILE |
ai |
Active profile: ai or db |
AHNLICH_DB_HOST |
127.0.0.1 |
Database host |
AHNLICH_DB_PORT |
1369 |
Database port |
AHNLICH_AI_HOST |
127.0.0.1 |
AI proxy host |
AHNLICH_AI_PORT |
1370 |
AI proxy port |
AHNLICH_AI_MODEL |
all-minilm-l6-v2 |
Model used by the AI profile |
AHNLICH_MCP_READ_ONLY |
0 |
Expose only non-modifying tools |
Supported AI models:
all-minilm-l6-v2all-minilm-l12-v2bge-base-en-v1.5bge-large-en-v1.5jina-embeddings-v2-base-code
The selected model must also be enabled in ahnlich-ai through its
--supported-models option. The bundled Compose configuration enables
all-minilm-l6-v2.
The bundled Compose configuration uses Ahnlich DB 0.3.2 and Ahnlich AI
0.4.1 by default. Override AHNLICH_DB_VERSION or
AHNLICH_AI_VERSION only when testing another compatible release.
Example:
AHNLICH_PROFILE=db \
AHNLICH_DB_HOST=127.0.0.1 \
AHNLICH_DB_PORT=1369 \
uv run ahnlich-mcp
Read-only mode
Enable strict read-only mode when the MCP client must not modify Ahnlich:
AHNLICH_MCP_READ_ONLY=1 uv run ahnlich-mcp --profile ai
Only these tools are exposed:
pingserver_infolist_storessimilarity_searchget_by_metadata
Mutating tools are omitted from the MCP tool registry.
Tools
Both profiles expose the same tool names by default. Input schemas differ where embeddings are involved.
| Tool | Description |
|---|---|
ping |
Check the configured Ahnlich service |
server_info |
Get information about the configured service |
create_store |
Create a vector store |
list_stores |
List stores |
drop_store |
Delete a store and its entries |
store_entries |
Store raw text or precomputed embeddings |
similarity_search |
Search using raw text or a query embedding |
get_by_metadata |
Retrieve entries matching indexed metadata |
delete_by_metadata |
Delete entries matching indexed metadata |
create_predicate_index |
Index metadata keys |
drop_predicate_index |
Remove metadata indexes |
The db profile requires dimension when creating a store. Its store_entries and similarity_search tools accept embeddings.
The ai profile accepts raw text and uses the configured Ahnlich model to generate embeddings.
Metadata filters use the metadata_filter argument. Filtered metadata keys must have predicate indexes.
Result controls
list_stores and get_by_metadata accept a limit between 1 and 1024. The default is 50.
They return a bounded response:
{
"results": [],
"truncated": false
}
similarity_search accepts top_k up to 1024.
Stored embeddings are omitted from DB search and metadata responses by default. Pass include_embeddings: true when the vectors are required.
AI preprocessing
The AI profile supports the following preprocessing modes for store_entries and similarity_search:
| Value | Behaviour |
|---|---|
none |
Send input without model preprocessing |
truncate |
Allow Ahnlich to truncate input for the selected model |
The default is none.
Development
Run unit tests:
uv run pytest tests/unit -v
Run integration tests:
docker compose up -d --wait
uv run pytest tests/integration -v
Run the complete test suite:
uv run pytest -v
Run MCP Inspector:
npx -y @modelcontextprotocol/inspector \
uv \
--directory "$(pwd)" \
run ahnlich-mcp \
--profile ai
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ahnlich_mcp-0.1.1.tar.gz.
File metadata
- Download URL: ahnlich_mcp-0.1.1.tar.gz
- Upload date:
- Size: 93.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb24245fbb24cd9fccd9f0265595ba973c880a59695eb1945036c9a26d4e9a42
|
|
| MD5 |
bfde066b76494f33b9980ede016f5a9d
|
|
| BLAKE2b-256 |
d763c079eb294d4b991ffa7a1290d3e527383a60bd3461bf0d4fe06ad59493b9
|
File details
Details for the file ahnlich_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ahnlich_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3520975476e1f748c351398071763c886b0037dc126e1e61319295fa5989082e
|
|
| MD5 |
9f367658410c82a3097a5e0dfbddcc44
|
|
| BLAKE2b-256 |
80db6a9d91aac7483dd59e5f0098321be4bdce67a753652a5dc13248068dc55b
|