WR

Wren Engine MCP Server for Model Context Protocol

Deploy the Wren Engine MCP server to power semantic Model Context Protocol for MCP clients and AI agents, enabling context-rich, efficient interactions.

Overview

Wren Engine is an MCP (Model Context Protocol) server that provides a semantic context store for AI agents and MCP-aware clients. It exposes a lightweight HTTP API for indexing, retrieving, and querying contextual fragments (documents, memory items, code snippets, etc.) using semantic embeddings and metadata. The server enables efficient retrieval-augmented workflows by turning raw context into searchable vectors and metadata-backed records.

The server is useful when you want a centralized, protocol-driven context layer shared across multiple agents, tools, or services. Instead of coupling each model call to a raw document store, Wren Engine standardizes storage, similarity search, and context policies so clients can focus on agent logic while relying on consistent semantic retrieval and expiration rules.

Features

  • RESTful MCP-compatible API for storing, fetching, and querying model contexts
  • Semantic indexing via embeddings ( pluggable embedding providers )
  • Metadata-backed records with support for filtering and scoping
  • Vector search for similarity-based retrieval (approximate or exact)
  • Simple configuration for storage backends (local, cloud DB, vector store)
  • Lightweight, container-friendly deployment (Docker)
  • Useful tooling and examples for integrating with AI agents and MCP clients

Installation / Configuration

Requirements: Git, Docker (recommended) or Node.js (if running from source). Clone the repository and follow one of the deployment options below.

Clone repository

git clone https://github.com/Canner/wren-engine.git
cd wren-engine

Run with Docker (recommended)

# Build locally
docker build -t wren-engine .

# Run with basic environment variables
docker run -p 8080:8080 \
  -e PORT=8080 \
  -e STORAGE_TYPE=sqlite \
  -e EMBEDDING_PROVIDER=openai \
  -e EMBEDDING_API_KEY=${OPENAI_API_KEY} \
  wren-engine:latest

Run from source (Node.js)

# Install dependencies and start (if project is Node-based)
npm install
npm run build
npm start

Environment variables (example .env)

PORT=8080
STORAGE_TYPE=sqlite         # sqlite | postgres | memory | vectorstore
DATABASE_URL=sqlite.db      # or postgres://user:pass@host/db
EMBEDDING_PROVIDER=openai   # provider for embeddings
EMBEDDING_API_KEY=sk-xxxx
VECTOR_INDEX=faiss          # optional: faiss | milvus | pinecone
LOG_LEVEL=info

Note: The exact environment variable names and supported storage backends depend on the packaged implementation. Check the repository’s config file or docs for the definitive list.

Available Resources

  • GitHub repository: https://github.com/Canner/wren-engine

  • HTTP API (default): http://localhost:8080

  • Default endpoints (typical):

    MethodPathPurpose
    POST/v1/contextIndex or upsert a context record
    GET/v1/context/:idRetrieve a context record by id
    POST/v1/querySemantic search / similarity query
    DELETE/v1/context/:idRemove a context record
    GET/healthHealth and readiness checks
  • Tools you may find in the repo:

    • CLI scripts for migration and index management
    • Example clients / SDK snippets (JavaScript/TypeScript)
    • OpenAPI/Swagger spec (if included) for interactive exploration

Example: Store and Query Context

Store a context fragment (curl)

curl -X POST http://localhost:8080/v1/context \
  -H "Content-Type: application/json" \
  -d '{
    "id": "doc:invoice:1234",
    "namespace": "invoices",
    "text": "Invoice 1234: payment due on 2026-05-01, amount $4,200",
    "metadata": {"customer_id": "cust-789", "due_date": "2026-05-01"}
  }'

Query semantically for similar contexts

curl -X POST http://localhost:8080/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "namespace": "invoices",
    "query": "overdue payments for customer cust-789",
    "top_k": 5
  }'

Response: a ranked list of matching context records with similarity scores, metadata, and optionally the original text.

Use Cases

  • Retrieval-augmented generation (RAG): Use Wren Engine as the canonical context store for your LLM prompts. Store domain documents and retrieve the most relevant passages at call time to reduce token usage and improve factuality.
  • Multi-agent orchestration: Share contextual memories across multiple agents (e.g., planner, executor, assistant) so each agent can query the same semantic state and avoid duplicated knowledge.
  • Long-term memory for conversational agents: Persist important conversation fragments and retrieve semantically similar past interactions to provide continuity without keeping entire histories in the model prompt.
  • Tooling for enterprise apps: Index documents, logs, or structured records with metadata filters to provide fast, context-aware search that integrates with AI workflows.
  • Context scoping and governance: Use namespaces and metadata filters to constrain retrieval to specific tenants, projects, or data classifications.

Tips for Developers

  • Start with a local storage backend (sqlite or memory) for development and migrate to a managed vector store (Milvus, Pinecone, etc.) for production scale.
  • Tune embedding provider and vector index configuration to balance latency, cost, and recall for your workload.
  • Use namespaces and metadata to scope queries and enforce multi-tenant isolation.
  • Add routine cleanup or TTL policies for ephemeral context that should expire to control storage growth.

For full API references, configuration options, and examples, consult the repository