@aigne/example-mcp-github 1.8.0 → 1.9.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 CHANGED
@@ -118,7 +118,7 @@ pnpm example # Run predefined examples
118
118
  The following example demonstrates how to use the GitHub MCP server to search for repositories:
119
119
 
120
120
  ```typescript
121
- import { AIAgent, ExecutionEngine, MCPAgent } from "@aigne/core";
121
+ import { AIAgent, AIGNE, MCPAgent } from "@aigne/core";
122
122
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
123
123
 
124
124
  // Load environment variables
@@ -138,10 +138,10 @@ const githubMCPAgent = await MCPAgent.from({
138
138
  },
139
139
  });
140
140
 
141
- // Create execution engine
142
- const engine = new ExecutionEngine({
141
+ // Create AIGNE
142
+ const aigne = new AIGNE({
143
143
  model,
144
- tools: [githubMCPAgent],
144
+ skills: [githubMCPAgent],
145
145
  });
146
146
 
147
147
  // Create AI agent with GitHub-specific instructions
@@ -161,7 +161,7 @@ Always provide clear, concise responses with relevant information from GitHub.
161
161
  });
162
162
 
163
163
  // Example: Search for repositories
164
- const result = await engine.call(
164
+ const result = await aigne.invoke(
165
165
  agent,
166
166
  "Search for repositories related to 'modelcontextprotocol'"
167
167
  );
@@ -174,8 +174,8 @@ console.log(result);
174
174
  // 2. **modelcontextprotocol/modelcontextprotocol** - The main ModelContextProtocol repository
175
175
  // ...
176
176
 
177
- // Shutdown the engine when done
178
- await engine.shutdown();
177
+ // Shutdown the aigne when done
178
+ await aigne.shutdown();
179
179
  ```
180
180
 
181
181
  ## Available GitHub Operations
package/index.test.ts CHANGED
@@ -1,3 +1,11 @@
1
- import { test } from "bun:test";
1
+ import { expect, test } from "bun:test";
2
+ import { runExampleTest } from "@aigne/test-utils/run-example-test.js";
2
3
 
3
- test("should successfully execute the mcp-github", () => import("./index.js"), { timeout: 60000 });
4
+ test(
5
+ "should successfully run the mcp-github",
6
+ async () => {
7
+ const { code } = await runExampleTest();
8
+ expect(code).toBe(0);
9
+ },
10
+ { timeout: 600000 },
11
+ );
package/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import assert from "node:assert";
4
4
  import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
5
- import { AIAgent, ExecutionEngine, MCPAgent } from "@aigne/core";
5
+ import { AIAgent, AIGNE, MCPAgent } from "@aigne/core";
6
6
  import { loadModel } from "@aigne/core/loader/index.js";
7
7
  import { logger } from "@aigne/core/utils/logger.js";
8
8
 
@@ -22,9 +22,9 @@ const github = await MCPAgent.from({
22
22
  },
23
23
  });
24
24
 
25
- const engine = new ExecutionEngine({
25
+ const aigne = new AIGNE({
26
26
  model,
27
- tools: [github],
27
+ skills: [github],
28
28
  });
29
29
 
30
30
  const agent = AIAgent.from({
@@ -43,7 +43,7 @@ Always provide clear, concise responses with relevant information from GitHub.
43
43
  memory: true,
44
44
  });
45
45
 
46
- const userAgent = engine.call(agent);
46
+ const userAgent = aigne.invoke(agent);
47
47
 
48
48
  await runChatLoopInTerminal(userAgent, {
49
49
  welcome:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-mcp-github",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "A demonstration of using AIGNE Framework and GitHub MCP Server to interact with GitHub repositories",
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-github",
@@ -18,8 +18,11 @@
18
18
  "dependencies": {
19
19
  "openai": "^4.94.0",
20
20
  "zod": "^3.24.2",
21
- "@aigne/cli": "^1.7.0",
22
- "@aigne/core": "^1.11.0"
21
+ "@aigne/cli": "^1.8.0",
22
+ "@aigne/core": "^1.12.0"
23
+ },
24
+ "devDependencies": {
25
+ "@aigne/test-utils": "^0.1.0"
23
26
  },
24
27
  "scripts": {
25
28
  "start": "bun run index.ts",
package/usages.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import assert from "node:assert";
2
- import { AIAgent, ExecutionEngine, MCPAgent } from "@aigne/core";
2
+ import { AIAgent, AIGNE, MCPAgent } from "@aigne/core";
3
3
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
4
4
 
5
5
  const { OPENAI_API_KEY, GITHUB_TOKEN } = process.env;
@@ -18,9 +18,9 @@ const githubMCPAgent = await MCPAgent.from({
18
18
  },
19
19
  });
20
20
 
21
- const engine = new ExecutionEngine({
21
+ const aigne = new AIGNE({
22
22
  model,
23
- tools: [githubMCPAgent],
23
+ skills: [githubMCPAgent],
24
24
  });
25
25
 
26
26
  const agent = AIAgent.from({
@@ -40,7 +40,7 @@ Always provide clear, concise responses with relevant information from GitHub.
40
40
 
41
41
  // Example 1: Search for repositories
42
42
  console.log("Example 1: Searching for repositories");
43
- const searchResult = await engine.call(
43
+ const searchResult = await aigne.invoke(
44
44
  agent,
45
45
  "Search for repositories related to 'modelcontextprotocol' and limit to 3 results",
46
46
  );
@@ -49,7 +49,7 @@ console.log("\n------------------------\n");
49
49
 
50
50
  // Example 2: Get file contents
51
51
  console.log("Example 2: Getting file contents");
52
- const fileResult = await engine.call(
52
+ const fileResult = await aigne.invoke(
53
53
  agent,
54
54
  "Get the content of README.md from modelcontextprotocol/servers repository",
55
55
  );
@@ -58,10 +58,10 @@ console.log("\n------------------------\n");
58
58
 
59
59
  // Example 3: List commits
60
60
  console.log("Example 3: Listing commits");
61
- const commitsResult = await engine.call(
61
+ const commitsResult = await aigne.invoke(
62
62
  agent,
63
63
  "List the latest 3 commits from the modelcontextprotocol/servers repository",
64
64
  );
65
65
  console.log(commitsResult);
66
66
 
67
- await engine.shutdown();
67
+ await aigne.shutdown();