@activepieces/piece-brave-search 0.0.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/README.md +28 -0
- package/package.json +27 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +34 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/web-search.d.ts +4 -0
- package/src/lib/actions/web-search.js +46 -0
- package/src/lib/actions/web-search.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Activepieces Brave Search Piece (MCP)
|
|
2
|
+
|
|
3
|
+
This project contains the source code for the **Brave Search** integration for Activepieces.
|
|
4
|
+
Activepieces automatically exposes this integration as an MCP (Model Context Protocol) server, allowing agents to use Brave Search.
|
|
5
|
+
|
|
6
|
+
## Integration Details
|
|
7
|
+
|
|
8
|
+
- **Name**: Brave Search
|
|
9
|
+
- **Description**: Privacy-focused web search engine.
|
|
10
|
+
- **Auth**: API Key (Brave Search API)
|
|
11
|
+
- **Actions**:
|
|
12
|
+
- `web_search`: Perform a web search query.
|
|
13
|
+
|
|
14
|
+
## Development Status
|
|
15
|
+
|
|
16
|
+
- [x] Scaffolding
|
|
17
|
+
- [ ] Implementation of `web_search` action
|
|
18
|
+
- [ ] Testing
|
|
19
|
+
|
|
20
|
+
## How to use
|
|
21
|
+
|
|
22
|
+
This code is designed to be dropped into the `packages/pieces/community/brave-search` directory of the Activepieces repository.
|
|
23
|
+
|
|
24
|
+
1. Clone Activepieces: `git clone https://github.com/activepieces/activepieces.git`
|
|
25
|
+
2. Copy this folder to `packages/pieces/community/brave-search`
|
|
26
|
+
3. Run `npm install` in the root.
|
|
27
|
+
4. Build the piece: `nx build piece-brave-search`
|
|
28
|
+
5. Run Activepieces locally to test.
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-brave-search",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "0.34.11",
|
|
6
|
+
"ai": "^6.0.0",
|
|
7
|
+
"axios": "1.13.1",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"form-data": "4.0.4",
|
|
11
|
+
"mime-types": "2.1.35",
|
|
12
|
+
"nanoid": "3.3.8",
|
|
13
|
+
"semver": "7.6.0",
|
|
14
|
+
"socket.io-client": "4.8.1",
|
|
15
|
+
"zod": "4.1.13",
|
|
16
|
+
"@activepieces/pieces-common": "0.11.5",
|
|
17
|
+
"@activepieces/pieces-framework": "0.25.3",
|
|
18
|
+
"@activepieces/shared": "0.35.0",
|
|
19
|
+
"tslib": "2.6.2"
|
|
20
|
+
},
|
|
21
|
+
"resolutions": {
|
|
22
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
23
|
+
},
|
|
24
|
+
"types": "./src/index.d.ts",
|
|
25
|
+
"main": "./src/index.js",
|
|
26
|
+
"type": "commonjs"
|
|
27
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.braveSearch = exports.braveSearchAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const web_search_1 = require("./lib/actions/web-search");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
exports.braveSearchAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
required: true,
|
|
11
|
+
description: 'Your Brave Search API Key (get it from https://brave.com/search/api/)',
|
|
12
|
+
});
|
|
13
|
+
exports.braveSearch = (0, pieces_framework_1.createPiece)({
|
|
14
|
+
displayName: 'Brave Search',
|
|
15
|
+
description: 'Privacy-preserving search engine',
|
|
16
|
+
auth: exports.braveSearchAuth,
|
|
17
|
+
minimumSupportedRelease: '0.30.0',
|
|
18
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/brave-search.png',
|
|
19
|
+
authors: ['ErisMorn', 'sanket-a11y'],
|
|
20
|
+
actions: [
|
|
21
|
+
web_search_1.braveWebSearchAction,
|
|
22
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
23
|
+
auth: exports.braveSearchAuth,
|
|
24
|
+
baseUrl: () => 'https://api.search.brave.com/res/v1',
|
|
25
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
return {
|
|
27
|
+
'X-Subscription-Token': auth.secret_text,
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
triggers: [],
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/brave-search/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yDAAgE;AAChE,+DAAwE;AAE3D,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EACT,uEAAuE;CAC1E,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,kCAAkC;IAC/C,IAAI,EAAE,uBAAe;IACrB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;IACpC,OAAO,EAAE;QACP,iCAAoB;QACpB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,uBAAe;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,qCAAqC;YACpD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,sBAAsB,EAAE,IAAI,CAAC,WAAW;iBACzC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const braveWebSearchAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
query: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
count: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.braveWebSearchAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const index_1 = require("../../index");
|
|
8
|
+
exports.braveWebSearchAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: index_1.braveSearchAuth,
|
|
10
|
+
name: 'web_search',
|
|
11
|
+
displayName: 'Web Search',
|
|
12
|
+
description: 'Search the web using Brave Search',
|
|
13
|
+
props: {
|
|
14
|
+
query: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Query',
|
|
16
|
+
description: 'The search query',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
count: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Count',
|
|
21
|
+
description: 'Number of results (1-20)',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 10,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
run(context) {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const query = context.propsValue.query;
|
|
29
|
+
const count = context.propsValue.count;
|
|
30
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
31
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
32
|
+
url: 'https://api.search.brave.com/res/v1/web/search',
|
|
33
|
+
headers: {
|
|
34
|
+
'X-Subscription-Token': context.auth.secret_text,
|
|
35
|
+
Accept: 'application/json',
|
|
36
|
+
},
|
|
37
|
+
queryParams: {
|
|
38
|
+
q: query,
|
|
39
|
+
count: count,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return response.body;
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=web-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/brave-search/src/lib/actions/web-search.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAA8C;AAEjC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,uBAAe;IACrB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;YACvC,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;YAEvC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,gDAAgD;gBACrD,OAAO,EAAE;oBACP,sBAAsB,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;oBAChD,MAAM,EAAE,kBAAkB;iBAC3B;gBACD,WAAW,EAAE;oBACX,CAAC,EAAE,KAAK;oBACR,KAAK,EAAE,KAA0B;iBAClC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|