@aigne/example-mcp-sqlite 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/index.ts +4 -11
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ AI ->> User: There are 10 products in the database.
|
|
|
60
60
|
## Prerequisites
|
|
61
61
|
|
|
62
62
|
- [Node.js](https://nodejs.org) and npm installed on your machine
|
|
63
|
+
- [Bun](https://bun.sh) installed on your machine
|
|
63
64
|
- [OpenAI API key](https://platform.openai.com/api-keys) used to interact with OpenAI API
|
|
64
65
|
- [uv](https://github.com/astral-sh/uv) python environment for running [MCP Server SQlite](https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite)
|
|
65
66
|
- [Pnpm](https://pnpm.io) [Optional] if you want to run the example from source code
|
package/index.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env npx -y bun
|
|
2
2
|
|
|
3
|
-
import assert from "node:assert";
|
|
4
3
|
import { join } from "node:path";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
|
|
5
|
+
import { AIAgent, ExecutionEngine, MCPAgent, PromptBuilder } from "@aigne/core";
|
|
6
|
+
import { loadModel } from "@aigne/core/loader/index.js";
|
|
7
7
|
import { logger } from "@aigne/core/utils/logger.js";
|
|
8
|
-
import { runChatLoopInTerminal } from "@aigne/core/utils/run-chat-loop.js";
|
|
9
|
-
|
|
10
|
-
const { OPENAI_API_KEY } = process.env;
|
|
11
|
-
assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
|
|
12
8
|
|
|
13
9
|
logger.enable(`aigne:mcp,${process.env.DEBUG}`);
|
|
14
10
|
|
|
15
|
-
const model =
|
|
16
|
-
apiKey: OPENAI_API_KEY,
|
|
17
|
-
});
|
|
11
|
+
const model = await loadModel();
|
|
18
12
|
|
|
19
13
|
const sqlite = await MCPAgent.from({
|
|
20
14
|
command: "uvx",
|
|
@@ -43,7 +37,6 @@ const userAgent = engine.call(agent);
|
|
|
43
37
|
|
|
44
38
|
await runChatLoopInTerminal(userAgent, {
|
|
45
39
|
initialCall: {},
|
|
46
|
-
onResponse: (response) => console.log(getMessage(response)),
|
|
47
40
|
});
|
|
48
41
|
|
|
49
42
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-mcp-sqlite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework and Sqlite MCP Server to interact with a SQLite database",
|
|
5
5
|
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
6
6
|
"homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/mcp-sqlite",
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"openai": "^4.
|
|
19
|
+
"openai": "^4.94.0",
|
|
20
20
|
"zod": "^3.24.2",
|
|
21
|
-
"@aigne/
|
|
21
|
+
"@aigne/cli": "^1.3.0",
|
|
22
|
+
"@aigne/core": "^1.8.0"
|
|
22
23
|
},
|
|
23
24
|
"scripts": {
|
|
24
|
-
"start": "
|
|
25
|
+
"start": "bun run index.ts",
|
|
25
26
|
"lint": "tsc --noEmit"
|
|
26
27
|
}
|
|
27
28
|
}
|