Stitch AI MCP Server for Knowledge Management
Manage AI knowledge with Stitch AI's MCP server for creating, storing, and retrieving memory spaces to power agent memory and contextual decisions.
npx -y @StitchAI/stitch-ai-mcpOverview
Stitch AI’s MCP Server implements the Model Context Protocol (MCP) to create, store, and retrieve structured memory spaces that help AI agents and applications make context-aware decisions. It provides a lightweight HTTP API for managing memory “spaces” (namespaced collections of memory items), storing items with metadata and embeddings, and retrieving relevant memories by similarity or filters. This centralizes agent memory, enabling persistent context beyond a single request or session.
Using an MCP server is useful when building agents, chatbots, or retrieval-augmented applications that need to recall previous interactions, user preferences, or domain facts. Instead of coupling memory storage to each agent instance, the server exposes a standard interface so multiple agents and services can read and write the same contextual history. That simplifies stateful reasoning, personalization, and long-term knowledge maintenance.
Features
- Namespaced memory spaces for isolated agent or tenant storage
- CRUD operations for memory items (create, update, delete, upsert)
- Semantic retrieval via embeddings + vector similarity search
- Metadata filtering and time-based queries (TTL / created_at)
- Persistence adapters (database + vector store) via configurable backends
- Simple HTTP REST API compatible with MCP-enabled clients
- Lightweight deployment (Docker / container friendly) and config-driven setup
- Authentication / API key support for access control
Installation / Configuration
Clone the repository and run the server with Docker. The example below shows a minimal docker-compose setup and typical environment variables. Adjust storage and embedding provider settings for your environment.
Clone and run (example):
Example docker-compose (simplified):
version: "3.8"
services:
mcp:
image: stitchai/mcp:latest
ports:
- "8080:8080"
environment:
- PORT=8080
- DATABASE_URL=postgres://user:pass@db:5432/mcp
- VECTOR_STORE=faiss # or milvus, weaviate, etc. via adapters
- EMBEDDING_PROVIDER=openai # or other provider
- EMBEDDING_API_KEY=${EMBEDDING_API_KEY}
- MCP_API_KEY=${MCP_API_KEY}
db:
image: postgres:15
environment:
POSTGRES_PASSWORD: pass
Common environment variables
- PORT — HTTP port for the MCP server
- DATABASE_URL — SQL database connection string (Postgres/SQLite)
- VECTOR_STORE — configured vector index backend
- EMBEDDING_PROVIDER and EMBEDDING_API_KEY — provider for embedding generation
- MCP_API_KEY — server API key for securing requests
For local development some projects include an npm/Makefile dev command. See the repository README for any language-specific steps (build, run, migrate DB).
Available Resources
Typical API resources exposed by an MCP server include:
- Health: GET /health or GET /v1/health
- Spaces:
- POST /v1/spaces — create a memory space
- GET /v1/spaces/{spaceId} — inspect a space
- DELETE /v1/spaces/{spaceId}
- Memory items:
- POST /v1/spaces/{spaceId}/items — create/upsert memory items
- GET /v1/spaces/{spaceId}/items/{itemId}
- POST /v1/spaces/{spaceId}/query — semantic similarity search with filters
- DELETE /v1/spaces/{spaceId}/items/{itemId}
Example: create a memory item
Query by similarity (semantic retrieval)
Check the repository for exact endpoint paths and request/response schemas; clients commonly ship SDKs or helper functions that wrap these calls.
Use Cases
Agent memory and stateful reasoning
- Keep a running log of decisions, facts, and plans so an agent can reference past reasoning across conversations.
- Example: store “agent recommended payment plan A” and later retrieve to avoid repeating or contradicting itself.
Personalization and user preferences
- Persist explicit and implicit user preferences to tailor responses (language, tone, UI choices).
- Example: store “prefers dark mode” and apply when generating UI-focused suggestions.
Retrieval-augmented generation (RAG)
- Use the MCP server as the document/knowledge index behind RAG pipelines. Store product docs, SOPs, or FAQs and retrieve relevant passages at inference time.
- Example: query space with a customer question and inject top-k memory items into the prompt.
Audit trails and explainability
- Record decisions or sources an agent used so responses can be traced back and explained.
- Example: store provenance metadata (source_url, confidence) with each memory item.
Multi-agent coordination
- Share a space between multiple agents so they can read a synchronized context or task backlog.
- Example: a coordinator agent writes tasks and worker agents query assignments.
Notes for Developers
- Start by creating a dedicated space per tenant or user to simplify access control and retention policies.
- Tune embedding provider and vector store choices based on scale and