TiDB MCP Server Multimodal AI Data Platform
Build multimodal AI apps and agents with TiDB AI SDK's MCP server—unify data and deploy scalable models across text, image, and sensor inputs.
Overview
TiDB MCP Server is the Model Context Protocol (MCP) component of the TiDB AI SDK designed to unify storage, retrieval, and model orchestration for multimodal AI applications. It lets you store and query text, images, and sensor data in a single platform while running embedding, nearest‑neighbor, and reranking workflows close to your data. The result is a scalable foundation for search, similarity, and retrieval-augmented generation (RAG) applications.
Built on top of TiDB and the Python client (pytidb), the MCP Server handles model hosting and context management (embeddings, vector indexes, rerankers) while TiDB provides transactional storage and horizontal scale. Developers get a simple API for defining schemas with auto-embedding, running vector/full-text/hybrid searches, and combining filters and rerankers for production relevance.
Features
- Unified search modes: vector, full-text, and hybrid searches.
- Automatic embedding pipeline that maps source fields to vector columns.
- Multimodal storage and retrieval: text, images, and arbitrary binary/sensor inputs.
- Image-to-image and text-to-image retrieval using multi-modal embedding models.
- Approximate nearest neighbor indexing (HNSW) for fast similarity search.
- Reranker model support to re-score candidates for higher precision.
- Transactional guarantees: commit/rollback support via TiDB.
- Flexible filtering and boolean logic for production queries.
- Pluggable model providers (OpenAI, local/inferencing, or third-party embedder backends).
Installation / Configuration
Install the Python SDK (pin a version for stability):
# Core client
# Extra models (embedding & reranker helpers)
# Optional: convert results to pandas DataFrame
Connect to your TiDB cluster and configure an embedding provider:
=
# Configure an embedding provider (example: OpenAI)
Define a table with automatic embedding and insert data:
=
: =
: =
: =
: =
=
Search examples (vector and hybrid):
# Vector search (semantic)
=
# Hybrid (full-text + vector)
=
Available Resources
- GitHub: https://github.com/pingcap/pytidb
- Quick Start notebook: docs/quickstart.ipynb in the repo
- Documentation: https://pingcap.github.io/ai/
- Examples: https://pingcap.github.io/ai/examples/
- Roadmap & issues: GitHub Issues / Projects
- Community: Discord invite linked from the repo
- PyPI: https://pypi.org/project/pytidb
Use Cases
Retrieval-Augmented Generation (RAG)
- Chunk documents into passages, auto-embed content, run vector search for top-k candidates, then use a reranker model to pick the best passages to feed into an LLM prompt.
Multimodal image search
- Store images and their embeddings (text or image encoders). Perform text-to-image or image-to-image queries to power visual search in e‑commerce or asset management.
IoT / Sensor similarity search
- Embed time‑series segments or sensor snapshots and find nearest neighbors to detect anomalies or recurring patterns across devices.
Enterprise semantic search
- Combine full-text and vector search (hybrid) to surface exact matches for legal terms while also returning semantically related documents for better discovery.
Recommender and cold-start handling
- Use embedding similarity across users/items and hybrid filters to recommend items based on content, metadata, and semantic similarity.
Search types at a glance:
| Search type | Behavior |
|---|---|
| Vector | Semantic similarity via embeddings |