
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ai-embedding-mcp-server
Advanced tools
A Model Context Protocol (MCP) server that provides AI embedding and RAG (Retrieval-Augmented Generation) functionality. This server converts your existing AI embedding application into an MCP-compatible service.
Clone and install dependencies:
npm install
Set up PostgreSQL with pgvector:
# Install pgvector extension
sudo -u postgres psql -c "CREATE EXTENSION vector;"
# Run the setup script
psql -U your_username -d your_database -f setup.sql
Configure environment:
cp env.example .env
# Edit .env with your configuration
Install Ollama (optional, for local LLM):
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull mistral
ollama pull qwen2.5-coder:7b
ollama pull nomic-embed-text
Edit your .env file with the following variables:
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/embedding_db
# HuggingFace API Configuration
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
# OpenAI API Configuration (optional)
OPENAI_API_KEY=your_openai_api_key_here
# Ollama Configuration (for local LLM)
OLLAMA_BASE_URL=http://localhost:11434
# Server Configuration
PORT=3000
NODE_ENV=development
npm start
The server will run on stdio and can be connected to MCP clients.
ingest_documentIngest a document into the vector database.
Parameters:
filePath (string): Path to the document fileprojectId (string): Project ID to associate withExample:
{
"name": "ingest_document",
"arguments": {
"filePath": "./docs/business-rules.mdc",
"projectId": "project1"
}
}
chat_with_rulesChat with AI using business rules context.
Parameters:
message (string): User's question or messageprojectId (string): Project ID to search for contextExample:
{
"name": "chat_with_rules",
"arguments": {
"message": "What are the business rules for the resource module?",
"projectId": "project1"
}
}
generate_embeddingGenerate embeddings for text.
Parameters:
text (string): Text to generate embeddings forExample:
{
"name": "generate_embedding",
"arguments": {
"text": "This is sample text for embedding"
}
}
vector_searchSearch for similar documents using vector similarity.
Parameters:
query (string): Search query textprojectId (string): Project ID to search withintopK (number, optional): Number of results (default: 5)Example:
{
"name": "vector_search",
"arguments": {
"query": "business rules",
"projectId": "project1",
"topK": 3
}
}
list_projectsList all projects with their document counts.
Example:
{
"name": "list_projects",
"arguments": {}
}
get_project_documentsGet all documents for a specific project.
Parameters:
projectId (string): Project ID to get documents forExample:
{
"name": "get_project_documents",
"arguments": {
"projectId": "project1"
}
}
Add to your Claude Desktop configuration:
{
"mcpServers": {
"ai-embedding": {
"command": "node",
"args": ["/path/to/your/ai-embedding/server.js"],
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/embedding_db",
"HUGGINGFACE_API_KEY": "your_api_key"
}
}
}
}
The server follows the MCP protocol and can be integrated with any MCP-compatible client by running:
node server.js
The MCP server is built on top of your existing codebase:
server.js: Main MCP server with tool definitionsrag-ollama-embedding.js: RAG functionality with Ollama integrationrag-emedding.js: HuggingFace embedding functionalityemedding-docs.js: Document processing utilities.txt, .md, .mdc).pdf).docx)The server uses a PostgreSQL database with the following schema:
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
project_id VARCHAR(255) NOT NULL,
file_name VARCHAR(500) NOT NULL,
content TEXT NOT NULL,
embedding vector(384),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Run with debug logging:
DEBUG=* npm start
To add new tools to the MCP server:
ListToolsRequestSchema handlerCallToolRequestSchema handlerTest individual components:
# Test document ingestion
node -e "require('./rag-ollama-embedding.js').ingestDocument('./docs/business-rules.mdc', 'test')"
# Test chat functionality
node -e "require('./rag-ollama-embedding.js').chatWithRules('test message', 'test')"
ISC License - see LICENSE file for details.
For issues and questions:
FAQs
MCP Server for AI Embedding and RAG functionality
We found that ai-embedding-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.