From 96d8f9047b9d40edbabc1105f11eee6f1df99dcb Mon Sep 17 00:00:00 2001 From: bendtherules Date: Tue, 14 Apr 2026 17:48:13 +0530 Subject: [PATCH] feat(server): allow Ollama custom via OLLAMA_HOST env var Update README to specify pulling the `qwen3-embedding:0.6b` model and document the optional `OLLAMA_HOST` environment variable. Adjust server code to import `EMBEDDING_MODEL`, use it for Ollama embeddings, and pass `process.env.OLLAMA_HOST` as the base URL. --- Readme.md | 6 +++++- src/mcp-server.ts | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index d2664c4..9e1bbf5 100644 --- a/Readme.md +++ b/Readme.md @@ -12,7 +12,11 @@ MCP server for exploring the ECMAScript specification and its implementation in ## Prerequisites - **Bun**: Version 1.0.0 or higher ([install](https://bun.sh/docs/installation)) -- **Ollama**: Installed locally with an embedding model (e.g., `qwen3-embedding:0.6b`) +- **Ollama**: Installed locally with `qwen3-embedding:0.6b` model pulled (`ollama pull qwen3-embedding:0.6b`) + +### Environment Variables + +- `OLLAMA_HOST` (optional): Ollama server URL. Defaults to `http://localhost:11434` ## Installation diff --git a/src/mcp-server.ts b/src/mcp-server.ts index 20070d2..4e30b2d 100644 --- a/src/mcp-server.ts +++ b/src/mcp-server.ts @@ -30,7 +30,7 @@ import { sectionContentToolMetadata, sectionContentToolName, } from "./agent-tools/index.js"; -import { STORAGE_DIR } from "./constants.js"; +import { EMBEDDING_MODEL, STORAGE_DIR } from "./constants.js"; // #region MCP Types @@ -75,8 +75,10 @@ export interface SearchSpecMCPOutput extends McpToolOutputBase { // #endregion // Initialize embeddings +// OLLAMA_HOST env var is optional - @langchain/ollama defaults to http://localhost:11434 const embeddings = new OllamaEmbeddings({ - model: "qwen3-embedding:0.6b", + model: EMBEDDING_MODEL, + baseUrl: process.env.OLLAMA_HOST, }); async function main() {