@aigne/example-mcp-puppeteer 1.5.0 → 1.7.1

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.
Files changed (3) hide show
  1. package/README.md +8 -6
  2. package/index.ts +4 -9
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -56,15 +56,17 @@ AI ->> User: The content is as follows: ...
56
56
  ## Prerequisites
57
57
 
58
58
  - [Node.js](https://nodejs.org) and npm installed on your machine
59
- - [OpenAI API key](https://platform.openai.com/api-keys) used to interact with OpenAI API
60
- - [Pnpm](https://pnpm.io) [Optional] if you want to run the example from source code
59
+ - An [OpenAI API key](https://platform.openai.com/api-keys) for interacting with OpenAI's services
60
+ - Optional dependencies (if running the example from source code):
61
+ - [Bun](https://bun.sh) for running unit tests & examples
62
+ - [Pnpm](https://pnpm.io) for package management
61
63
 
62
- ## Try without Installation
64
+ ## Quick Start (No Installation Required)
63
65
 
64
66
  ```bash
65
- export OPENAI_API_KEY=YOUR_OPENAI_API_KEY # setup your OpenAI API key
67
+ export OPENAI_API_KEY=YOUR_OPENAI_API_KEY # Set your OpenAI API key
66
68
 
67
- npx -y @aigne/example-mcp-puppeteer # run the example
69
+ npx -y @aigne/example-mcp-puppeteer # Run the example
68
70
  ```
69
71
 
70
72
  ## Installation
@@ -88,7 +90,7 @@ pnpm install
88
90
  Setup your OpenAI API key in the `.env.local` file:
89
91
 
90
92
  ```bash
91
- OPENAI_API_KEY="" # setup your OpenAI API key here
93
+ OPENAI_API_KEY="" # Set your OpenAI API key here
92
94
  ```
93
95
 
94
96
  ### Run the Example
package/index.ts CHANGED
@@ -1,23 +1,18 @@
1
- #!/usr/bin/env npx -y bun
1
+ #!/usr/bin/env bunwrapper
2
2
 
3
- import assert from "node:assert";
4
3
  import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
5
4
  import { AIAgent, ExecutionEngine, MCPAgent } from "@aigne/core";
6
- import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
5
+ import { loadModel } from "@aigne/core/loader/index.js";
7
6
  import { logger } from "@aigne/core/utils/logger.js";
8
7
 
9
- const { OPENAI_API_KEY } = process.env;
10
- assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
11
-
12
8
  logger.enable(`aigne:mcp,${process.env.DEBUG}`);
13
9
 
14
- const model = new OpenAIChatModel({
15
- apiKey: OPENAI_API_KEY,
16
- });
10
+ const model = await loadModel();
17
11
 
18
12
  const puppeteer = await MCPAgent.from({
19
13
  command: "npx",
20
14
  args: ["-y", "@modelcontextprotocol/server-puppeteer"],
15
+ env: process.env as Record<string, string>,
21
16
  });
22
17
 
23
18
  const engine = new ExecutionEngine({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-mcp-puppeteer",
3
- "version": "1.5.0",
3
+ "version": "1.7.1",
4
4
  "description": "A demonstration of using AIGNE Framework and Puppeteer MCP Server to extract content from websites using Puppeteer",
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-puppeteer",
@@ -16,13 +16,13 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "openai": "^4.93.0",
19
+ "openai": "^4.94.0",
20
20
  "zod": "^3.24.2",
21
- "@aigne/core": "^1.7.0",
22
- "@aigne/cli": "^1.2.0"
21
+ "@aigne/cli": "^1.5.1",
22
+ "@aigne/core": "^1.10.0"
23
23
  },
24
24
  "scripts": {
25
- "start": "npx -y bun run index.ts",
25
+ "start": "bun run index.ts",
26
26
  "lint": "tsc --noEmit"
27
27
  }
28
28
  }