Skip to main content
This guide details how to configure the embedding models used for vector search. You can set the embedding model using the embeddings.model configuration key, the DOCS_MCP_EMBEDDING_MODEL environment variable, or the --embedding-model CLI flag.
Using an embedding model is optional but dramatically improves search quality by enabling semantic vector search.

Model Selection

If you leave the model empty but provide OPENAI_API_KEY, the server defaults to text-embedding-3-small.

Supported Options

OpenAI

text-embedding-3-small (default)text-embedding-3-large

Ollama (Local)

openai:nomic-embed-textopenai:snowflake-arctic-embed2

Google Vertex AI

vertex:text-embedding-004

Google Gemini

gemini:embedding-001

AWS Bedrock

aws:amazon.titan-embed-text-v1

Azure OpenAI

microsoft:text-embedding-ada-002

Provider Configuration

Provider credentials use the provider-specific environment variables listed below.

Environment Variables

DOCS_MCP_EMBEDDING_MODEL
string
Embedding model to use (e.g., text-embedding-3-small, openai:nomic-embed-text)
OPENAI_API_KEY
string
OpenAI API key for embeddings
OPENAI_API_BASE
string
Custom OpenAI-compatible API endpoint (e.g., http://localhost:11434/v1 for Ollama)
GOOGLE_API_KEY
string
Google API key for Gemini embeddings
GOOGLE_APPLICATION_CREDENTIALS
string
Path to Google service account JSON for Vertex AI
AWS_ACCESS_KEY_ID
string
AWS key for Bedrock embeddings
AWS_SECRET_ACCESS_KEY
string
AWS secret for Bedrock embeddings
AWS_REGION
string
AWS region for Bedrock (e.g., us-east-1)
AZURE_OPENAI_API_KEY
string
Azure OpenAI API key
AZURE_OPENAI_API_INSTANCE_NAME
string
Azure OpenAI instance name
AZURE_OPENAI_API_DEPLOYMENT_NAME
string
Azure OpenAI deployment name
AZURE_OPENAI_API_VERSION
string
Azure OpenAI API version (e.g., 2024-02-01)

Provider Examples

OpenAI (Default)

OPENAI_API_KEY="sk-proj-your-openai-api-key" \
DOCS_MCP_EMBEDDING_MODEL="text-embedding-3-small" \
npx @arabold/docs-mcp-server@latest
text-embedding-3-small is the default and provides the best balance of quality and cost.

Choosing an Embedding Model

Best for Cost

Ollama (Local)Free, runs on your machine, no API costs

Best for Quality

OpenAI text-embedding-3-largeHighest quality embeddings, more expensive

Best Balance

OpenAI text-embedding-3-smallDefault option, good quality, reasonable cost

Enterprise

Azure OpenAI or Vertex AIPrivate deployments with SLAs

Performance Considerations

Different models produce embeddings with different dimensions:
  • text-embedding-3-small: 1536 dimensions
  • text-embedding-3-large: 3072 dimensions
  • nomic-embed-text: 768 dimensions
Higher dimensions generally mean better quality but more storage and slower search.
The server batches embedding requests to optimize API usage. Default batch size is 100 documents.Configure with:
DOCS_MCP_EMBEDDINGS_BATCH_SIZE=50
Local models (Ollama, LM Studio):
  • Free, no rate limits
  • Slower on CPU, faster with GPU
  • No internet required
Cloud models (OpenAI, Gemini, etc.):
  • Fast processing
  • Rate limits and costs
  • Internet required

Switching Models

Changing the embedding model requires re-indexing all documentation because embeddings from different models are not compatible.
To switch models:
1

Remove existing documentation

npx @arabold/docs-mcp-server@latest remove <library-name>
2

Configure new model

Set the new DOCS_MCP_EMBEDDING_MODEL and provider credentials
3

Re-scrape documentation

npx @arabold/docs-mcp-server@latest scrape <library> <url>

Troubleshooting

Problem: 401 Unauthorized or Invalid API keySolution:
  • Verify your API key is correct
  • Check environment variable names match exactly
  • For Ollama, use any non-empty string as the API key
Problem: ECONNREFUSED or connection timeoutSolution:
  • For Ollama: Ensure ollama serve is running
  • Check OPENAI_API_BASE URL is correct
  • Verify firewall settings
Problem: Model name not recognizedSolution:
  • Check the model name matches exactly (case-sensitive)
  • For Ollama: Pull the model first with ollama pull <model-name>
  • Verify the provider prefix (e.g., openai:, vertex:, gemini:)

Next Steps

Scraping Sources

Learn how to index documentation from various sources

Search Documentation

Master search queries to leverage your embeddings

Configuration

Explore all configuration options

CLI Reference

Complete CLI command reference

Build docs developers (and LLMs) love