Skip to content

Commit 9a2dbfd

Browse files
committed
Update Blog “part-8-agentic-ai-and-qdrant-building-semantic-memory-with-mcp-protocol”
1 parent 7d8a788 commit 9a2dbfd

File tree

1 file changed

+31
-92
lines changed

1 file changed

+31
-92
lines changed

content/blog/part-8-agentic-ai-and-qdrant-building-semantic-memory-with-mcp-protocol.md

Lines changed: 31 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ date: 2025-07-21T10:50:25.839Z
44
author: Dinesh R Singh
55
authorimage: /img/dinesh-192-192.jpg
66
disable: false
7+
tags:
8+
- MCP
9+
- Agentic AI
10+
- Generative AI
711
---
812
As Agentic AI systems evolve from reactive language models to structured thinkers, a new challenge emerges — how do we give these agents memory? Not just logs or files, but real, searchable memory that understands context. Enter Qdrant and the Model Context Protocol (MCP) — a modular pairing that brings semantic search and knowledge storage to agent workflows.
913

10-
Inspired by a Medium post by Dinesh R, this article explores how MCP standardizes interactions between intelligent agents and vector databases like Qdrant. By enabling seamless storage and retrieval of embeddings, agents can now “remember” useful information and leverage it in future reasoning.
14+
[Inspired by my Medium post](https://dineshr1493.medium.com/all-you-need-to-know-about-the-evolution-of-generative-ai-to-agentic-ai-part-8-agentic-ai-mcp-281567e26838), this article explores how MCP standardizes interactions between intelligent agents and vector databases like Qdrant. By enabling seamless storage and retrieval of embeddings, agents can now “remember” useful information and leverage it in future reasoning.
1115

1216
Let’s walk through the full architecture and code implementation of this cutting-edge pattern.
1317

14-
15-
16-
## Why This Matters: Agentic AI + MCP
18+
## Why this matters: Agentic AI + MCP
1719

1820
In Agentic AI, a language model doesn’t just generate — it thinks, acts, and reflects using external tools. That’s where MCP comes in.
1921

@@ -23,35 +25,21 @@ Qdrant itself is a high-performance vector database — capable of powering sema
2325

2426
This is solved by wrapping Qdrant inside an MCP server, giving agents a semantic API they can call like a function.
2527

26-
27-
2828
### Architecture Overview
2929

3030
```
31-
LLM Agent
32-
33-
\|
34-
35-
\|-- \[MCP Client]
36-
37-
\|
38-
39-
\[MCP Protocol]
40-
41-
\|
42-
43-
\|-- \[Qdrant MCP Server]
44-
45-
\|   |-- Tool: qdrant-store
46-
47-
\|   |-- Tool: qdrant-find
48-
49-
\|
50-
51-
\[Qdrant Vector DB]
31+
[LLM Agent]
32+
|
33+
|-- [MCP Client]
34+
[MCP Protocol]
35+
|
36+
|-- [Qdrant MCP Server]
37+
|   |-- Tool: qdrant-store
38+
|   |-- Tool: qdrant-find
39+
|
40+
[Qdrant Vector DB]
5241
```
5342

54-
5543
### Use Case: Support Ticket Memory for AI Assistants
5644

5745
Imagine an AI assistant answering support queries.
@@ -60,20 +48,16 @@ Imagine an AI assistant answering support queries.
6048
* But it has semantic memory from prior support logs stored in Qdrant.
6149
* It uses qdrant-find to semantically retrieve similar issues and then formulates a contextual response.
6250

63-
64-
6551
## Step-by-Step Implementation
6652

6753
### Step 1: Launch Qdrant MCP Server
6854

6955
```
7056
export COLLECTION_NAME="support-tickets"
71-
7257
export QDRANT_LOCAL_PATH="./qdrant_local_db"
73-
7458
export EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2"
7559
```
76-
 
60+
7761
```
7862
uvx mcp-server-qdrant --transport sse
7963
```
@@ -84,130 +68,88 @@ uvx mcp-server-qdrant --transport sse
8468
* QDRANT_LOCAL_PATH: Local vector DB storage path
8569
* EMBEDDING_MODEL: Embedding model for vectorization
8670

87-
8871
### Step 2: Connect the MCP Client
8972

9073
```
9174
from mcp import ClientSession, StdioServerParameters
92-
9375
from mcp.client.stdio import stdio_client
94-
9576
async def main():
96-
9777
server_params = StdioServerParameters(
98-
9978
     command="uvx",
100-
10179
     args=\["mcp-server-qdrant"],
102-
10380
     env={
104-
10581
         "QDRANT_LOCAL_PATH": "./qdrant_local_db",
106-
10782
         "COLLECTION_NAME": "support-tickets",
108-
10983
         "EMBEDDING_MODEL": "sentence-transformers/all-MiniLM-L6-v2"
110-
11184
     }
112-
11385
)
11486
```
87+
11588
```
11689
async with stdio_client(server_params) as (read, write):
117-
11890
     async with ClientSession(read, write) as session:
119-
12091
         await session.initialize()
121-
12292
         tools = await session.list_tools()
123-
12493
         print(tools)
12594
```
95+
12696
```
12797
Expected Output: Lists tools like qdrant-store, qdrant-find
12898
```
12999

130100
### Step 3: Ingest a New Memory
131-
```
132101

102+
```
133103
ticket_info = "Order #1234 was delayed due to heavy rainfall in transit zone."
134-
135-
 
136-
137104
result = await session.call_tool("qdrant-store", arguments={
138-
139105
"information": ticket_info,
140-
141106
"metadata": {"order_id": 1234}
142-
143107
})
144108
```
109+
145110
This stores an embedded version of the text in Qdrant.
146111

147112
### Step 4: Perform a Semantic Search
148-
```
149113

114+
```
150115
query = "Why was order 1234 delayed?"
151-
152116
search_response = await session.call_tool("qdrant-find", arguments={
153-
154117
"query": "order 1234 delay"
155-
156118
})
157119
```
158-
```
159-
Example Output:
160-
161-
json
162120

163-
CopyEdit
121+
## Example Output:
164122

123+
```
165124
[
166-
167125
  {
168-
169126
"content": "Order #1234 was delayed due to heavy rainfall in transit zone.",
170-
171127
"metadata": {"order_id": 1234}
172-
173128
  }
174-
175129
]
176130
```
177131

178132
### Step 5: Use with LLM
133+
179134
```
180135
import openai
181-
182136
context = "\n".join(\[r["content"] for r in search_response])
183-
184137
prompt = f"""
185-
186138
You are a helpful assistant. Use this context to answer:
187-
188-
\"\"\"
189-
139+
"""
190140
{context}
191-
192-
\"\"\"
193-
141+
"""
194142
Question: Why was order #1234 delayed?
195-
196143
"""
197-
198144
response = openai.ChatCompletion.create(
199-
200145
model="gpt-3.5-turbo",
201-
202-
messages=\[{"role": "user", "content": prompt}]
203-
146+
messages=[{"role": "user", "content": prompt}]
204147
)
205-
206148
print(response\["choices"]\[0]\["message"]\["content"])
207149
```
208-
```
209150

210-
Final Answer:\
151+
```
152+
Final Answer:
211153
"Order #1234 was delayed due to heavy rainfall in the transit zone."
212154
```
213155

@@ -250,8 +192,7 @@ Final Answer:\
250192
</tbody>
251193
</table>
252194

253-
254-
## Pro Tip: Chain MCP Servers
195+
## Pro Tip: Chain MCP servers
255196

256197
You can deploy multiple MCP servers for different tools and plug them into agent workflows:
257198

@@ -261,8 +202,6 @@ You can deploy multiple MCP servers for different tools and plug them into agent
261202

262203
Then orchestrate it all using Agentic AI Teams to perform high-level, multi-tool reasoning.
263204

264-
265-
266205
## Final Thought
267206

268207
By pairing Qdrant with MCP, Agentic AI gains powerful, semantic memory — a critical enabler of contextual understanding and long-term knowledge retention. This pattern abstracts the complexity of vector DBs behind a unified protocol, empowering agents to think, recall, and act without manual data plumbing.

0 commit comments

Comments
 (0)