Embeddings MCP Server
A Model Context Protocol server for generating text embeddings using OpenAI, Anthropic, or Ollama, with tools for single and batch embedding operations.
README
Embeddings MCP Server
A Model Context Protocol (MCP) server for generating text embeddings using OpenAI, Anthropic, or Ollama. Built with Next.js and the Vercel AI SDK, designed for easy deployment on Vercel.
Features
- Multiple Providers: Support for OpenAI, Anthropic, and Ollama embedding models
- Two Tools: Single text embedding and batch text embeddings
- Easy Deployment: Ready for deployment on Vercel
- Local Testing: Built-in support for Ollama for local development
- TypeScript: Fully typed for better developer experience
- Comprehensive Tests: Full test coverage
Quick Start
-
Clone and install dependencies:
git clone <your-repo> cd embeddings-mcp-ts pnpm install -
Configure environment variables:
cp .env.example .env.localEdit
.env.localwith your preferred provider settings. -
Run locally:
pnpm dev -
Deploy to Vercel:
npx vercel
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
EMBEDDING_PROVIDER |
Provider to use: openai, anthropic, or ollama |
openai |
OPENAI_API_KEY |
OpenAI API key (required for OpenAI) | - |
OPENAI_EMBEDDING_MODEL |
OpenAI embedding model | text-embedding-3-small |
ANTHROPIC_API_KEY |
Anthropic API key (required for Anthropic) | - |
ANTHROPIC_EMBEDDING_MODEL |
Anthropic model | claude-3-5-sonnet-20241022 |
OLLAMA_BASE_URL |
Ollama server URL | http://localhost:11434 |
OLLAMA_EMBEDDING_MODEL |
Ollama embedding model | nomic-embed-text |
Provider-Specific Setup
OpenAI
export EMBEDDING_PROVIDER=openai
export OPENAI_API_KEY=your_api_key_here
export OPENAI_EMBEDDING_MODEL=text-embedding-3-small
Anthropic
export EMBEDDING_PROVIDER=anthropic
export ANTHROPIC_API_KEY=your_api_key_here
Ollama (Local Testing)
export EMBEDDING_PROVIDER=ollama
export OLLAMA_BASE_URL=http://localhost:11434
export OLLAMA_EMBEDDING_MODEL=nomic-embed-text
Make sure Ollama is running locally:
ollama serve
ollama pull nomic-embed-text
MCP Tools
embed_text
Generates an embedding for a single text string.
Parameters:
text(string): The text to generate an embedding for
Returns:
{
"embedding": [0.1, -0.2, 0.3, ...],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 10,
"total_tokens": 10
},
"dimensions": 1536
}
embed_texts
Generates embeddings for multiple text strings.
Parameters:
texts(string[]): Array of texts to generate embeddings for
Returns:
{
"embeddings": [[0.1, -0.2, ...], [0.3, -0.4, ...]],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 20,
"total_tokens": 20
},
"count": 2,
"dimensions": 1536
}
Claude Desktop Integration
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration:
{
"mcpServers": {
"embeddings": {
"command": "npx",
"args": ["mcp-handler", "http://localhost:3000/api/mcp"],
"env": {
"EMBEDDING_PROVIDER": "openai",
"OPENAI_API_KEY": "your_api_key_here"
}
}
}
}
For production deployment, replace localhost:3000 with your Vercel deployment URL.
Development
Running Tests
pnpm test
pnpm test:watch
Type Checking
pnpm type-check
Linting
pnpm lint
Building
pnpm build
Deployment
Vercel Deployment
-
Configure environment variables in Vercel:
- Go to your Vercel project settings
- Add environment variables for your chosen provider
- Set
EMBEDDING_PROVIDERto your preferred provider
-
Deploy:
npx vercel -
Update your MCP client configuration with the deployment URL.
Architecture
src/app/api/mcp/route.ts: Main MCP server endpointsrc/lib/config.ts: Configuration managementsrc/lib/embedding-service.ts: Provider factorysrc/lib/providers/: Individual provider implementationssrc/types/: TypeScript type definitions
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.