Compare commits

...

38 Commits

Author SHA1 Message Date
Twisha Bansal
9670f25fdb have better release scripts 2026-01-27 14:25:13 +05:30
Twisha Bansal
7df74b16df update versions 2026-01-27 14:24:02 +05:30
Twisha Bansal
bd342c1b99 Merge branch 'main' into binary-npx 2026-01-27 14:20:47 +05:30
dependabot[bot]
f298c8f444 chore(deps): bump lodash from 4.17.21 to 4.17.23 in /docs/en/getting-started/quickstart/js/llamaindex (#2354)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to
4.17.23.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="dec55b7a3b"><code>dec55b7</code></a>
Bump main to v4.17.23 (<a
href="https://redirect.github.com/lodash/lodash/issues/6088">#6088</a>)</li>
<li><a
href="19c9251b36"><code>19c9251</code></a>
fix: setCacheHas JSDoc return type should be boolean (<a
href="https://redirect.github.com/lodash/lodash/issues/6071">#6071</a>)</li>
<li><a
href="b5e672995a"><code>b5e6729</code></a>
jsdoc: Add -0 and BigInt zeros to _.compact falsey values list (<a
href="https://redirect.github.com/lodash/lodash/issues/6062">#6062</a>)</li>
<li><a
href="edadd45214"><code>edadd45</code></a>
Prevent prototype pollution on baseUnset function</li>
<li><a
href="4879a7a7d0"><code>4879a7a</code></a>
doc: fix autoLink function, conversion of source links (<a
href="https://redirect.github.com/lodash/lodash/issues/6056">#6056</a>)</li>
<li><a
href="9648f692b0"><code>9648f69</code></a>
chore: remove <code>yarn.lock</code> file (<a
href="https://redirect.github.com/lodash/lodash/issues/6053">#6053</a>)</li>
<li><a
href="dfa407db0b"><code>dfa407d</code></a>
ci: remove legacy configuration files (<a
href="https://redirect.github.com/lodash/lodash/issues/6052">#6052</a>)</li>
<li><a
href="156e1965ae"><code>156e196</code></a>
feat: add renovate setup (<a
href="https://redirect.github.com/lodash/lodash/issues/6039">#6039</a>)</li>
<li><a
href="933e1061b8"><code>933e106</code></a>
ci: add pipeline for Bun (<a
href="https://redirect.github.com/lodash/lodash/issues/6023">#6023</a>)</li>
<li><a
href="072a807ff7"><code>072a807</code></a>
docs: update links related to Open JS Foundation (<a
href="https://redirect.github.com/lodash/lodash/issues/5968">#5968</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/lodash/lodash/compare/4.17.21...4.17.23">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=lodash&package-manager=npm_and_yarn&previous-version=4.17.21&new-version=4.17.23)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/googleapis/genai-toolbox/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Twisha Bansal <58483338+twishabansal@users.noreply.github.com>
2026-01-27 12:02:55 +05:30
Anubhav Dhawan
57a2ade4c5 feat(npm): Bump server package versions to 0.25.0 and generate new platform-specific build artifacts. (#2284)
Releases the NPM package versions with latest toolbox release
(`v.0.25.0`).
2026-01-09 15:34:33 +05:30
Twisha Bansal
bcb3566ba3 update versions'
update versions
2026-01-09 14:32:43 +05:30
Twisha Bansal
47bbef10c5 update version 2026-01-09 14:32:43 +05:30
Twisha Bansal
44e782371e script for server release 2026-01-09 14:32:43 +05:30
Twisha Bansal
705be4018d update dep versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
c968ed8925 rename file 2026-01-09 14:32:43 +05:30
Twisha Bansal
6f5911288d release dep package script 2026-01-09 14:32:43 +05:30
Twisha Bansal
cf42389d39 add script to update server packages 2026-01-09 14:32:43 +05:30
Twisha Bansal
49cb83ca5d update versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
961c4726c7 bump version 2026-01-09 14:32:43 +05:30
Twisha Bansal
6e961ad48b update supported platforms 2026-01-09 14:32:43 +05:30
Twisha Bansal
d5a9031a65 bump version 2026-01-09 14:32:43 +05:30
Twisha Bansal
669b9b3b5d update linux package versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
7bf04ddbb1 fix server package 2026-01-09 14:32:43 +05:30
Twisha Bansal
2705cf642c update server versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
fb8f757eaf upate version 2026-01-09 14:32:43 +05:30
Twisha Bansal
6731e25cff remove apple quarantine 2026-01-09 14:32:43 +05:30
Twisha Bansal
0aece20ada Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
401d0307d5 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
7479f5b871 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
a61a1d78a3 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
2fbf51968d Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
54b56ee7cc fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
39615a6011 fix path 2026-01-09 14:32:43 +05:30
Twisha Bansal
83562eb5ec fix package.json 2026-01-09 14:32:43 +05:30
Twisha Bansal
bb76fc6a84 fix testing 2026-01-09 14:32:43 +05:30
Twisha Bansal
21e4db2ed4 Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
05e075b3fe Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
e94eebc6af fix package 2026-01-09 14:32:43 +05:30
Twisha Bansal
e50dc777b7 Fixed readme 2026-01-09 14:32:43 +05:30
Twisha Bansal
1aaa84313c add markdown on how to test 2026-01-09 14:32:43 +05:30
Twisha Bansal
829e3168ff fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
3d76f60401 fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
d065b41598 add files 2026-01-09 14:32:43 +05:30
29 changed files with 879 additions and 3 deletions

View File

@@ -975,9 +975,10 @@
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"license": "MIT"
},
"node_modules/magic-bytes.js": {
"version": "1.12.1",

View File

@@ -0,0 +1,17 @@
cd server-darwin-arm64
npm pack .
npm publish --access public
cd ../server-darwin-x64
npm pack .
npm publish --access public
cd ../server-linux-x64
npm pack .
npm publish --access public
cd ../server-win32-x64
npm pack .
npm publish --access public
cd ..

View File

@@ -0,0 +1,7 @@
cd server
npm install --package-lock-only
git add package.json package-lock.json
git commit -m "update dep versions"
npm pack .
npm publish --access public

View File

@@ -0,0 +1,6 @@
# @toolbox-sdk/server-darwin-arm64
Platform-specific binary for the `toolbox` package on Darwin arm64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.26.0",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"os": [
"darwin"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.26.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js darwin arm64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.26.0

View File

@@ -0,0 +1,6 @@
# @toolbox-sdk/server-darwin-x64
Platform-specific binary for the `toolbox` package on Darwin x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.26.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"darwin"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.26.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js darwin x64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.26.0

View File

@@ -0,0 +1,7 @@
# @toolbox-sdk/server-linux-x64
Platform-specific binary for the `toolbox` package on Linux x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.26.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"linux"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.26.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js linux x64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.26.0

View File

@@ -0,0 +1,7 @@
# @toolbox-sdk/server-win32-x64
Platform-specific binary for the `toolbox` package on Windows x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.26.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"win32"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.26.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "bin/toolbox.exe",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js win32 x64"
},
"files": [
"bin/toolbox.exe"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.26.0

69
packages/server/README.md Normal file
View File

@@ -0,0 +1,69 @@
# Toolbox
A CLI tool for running a toolbox server.
## Installation
You can install the toolbox globally:
```bash
npm install -g @toolbox-sdk/server
```
Or run it directly using npx:
```bash
npx @toolbox-sdk/server
```
## Configuration
The toolbox requires a `tools.yaml` file in the current working directory to define sources, tools, and prompts.
### Example `tools.yaml`
```yaml
sources:
my-pg-source:
kind: postgres
host: 127.0.0.1
port: 5432
database: toolbox_db
user: postgres
password: password
tools:
search-hotels-by-name:
kind: postgres-sql
source: my-pg-source
description: Search for hotels based on name.
parameters:
- name: name
type: string
description: The name of the hotel.
statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';
prompts:
code-review:
description: "Asks the LLM to analyze code quality and suggest improvements."
messages:
- role: "user"
content: "Please review the following code for quality, correctness, and potential improvements: \n\n{{.code}}"
arguments:
- name: "code"
description: "The code to review"
required: true
```
To learn more on how to configure your toolbox, visit the [official docsite](https://googleapis.github.io/genai-toolbox/getting-started/configure/).
## Platform Support
The toolbox automatically handles platform-specific binaries. Supported platforms include:
- macOS (arm64, x64)
- Linux (x64)
- Windows (x64)
## Resources
For more information, visit the
- [MCP Toolbox repository](https://github.com/googleapis/genai-toolbox)
- [Official Documentation](https://googleapis.github.io/genai-toolbox/getting-started/introduction/)

49
packages/server/bin/run.js Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
const { spawn } = require('child_process');
const path = require('path');
const os = require('os');
const fs = require('fs');
const PLATFORMS = {
'darwin-arm64': '@toolbox-sdk/server-darwin-arm64',
'darwin-x64': '@toolbox-sdk/server-darwin-x64',
'linux-x64': '@toolbox-sdk/server-linux-x64',
'win32-x64': '@toolbox-sdk/server-win32-x64'
};
const currentKey = `${os.platform()}-${os.arch()}`;
const pkgName = PLATFORMS[currentKey];
if (!pkgName) {
console.error(`Unsupported platform: ${currentKey}`);
process.exit(1);
}
let binPath;
try {
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
const pkgDir = path.dirname(pkgJsonPath);
const binName = os.platform() === 'win32' ? 'toolbox.exe' : 'toolbox';
binPath = path.join(pkgDir, 'bin', binName);
} catch (e) {
console.error(`Binary for ${currentKey} not found. Installation failed?`);
process.exit(1);
}
if (os.platform() !== 'win32') {
try {
fs.chmodSync(binPath, 0o755);
if (os.platform() === 'darwin') {
const { execSync } = require('child_process');
try {
execSync(`xattr -d com.apple.quarantine "${binPath}"`, { stdio: 'ignore' });
} catch (e) {
}
}
} catch (e) {
console.warn(`Could not set execute permissions on ${binPath}: ${e.message}`);
}
}
spawn(binPath, process.argv.slice(2), { stdio: 'inherit' })
.on('exit', process.exit);

74
packages/server/package-lock.json generated Normal file
View File

@@ -0,0 +1,74 @@
{
"name": "@toolbox-sdk/server",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server",
"version": "0.26.0",
"license": "Apache-2.0",
"bin": {
"toolbox": "bin/run.js"
},
"optionalDependencies": {
"@toolbox-sdk/server-darwin-arm64": "0.26.0",
"@toolbox-sdk/server-darwin-x64": "0.26.0",
"@toolbox-sdk/server-linux-x64": "0.26.0",
"@toolbox-sdk/server-win32-x64": "0.26.0"
}
},
"node_modules/@toolbox-sdk/server-darwin-arm64": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-darwin-arm64/-/server-darwin-arm64-0.26.0.tgz",
"integrity": "sha512-NvyTc/PtRYM9QRpgxLeQNAPUD9dbwbyFzLiS/haaqAKrLdYBTmDiN5eJ8GwWyO3mhCEUqbneuY8J/9V8Vs0VWg==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@toolbox-sdk/server-darwin-x64": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-darwin-x64/-/server-darwin-x64-0.26.0.tgz",
"integrity": "sha512-ThYS3iEx6C8Obn7CgD5N8raAXFe7WnU39cjgD9GnLWlodQ+PYXKponWOgZVjqYyfVorPbQ53XOU0pXomb5xIUQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@toolbox-sdk/server-linux-x64": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-linux-x64/-/server-linux-x64-0.26.0.tgz",
"integrity": "sha512-nLDH5uXEpCJK4hJA4Z880kT87SAy0Y6Ql60n7myKKZalIpkPTKay8Fai2puSk+LXU249mv1jP9fQlCNEIdgG5Q==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@toolbox-sdk/server-win32-x64": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-win32-x64/-/server-win32-x64-0.26.0.tgz",
"integrity": "sha512-sez/lrIUvoh2pN9BIruYMohfACGNgVF42Wze0+57ub3bMKl5d2aE8dtMJOneedLyF/3i729KVWuNUDSfE2ni8w==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
]
}
}
}

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server",
"version": "0.26.0",
"license": "Apache-2.0",
"author": "Google LLC",
"bin": {
"toolbox": "./bin/run.js"
},
"files": [
"bin/run.js"
],
"repository": "googleapis/genai-toolbox",
"optionalDependencies": {
"@toolbox-sdk/server-darwin-arm64": "0.26.0",
"@toolbox-sdk/server-darwin-x64": "0.26.0",
"@toolbox-sdk/server-linux-x64": "0.26.0",
"@toolbox-sdk/server-win32-x64": "0.26.0"
}
}

91
packages/testing.md Normal file
View File

@@ -0,0 +1,91 @@
# How to test on different platforms
1. Create a local test registry. We are using Verdaccio. During the actual process, we publish to npm instead.
```sh
# install
npm install -g verdaccio
# start server
verdaccio
```
The output will show the config file location and the URL. Open your browser to:
http://localhost:4873
> Note: You can use `npm unpublish @toolbox-sdk/server --force --registry http://localhost:4873` to unpublish the package.
2. Pack all 4 packages and publish them to the local registry. Go in each package (eg. server-darwin-arm64) and run
```sh
npm ci --force
npm pack .
```
Then publish to the local registry
```sh
npm publish --registry http://localhost:4873
```
3. Go to the server package and run
```sh
npm ci --force
npm pack .
npm publish --registry http://localhost:4873
```
Now, you have published your package.
4. Now create a new folder (let's call it testing.) Add a tools.yaml file to the folder. It should look like this:
```yaml
sources:
my-pg-source:
kind: postgres
host: 127.0.0.1
port: 5432
database: toolbox_db
user: postgres
password: password
tools:
search-hotels-by-name:
kind: postgres-sql
source: my-pg-source
description: Search for hotels based on name.
parameters:
- name: name
type: string
description: The name of the hotel.
statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';
prompts:
code-review:
description: "Asks the LLM to analyze code quality and suggest improvements."
messages:
- role: "user"
content: "Please review the following code for quality, correctness, and potential improvements: \n\n{{.code}}"
arguments:
- name: "code"
description: "The code to review"
required: true
```
Note: Do not test this directly to the server folder. The registry might pick up local packages instead of global installation.
Use a separate testing folder outside the server folder for this testing.
6. From the testing folder, run
```sh
npx --registry=http://localhost:4873/ -y @toolbox-sdk/server
```
This should start up the toolbox server with the tools.yaml file.
7. Run the command to verify that the tools are available:
```sh
curl --location 'http://127.0.0.1:5000/mcp' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}'
```

23
packages/update_dep_packages.sh Executable file
View File

@@ -0,0 +1,23 @@
cd server-darwin-arm64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-darwin-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-linux-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-win32-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ..