doc4d
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@doc4dSearch 4D docs for how to use entities with ORDA"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
doc4d (llama.cpp branch)
MCP server for semantic search over the 4D Documentation corpus.
It exposes a single MCP tool, search, which embeds a natural-language query and returns the most semantically similar documentation passages (URL + text) for a given language and 4D product version.
A live demo is running at:
https://doc4d-production.up.railway.app(streamable-http MCP transport, mounted at /)
This branch runs the embedding model directly via
llama-cpp-pythonagainst the original GGUF checkpoint, rather than an ONNX export. Seemainfor theonnxruntime-based variant. Functionally the two are equivalent (same model, same pooling, same output vectors) — this branch just skips the ONNX conversion step and its extra dependencies (onnxruntime,tokenizers).
How it works
Corpus & vector index:
keisuke-miyako/doc4d-2026-08-05on Hugging Face — a SQLite database (doc.db) with asqlite-vecvec0virtual table of 1024-dim embeddings, chunked text, andurl/language/versionmetadata for each chunk of 4D documentation.Embedding model:
LFM2.5-Embedding-350M-GGUF, quantizedQ8_0, loaded directly withllama-cpp-python'sLlamaclass in embedding mode — no separate tokenizer file or ONNX export needed, since the GGUF bundles its own tokenizer.Pooling: CLS-token pooling (
LLAMA_POOLING_TYPE_CLS), matching how the dataset's embeddings were originally generated.Server:
server.pyloads the GGUF model at startup, embeds incoming queries (prefixed with"query: "per the model card), and runs a cosine-distance nearest-neighbor search viasqlite-vec'sMATCHoperator.Transport: MCP over
streamable-http, served internally on port7860and reverse-proxied by nginx, which also handles CORS and basic per-IP rate limiting.
search tool
Parameter | Type | Default | Notes |
|
| — | Free-text query, truncated to 2000 chars. |
|
|
| Filters results to this language. |
|
|
| Filters results to this 4D product version. |
|
|
| If |
|
|
| Number of results to return, capped at 50. |
Returns a list of { url, similarity, text? } objects, ordered by descending similarity.
Under the hood, k * 20 nearest-neighbor candidates are pulled from sqlite-vec and then filtered down to the requested language/version, since the vector index itself isn't partitioned by those fields.
Related MCP server: Local Search MCP Server
Project layout
.
├── Dockerfile
├── entrypoint.sh # downloads GGUF model + DB from HF, starts nginx, then server.py
├── nginx_conf.template # reverse proxy, CORS, rate limiting
├── requirements.txt
├── server.py # MCP server + embedding + search logic (llama.cpp backend)
└── LICENSEThe Docker image ships without the model or database baked in — entrypoint.sh downloads them from Hugging Face on container start:
models/LFM2.5-Embedding-350M-Q8_0.gguffromLiquidAI/LFM2.5-Embedding-350M-GGUF(a single self-contained file — no separate tokenizer download needed on this branch)data/doc.dbfromdatasets/keisuke-miyako/doc4d-2026-08-05
This keeps the image small and lets the corpus/model be updated without rebuilding the image — just clear the mounted volume (or redeploy) to force a re-download.
Note:
entrypoint.shandDockerfileon this branch need their model URL/filename updated to point at the.ggufcheckpoint instead ofmodel.onnx+tokenizer.json— swap the relevantcurlstep inentrypoint.shaccordingly if you're porting themain-branch scripts over.
requirements.txt (this branch)
mcp[cli]
sqlite-vec
llama-cpp-pythonNo onnxruntime or tokenizers needed — llama-cpp-python handles both inference and tokenization internally. Note llama-cpp-python typically needs a compiler toolchain (build-essential, cmake) at install time unless a prebuilt wheel matching your platform is available; keep those in the Dockerfile's apt-get install step for this branch even though the ONNX branch doesn't need them.
Running locally
Docker (recommended):
docker build -t doc4d .
docker run --rm -p 8080:80 -e PORT=80 doc4dThe server will download the model and database on first start (this can take a minute depending on connection speed), then listen on http://localhost:8080.
Without Docker:
pip install -r requirements.txt
# also requires nginx if you want the proxy/CORS/rate-limiting layer,
# or point an MCP client directly at 127.0.0.1:7860 and skip nginx
./entrypoint.shentrypoint.sh expects to be run from the repo root and will create models/ and data/ alongside it.
Deploying to Railway
This repo is set up to deploy on Railway with zero config beyond the Dockerfile:
New Project → Deploy from GitHub repo, select
miyako/doc4d, branch pointing at this llama.cpp variant.Railway detects the
Dockerfileautomatically and builds it — no build command needed. Note this branch's build step compiles/installsllama-cpp-python, so first builds may take noticeably longer than the ONNX branch.Railway injects
$PORTat runtime;entrypoint.shpicks it up automatically and templates it into the nginx config (envsubst '${PORT}'), so no manual port configuration is required.First boot will take longer than subsequent restarts, since
entrypoint.shdownloads the GGUF model anddoc.dbfrom Hugging Face before starting the server. If you want faster cold starts, attach a Railway volume mounted at/app/modelsand/app/dataso those files persist across deploys/restarts instead of being re-downloaded every time.Once deployed, Railway gives you a public URL (e.g.
https://<your-app>.up.railway.app) — that's your MCPstreamable-httpendpoint.
No environment variables are required for a default deploy — PORT is set by Railway automatically.
CPU note for this branch: server.py sets n_threads=1 on the Llama instance. This was found empirically to avoid pathologically slow inference on throttled/shared-vCPU Railway instances, where llama.cpp's multi-threaded sync busy-spins and fights with the CPU scheduler. If you deploy on a host with dedicated cores, it's worth benchmarking n_threads > 1 — it may be faster there, but don't assume it without testing on the actual target host first.
Deploying elsewhere (Oracle Cloud, bare Docker host, etc.)
The same image works anywhere that can run a container and reach Hugging Face over HTTPS:
If
$PORTisn't set,entrypoint.shfalls back to port80.Make sure outbound HTTPS to
huggingface.cois allowed on first boot (for the model/DB download).Persist
models/anddata/on a volume if you want to avoid re-downloading the GGUF checkpoint on every restart.If building on a platform without a prebuilt
llama-cpp-pythonwheel, expect thepip installstep to compile from source — keepbuild-essential/cmakeavailable at build time.
Connecting an MCP client
Point any MCP client that supports streamable-http transport at the server's base URL, e.g. for the hosted demo:
https://doc4d-production.up.railway.appRate limiting (5 req/s per IP, burst 10) and CORS (Access-Control-Allow-Origin: *) are applied at the nginx layer in front of the MCP server.
Notes / caveats
use_mmap=Falseis set on theLlamainstance — deliberate, not a leftover default; keep it unless you've verified mmap works reliably on your target host's filesystem/container setup.n_ctx=512caps the context window fed to the embedding model; combined with the 2000-character query truncation insearch(), very long queries will be truncated by the tokenizer rather than raising an error.Query results are only as fresh as the
doc4d-2026-08-05dataset snapshot — see the dataset card for details on how it was built and its limitations.The
language/versionfilter happens after vector search on an over-fetched candidate set (k * 20), not natively in the index — if you query for a rarelanguage/versioncombination, you may get fewer thankresults even when more exist in the corpus.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-quality-maintenanceCrawls documentation websites and provides semantic search capabilities over the content through vector embeddings, enabling natural language queries of technical documentation.Last updated2
- Alicense-qualityCmaintenanceEnables semantic search across indexed documents using vector embeddings. Index GitHub repositories and URLs to perform natural language queries with AI-enhanced contextual results.Last updated41MIT
- Flicense-qualityDmaintenanceEnables semantic search over TwinCAT 3 documentation using natural language queries, with intelligent caching for fast results.Last updated5
- Flicense-qualityDmaintenanceEnables semantic search of Weaviate documentation using vector search, providing relevant documents and code snippets.Last updated
Related MCP Connectors
Apple Developer Documentation with Semantic Search, RAG, and AI reranking for MCP clients
Search @imqueue docs and scaffold typed services & clients from your AI coding agent.
Search your knowledge bases from any AI assistant using hybrid RAG.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/miyako/doc4d'
If you have feedback or need assistance with the MCP directory API, please join our Discord server