Skip to content

Commit e28aff9

Browse files
authored
Merge pull request #166 from papagala/main
Updating docs to make the up to date and fixed bugs
2 parents 35d9152 + 45a285c commit e28aff9

File tree

2 files changed

+94
-6
lines changed

2 files changed

+94
-6
lines changed

public/images/add-tool-server.png

115 KB
Loading

src/app/docs/kagent/examples/documentation/page.mdx

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,41 @@ docker build -t <your docker repository> .
7979
docker push <your docker repository> .
8080
```
8181

82+
> ** Important: Dockerfile Modifications Required**
83+
>
84+
> Make sure you add these essential lines to the Dockerfile before building:
85+
>
86+
> ```dockerfile
87+
> # Add this environment variable
88+
> ENV SQLITE_DB_DIR=/data
89+
>
90+
> # Create the data directory and copy your database
91+
> RUN mkdir -p /data
92+
> COPY mcp.db /data/mcp.db
93+
>
94+
> # Update the ownership to include /data
95+
> RUN chown -R kagent:nodejs /app /data
96+
> ```
97+
>
98+
> These changes ensure the MCP server can locate your custom documentation database in the `/data` directory.
99+
82100
## Deploy the MCP server
83101
84102
Create a Secret for the OpenAI API Key which is going to be used to create the embeddings:
85103
86104
```bash
87105
kubectl create secret generic mcp-secrets \
88-
--from-literal=OPENAI_API_KEY=<your_openai_api_key>
106+
--from-literal=OPENAI_API_KEY=<your_openai_api_key> \
107+
-n kagent
89108
```
90109
91110
Create a ConfigMap for the Database Configuration:
92111

93112
```bash
94113
kubectl create configmap mcp-config \
95114
--from-literal=SQLITE_DB_DIR=/data \
96-
--from-literal=PORT=3001
115+
--from-literal=PORT=3001 \
116+
-n kagent
97117
```
98118

99119
Create a file named `deployment.yaml`:
@@ -103,6 +123,7 @@ apiVersion: apps/v1
103123
kind: Deployment
104124
metadata:
105125
name: mcp-sqlite-vec
126+
namespace: kagent
106127
labels:
107128
app: mcp-sqlite-vec
108129
spec:
@@ -151,6 +172,7 @@ apiVersion: v1
151172
kind: Service
152173
metadata:
153174
name: mcp-sqlite-vec
175+
namespace: kagent
154176
spec:
155177
selector:
156178
app: mcp-sqlite-vec
@@ -167,15 +189,17 @@ kubectl apply -f service.yaml
167189

168190
## Use the MCP server in kagent
169191

170-
In the kagent UI, click on `Tools` and then on `Manage tool servers`.
192+
You can configure the MCP server in kagent using either the web UI or YAML manifests.
193+
194+
### Option 1: Using the kagent dashboard
171195

172196
![manage tool servers](/images/manage-tool-servers.png "Manage tool servers")
173197

174-
Click on `Add Server`.
198+
In the kagent UI, click on the `Create` dropdown menu and select `New Tool Server`.
175199

176200
Call it `sqlite-vec`.
177201

178-
Select `URL` and use `http://mcp-sqlite-vec.default:3001/sse`.
202+
Select `URL` and use `http://mcp-sqlite-vec.kagent:3001/mcp`.
179203

180204
![add tool server](/images/add-tool-server.png "Add tool server")
181205

@@ -185,9 +209,37 @@ After refreshing the page, you should see the `query-documentation` tool being d
185209

186210
![list tool servers](/images/list-tool-servers.png "List tool servers")
187211

212+
### Option 2: Using YAML CRDs
213+
214+
Create a `remote-mcpserver.yaml` file:
215+
216+
```yaml
217+
apiVersion: kagent.dev/v1alpha2
218+
kind: RemoteMCPServer
219+
metadata:
220+
name: live-demo
221+
namespace: kagent
222+
status:
223+
spec:
224+
description: ''
225+
protocol: STREAMABLE_HTTP
226+
sseReadTimeout: 5m0s
227+
terminateOnClose: true
228+
timeout: 5s
229+
url: http://mcp-sqlite-vec.kagent:3001/mcp
230+
```
231+
232+
Apply the ToolServer:
233+
234+
```bash
235+
kubectl apply -f toolserver.yaml
236+
```
237+
188238
## Create the MCP agent
189239

190-
Click on `New Agent`
240+
### Option 1: Using the kagent dashboard
241+
242+
Click on the `Create` dropdown menu and select `New Agent`.
191243

192244
Use the following information:
193245

@@ -199,6 +251,42 @@ Click on `Add Tools`.
199251

200252
Select the `query-documentation` tool.
201253

254+
### Option 2: Using YAML CRDs
255+
256+
Create an `agent.yaml` file:
257+
258+
```yaml
259+
# Kagent Agent Configuration
260+
# This defines an AI agent that can answer questions about MCP documentation
261+
apiVersion: kagent.dev/v1alpha2
262+
kind: Agent
263+
metadata:
264+
name: sqlite-vec
265+
namespace: kagent
266+
spec:
267+
declarative:
268+
modelConfig: default-model-config
269+
stream: true
270+
systemMessage: ' Use your tool to answer any question about the Model Context Protocol (MCP). Use mcp for the product and latest for the version'
271+
tools:
272+
- mcpServer:
273+
apiGroup: kagent.dev
274+
kind: RemoteMCPServer
275+
name: live-demo
276+
toolNames:
277+
- query_documentation
278+
type: McpServer
279+
description: |
280+
The MCP agent is answering questions about MCP, using the MCP documentation
281+
type: Declarative
282+
```
283+
284+
Apply the Agent:
285+
286+
```bash
287+
kubectl apply -f agent.yaml
288+
```
289+
202290
![list agents](/images/list-agents.png "List agents")
203291

204292
Congratulations, the agent is ready!

0 commit comments

Comments
 (0)