@aigne/example-mcp-blocklet 1.8.0 → 1.9.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.
- package/index.ts +13 -1
- package/package.json +7 -7
- /package/{LICENSE → LICENSE.md} +0 -0
package/index.ts
CHANGED
|
@@ -21,12 +21,25 @@ assert(
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const appUrl = new URL(rawUrl);
|
|
24
|
+
try {
|
|
25
|
+
appUrl.pathname = "/__blocklet__.js";
|
|
26
|
+
const result = await fetch(appUrl.href);
|
|
27
|
+
if (result.status !== 200) {
|
|
28
|
+
console.error("Seems like the provided url is not a valid blocklet url: ", rawUrl);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error("Error verifying blocklet url", error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
appUrl.pathname = "/.well-known/service/mcp";
|
|
25
37
|
console.info("Connecting to blocklet", appUrl.href);
|
|
26
38
|
|
|
27
39
|
let transport: StreamableHTTPClientTransport;
|
|
28
40
|
|
|
29
41
|
const provider = new TerminalOAuthProvider(appUrl.host);
|
|
42
|
+
|
|
30
43
|
const authCodePromise = new Promise((resolve, reject) => {
|
|
31
44
|
provider.once("authorized", async (code) => {
|
|
32
45
|
await transport.finishAuth(code);
|
|
@@ -102,7 +115,6 @@ const model = await loadModel();
|
|
|
102
115
|
|
|
103
116
|
const blocklet = await MCPAgent.from({
|
|
104
117
|
url: appUrl.href,
|
|
105
|
-
timeout: 8000,
|
|
106
118
|
transport: "streamableHttp",
|
|
107
119
|
opts: {
|
|
108
120
|
authProvider: provider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-mcp-blocklet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework and MCP Server hosted by the Blocklet platform",
|
|
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-blocklet",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
20
20
|
"jsonwebtoken": "^9.0.2",
|
|
21
|
-
"open": "^10.1.
|
|
22
|
-
"zod": "^3.24.
|
|
23
|
-
"@aigne/core": "^1.
|
|
24
|
-
"@aigne/cli": "^1.
|
|
21
|
+
"open": "^10.1.2",
|
|
22
|
+
"zod": "^3.24.4",
|
|
23
|
+
"@aigne/core": "^1.14.0",
|
|
24
|
+
"@aigne/cli": "^1.9.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@aigne/test-utils": "^0.
|
|
27
|
+
"@aigne/test-utils": "^0.2.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"start": "bun run index.ts",
|
/package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|