### Quickstart Example for GCP Metadata (Node.js) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gcp-metadata/README.md This comprehensive example demonstrates how to initialize the `gcp-metadata` client, check for metadata server availability, and retrieve both instance-level and project-level metadata. It highlights the conditional access to metadata based on the execution environment within Google Cloud. ```javascript const gcpMetadata = require('gcp-metadata'); async function quickstart() { // check to see if this code can access a metadata server const isAvailable = await gcpMetadata.isAvailable(); console.log(`Is available: ${isAvailable}`); // Instance and Project level metadata will only be available if // running inside of a Google Cloud compute environment such as // Cloud Functions, App Engine, Kubernetes Engine, or Compute Engine. // To learn more about the differences between instance and project // level metadata, see: // https://cloud.google.com/compute/docs/storing-retrieving-metadata#project-instance-metadata if (isAvailable) { // grab all top level metadata from the service const instanceMetadata = await gcpMetadata.instance(); console.log('Instance metadata:'); console.log(instanceMetadata); // get all project level metadata const projectMetadata = await gcpMetadata.project(); console.log('Project metadata:'); console.log(projectMetadata); } } quickstart(); ``` -------------------------------- ### Installing depd Module Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/depd/Readme.md This snippet shows how to install the `depd` module using npm, the Node.js package manager. It's a standard command-line installation. ```Shell $ npm install depd ``` -------------------------------- ### Installing Google APIs Node.js Client Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/googleapis/README.md This snippet demonstrates how to install the main Google APIs Node.js client library or a specific API submodule using npm. Installing submodules can reduce startup times by only including the necessary API dependencies. ```sh $ npm install googleapis ``` ```sh $ npm install @googleapis/docs ``` -------------------------------- ### Making a Basic HTTP Request with gaxios in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gaxios/README.md This example demonstrates how to perform a simple GET request to a specified URL using the `request` function from the gaxios library. It shows the basic usage for fetching data from an API endpoint. ```js const {request} = require('gaxios'); const res = await request({ url: 'https://www.googleapis.com/discovery/v1/apis/', }); ``` -------------------------------- ### Installing the content-type Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/content-type/README.md This command installs the `content-type` package from npm, making it available for use in Node.js projects. It's a standard npm installation command. ```sh $ npm install content-type ``` -------------------------------- ### Installing .equal() Method on Buffer Prototype (JavaScript) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/buffer-equal-constant-time/README.md This code demonstrates how to extend the `Buffer` and `SlowBuffer` prototypes by calling `install()` from the `buffer-equal-constant-time` module. After installation, `Buffer` instances gain an `.equal()` method, allowing for a more object-oriented comparison syntax, which also performs a constant-time comparison. ```JavaScript require('buffer-equal-constant-time').install(); var a = new Buffer('asdf'); var b = new Buffer('asdf'); if (a.equal(b)) { // the same! } else { // different in at least one byte! } ``` -------------------------------- ### Implementing a Complete OAuth2 Flow in Node.js Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/google-auth-library/README.md This example demonstrates a full OAuth2 authentication flow, including generating an authorization URL, starting a local HTTP server to handle the callback, acquiring tokens, and making an authenticated API request to the People API. It shows how to get an authenticated client and inspect token information. ```JavaScript const {OAuth2Client} = require('google-auth-library'); const http = require('http'); const url = require('url'); const open = require('open'); const destroyer = require('server-destroy'); // Download your OAuth2 configuration from the Google const keys = require('./oauth2.keys.json'); /** * Start by acquiring a pre-authenticated oAuth2 client. */ async function main() { const oAuth2Client = await getAuthenticatedClient(); // Make a simple request to the People API using our pre-authenticated client. The `request()` method // takes an GaxiosOptions object. Visit https://github.com/JustinBeckwith/gaxios. const url = 'https://people.googleapis.com/v1/people/me?personFields=names'; const res = await oAuth2Client.request({url}); console.log(res.data); // After acquiring an access_token, you may want to check on the audience, expiration, // or original scopes requested. You can do that with the `getTokenInfo` method. const tokenInfo = await oAuth2Client.getTokenInfo( oAuth2Client.credentials.access_token ); console.log(tokenInfo); } /** * Create a new OAuth2Client, and go through the OAuth2 content * workflow. Return the full client to the callback. */ function getAuthenticatedClient() { return new Promise((resolve, reject) => { // create an oAuth client to authorize the API call. Secrets are kept in a `keys.json` file, // which should be downloaded from the Google Developers Console. const oAuth2Client = new OAuth2Client( keys.web.client_id, keys.web.client_secret, keys.web.redirect_uris[0] ); // Generate the url that will be used for the consent dialog. const authorizeUrl = oAuth2Client.generateAuthUrl({ access_type: 'offline', scope: 'https://www.googleapis.com/auth/userinfo.profile' }); // Open an http server to accept the oauth callback. In this simple example, the // only request to our webserver is to /oauth2callback?code= const server = http .createServer(async (req, res) => { try { if (req.url.indexOf('/oauth2callback') > -1) { // acquire the code from the querystring, and close the web server. const qs = new url.URL(req.url, 'http://localhost:3000') .searchParams; const code = qs.get('code'); console.log(`Code is ${code}`); res.end('Authentication successful! Please return to the console.'); server.destroy(); // Now that we have the code, use that to acquire tokens. const r = await oAuth2Client.getToken(code); // Make sure to set the credentials on the OAuth2 client. oAuth2Client.setCredentials(r.tokens); console.info('Tokens acquired.'); resolve(oAuth2Client); } } catch (e) { reject(e); } }) .listen(3000, () => { // open the browser to the authorize url to start the workflow open(authorizeUrl, {wait: false}).then(cp => cp.unref()); }); destroyer(server); }); } main().catch(console.error); ``` -------------------------------- ### Installing `math-intrinsics` Dependencies (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/math-intrinsics/README.md This command installs all necessary project dependencies listed in the `package.json` file for the `math-intrinsics` library. It prepares the development environment by fetching required packages from npm. ```Shell npm install ``` -------------------------------- ### Installing the 'open' Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/open/readme.md This snippet demonstrates how to install the 'open' package using npm, the Node.js package manager. It's a prerequisite for using the 'open' utility in your projects, allowing you to integrate its functionality for opening files and URLs. ```Shell npm install open ``` -------------------------------- ### Installing base64-js with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/base64-js/README.md This command installs the `base64-js` package using npm, making it available for use in Node.js projects. It's a prerequisite for using the library in a server-side or build environment. ```Shell npm install base64-js ``` -------------------------------- ### Installing call-bind-apply-helpers with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/call-bind-apply-helpers/README.md This snippet demonstrates how to install the `call-bind-apply-helpers` package using npm, saving it as a dependency in the project's `package.json` file. This command ensures the package is available for use in your project. ```sh npm install --save call-bind-apply-helpers ``` -------------------------------- ### Installing buffer-equal-constant-time Package (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/buffer-equal-constant-time/README.md This snippet demonstrates how to install the `buffer-equal-constant-time` package using the npm package manager. This command is a prerequisite for using the library in a Node.js project. ```Shell npm install buffer-equal-constant-time ``` -------------------------------- ### Installing node-fetch via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/node-fetch/README.md This command installs the `node-fetch` package using npm, making it available for use in Node.js projects. It installs the current stable release (2.x). ```Shell $ npm install node-fetch ``` -------------------------------- ### Installing call-bound via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/call-bound/README.md This command installs the `call-bound` library as a dependency in your project using npm, saving it to your `package.json` file. ```Shell npm install --save call-bound ``` -------------------------------- ### Installing call-bind Package via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/call-bind/README.md This command installs the `call-bind` package from npm and saves it as a dependency in the project's `package.json` file, making it available for use in JavaScript applications. ```sh npm install --save call-bind ``` -------------------------------- ### Installing Node.js Glob Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/glob/README.md This command installs the `glob` package from the npm registry, making it available for use in a Node.js project. It's the first step to integrate the glob functionality into your application. ```Shell npm i glob ``` -------------------------------- ### Preparing and Requiring Various File Types with rechoir in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/rechoir/README.md This snippet demonstrates how to use `rechoir.prepare` with `interpret.extensions` to enable Node.js's `require` mechanism for non-native file types like CoffeeScript, CSV, and TOML. It shows the setup required before these files can be directly imported as modules, highlighting that necessary transpilers or loaders must be locally installed. ```JavaScript const config = require('interpret').extensions; const rechoir = require('rechoir'); rechoir.prepare(config, './test/fixtures/test.coffee'); rechoir.prepare(config, './test/fixtures/test.csv'); rechoir.prepare(config, './test/fixtures/test.toml'); console.log(require('./test/fixtures/test.coffee')); console.log(require('./test/fixtures/test.csv')); console.log(require('./test/fixtures/test.toml')); ``` -------------------------------- ### Installing gaxios with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gaxios/README.md This snippet provides the command-line instruction to install the gaxios library using npm, the Node.js package manager. It is the first step required to use gaxios in a project. ```sh $ npm install gaxios ``` -------------------------------- ### Installing MCP TypeScript SDK Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/@modelcontextprotocol/sdk/README.md This command installs the Model Context Protocol (MCP) TypeScript SDK using npm, making it available for use in your project. It's the first step to integrate the SDK into your development environment. ```bash npm install @modelcontextprotocol/sdk ``` -------------------------------- ### Using dunder-proto for Prototype Access and Mutation (JavaScript) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/dunder-proto/README.md This JavaScript example illustrates how to use `dunder-proto` to get and set an object's prototype. It imports `getDunder` and `setDunder` functions, demonstrates initial prototype access, and then shows how setting the prototype to `null` removes inherited properties like `toString`. ```js const assert = require('assert'); const getDunder = require('dunder-proto/get'); const setDunder = require('dunder-proto/set'); const obj = {}; assert.equal('toString' in obj, true); assert.equal(getDunder(obj), Object.prototype); setDunder(obj, null); assert.equal('toString' in obj, false); assert.equal(getDunder(obj), null); ``` -------------------------------- ### Installing ecdsa-sig-formatter with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/ecdsa-sig-formatter/README.md This snippet demonstrates how to install the `ecdsa-sig-formatter` library using npm, saving it as a dependency in the project's `package.json` file. ```sh npm install ecdsa-sig-formatter --save ``` -------------------------------- ### Installing the 'statuses' Module Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/statuses/README.md This snippet demonstrates how to install the 'statuses' Node.js module using the npm package manager. The `npm install` command downloads and adds the module to your project's `node_modules` directory, making it available for use. ```Shell npm install statuses ``` -------------------------------- ### Demonstrating call-bind and callBound Usage in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/call-bind/README.md This example illustrates how to use `call-bind` to create a bound version of a function and `callBound` to get a robustly bound version of a built-in method like `Array.prototype.slice`, even after `Function.prototype.call` and `Function.prototype.bind` are deleted. ```js const assert = require('assert'); const callBind = require('call-bind'); const callBound = require('call-bind/callBound'); function f(a, b) { assert.equal(this, 1); assert.equal(a, 2); assert.equal(b, 3); assert.equal(arguments.length, 2); } const fBound = callBind(f); const slice = callBound('Array.prototype.slice'); delete Function.prototype.call; delete Function.prototype.bind; fBound(1, 2, 3); assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); ``` -------------------------------- ### Installing side-channel-list Package with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel-list/README.md This command installs the `side-channel-list` package from npm, saving it as a dependency in the project's `package.json` file. It is the first step to integrate the library into a Node.js or JavaScript project. ```Shell npm install --save side-channel-list ``` -------------------------------- ### Installing shx for Development Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shx/README.md This command installs `shx` as a development dependency in your project. This allows you to use `shx` commands within your `package.json` scripts without installing it globally. ```Shell npm install shx --save-dev ``` -------------------------------- ### Installing the Debug Utility via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/debug/README.md This command installs the 'debug' utility package globally or locally using npm, making it available for use in Node.js projects. ```bash $ npm install debug ``` -------------------------------- ### Installing brace-expansion Module via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/brace-expansion/README.md This command demonstrates how to install the `brace-expansion` module using npm (Node Package Manager), making it available for use in a JavaScript project. This is a prerequisite for using the module in your application. ```Bash npm install brace-expansion ``` -------------------------------- ### Installing Google Auth Library: Node.js Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/google-auth-library/README.md This command installs the `google-auth-library` package using npm, making it available for use in Node.js projects. It is the essential first step to integrate Google authentication capabilities into your application. ```bash npm install google-auth-library ``` -------------------------------- ### Installing concat-map via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/concat-map/README.markdown This command demonstrates how to install the `concat-map` package using npm, the Node.js package manager. Running this command will download and install the module into your project's `node_modules` directory. ```shell npm install concat-map ``` -------------------------------- ### Installing Nightly TypeScript Builds (npm) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/typescript/README.md This command installs the latest nightly build of TypeScript as a development dependency using npm. This is useful for testing upcoming features or bug fixes before they are officially released, providing early access to new functionalities. ```bash npm install -D typescript@next ``` -------------------------------- ### Installing Latest Stable TypeScript (npm) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/typescript/README.md This command installs the latest stable version of TypeScript as a development dependency using npm. It is suitable for most projects requiring a stable and well-tested build of the language. ```bash npm install -D typescript ``` -------------------------------- ### Installing GCP Metadata Client Library (Bash) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gcp-metadata/README.md This command installs the `gcp-metadata` client library using npm. It is a prerequisite for using the library in a Node.js project, allowing access to Google Cloud Platform metadata. ```bash npm install gcp-metadata ``` -------------------------------- ### Installing Minimist via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/minimist/README.md This command demonstrates how to install the 'minimist' package using npm, the Node.js package manager. Running this command will download and install the latest version of 'minimist' into your project's 'node_modules' directory, making it available for use in your JavaScript applications. ```Shell npm install minimist ``` -------------------------------- ### Installing safe-buffer Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/safe-buffer/README.md This snippet demonstrates how to install the `safe-buffer` package using npm, making it available for use in your Node.js projects. ```Shell npm install safe-buffer ``` -------------------------------- ### Installing `gtoken` Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gtoken/README.md This snippet demonstrates how to install the `gtoken` library using npm, the Node.js package manager. It adds `gtoken` as a dependency to your project, allowing you to use its functionalities for Google service account authentication. ```sh npm install gtoken ``` -------------------------------- ### Installing arrify npm package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/arrify/readme.md This command installs the 'arrify' package using npm, making it available for use in Node.js projects. It's a standard Node.js package installation process that fetches the package from the npm registry. ```Shell npm install arrify ``` -------------------------------- ### Installing Google Local Auth Client Library (npm) - Bash Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/@google-cloud/local-auth/README.md This snippet demonstrates how to install the `@google-cloud/local-auth` client library using npm. This is the first step required to use the library in a Node.js project, fetching all necessary dependencies. ```bash npm install @google-cloud/local-auth ``` -------------------------------- ### Installing Node.js Type Definitions via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/@types/node/README.md This command installs the Node.js type definitions package (`@types/node`) using npm. It is commonly used in TypeScript projects to provide type checking and autocompletion for Node.js APIs, enhancing development experience and code reliability. ```Shell npm install --save @types/node ``` -------------------------------- ### Installing http-errors Module Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/http-errors/README.md This command installs the `http-errors` module from the npm registry, making it available for use in Node.js projects. It's the standard way to add this dependency to your application. ```console npm install http-errors ``` -------------------------------- ### Using list-exports to Get Package Export Information in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/resolve/test/list-exports/packages/list-exports/README.md This example demonstrates how to use the `list-exports` package to retrieve export information for a `package.json` file. It imports necessary modules (`assert`, `path`, `listExports`), calls `listExports` with the current `package.json` and a `node: true` option to use the package's `engines.node` field, and then asserts that the returned data matches a predefined `expected` structure. Error handling is included to catch and log any exceptions. ```JavaScript const assert = require('assert'); const path = require('path'); const listExports = require('list-exports'); listExports('./package.json', { node: true }).then((data) => { assert.deepEqual(data, expected); }).catch((e) => { console.error(e); process.exit(1); }); ``` -------------------------------- ### Initializing Headers Object in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/node-fetch/README.md This snippet provides multiple examples of how to construct a new `Headers` object. It shows initialization from a plain JavaScript object, an array of key-value pairs, a `Map` object, and by cloning an existing `Headers` instance, demonstrating the flexibility of the `Headers` constructor. ```js // Example adapted from https://fetch.spec.whatwg.org/#example-headers-class const meta = { 'Content-Type': 'text/xml', 'Breaking-Bad': '<3' }; const headers = new Headers(meta); // The above is equivalent to const meta = [ [ 'Content-Type', 'text/xml' ], [ 'Breaking-Bad', '<3' ] ]; const headers = new Headers(meta); // You can in fact use any iterable objects, like a Map or even another Headers const meta = new Map(); meta.set('Content-Type', 'text/xml'); meta.set('Breaking-Bad', '<3'); const headers = new Headers(meta); const copyOfHeaders = new Headers(headers); ``` -------------------------------- ### Installing side-channel-map package via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel-map/README.md This command installs the `side-channel-map` package as a dependency in your project using npm, saving it to your `package.json` file. ```Shell npm install --save side-channel-map ``` -------------------------------- ### Installing raw-body Module (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/raw-body/README.md This command installs the `raw-body` Node.js module from the npm registry, making it available for use in JavaScript and TypeScript projects. ```Shell npm install raw-body ``` -------------------------------- ### Installing JWS Library with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/jws/readme.md This snippet demonstrates how to install the `jws` library using npm, the Node.js package manager. It's a prerequisite for using any of the JWS functionalities. ```bash npm install jws ``` -------------------------------- ### Installing path-parse via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/path-parse/README.md This command installs the `path-parse` library as a dependency in your project using npm. The `--save` flag adds it to your `package.json` file, ensuring it's listed as a required package for your application. ```Shell $ npm install --save path-parse ``` -------------------------------- ### Installing URI Template Library with Bower (Browser) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/url-template/README.md This command installs the `url-template` library for browser-based projects using the Bower package manager. It fetches the necessary files for client-side use, allowing the library to be included in web applications. ```Shell bower install url-template ``` -------------------------------- ### Installing side-channel-weakmap with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel-weakmap/README.md This command installs the `side-channel-weakmap` package as a dependency in your project using npm. The `--save` flag adds it to your `package.json` file, making it a required dependency for your application. ```sh npm install --save side-channel-weakmap ``` -------------------------------- ### Installing setprototypeof with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/setprototypeof/README.md This command installs the `setprototypeof` package from npm and saves it as a dependency in your project's `package.json` file, making it available for use in your application. ```shell npm install --save setprototypeof ``` -------------------------------- ### Installing the toidentifier Module Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/toidentifier/README.md This snippet demonstrates how to install the `toidentifier` Node.js module using the npm package manager. It's a prerequisite for using the `toidentifier` function in your JavaScript projects, ensuring the module is available in your project's dependencies. ```bash $ npm install toidentifier ``` -------------------------------- ### Installing side-channel Package via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel/README.md This command installs the `side-channel` package from npm and saves it as a dependency in your project's `package.json` file. This is the first step to integrate the library into your JavaScript project. ```Shell npm install --save side-channel ``` -------------------------------- ### Installing the is-stream Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/is-stream/readme.md This snippet demonstrates how to install the `is-stream` package using npm, the Node.js package manager. It's a prerequisite for using the library in a project. ```Shell $ npm install is-stream ``` -------------------------------- ### Installing unpipe Module (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/unpipe/README.md This snippet provides the command-line instruction to install the 'unpipe' module using npm, the Node.js package manager. This is a prerequisite for using the module in a Node.js project. ```sh $ npm install unpipe ``` -------------------------------- ### Installing `node-extend` via npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/extend/README.md This command installs the `extend` package from the npm registry, making it available for use in Node.js projects. It's the standard way to add this utility to your project's dependencies. ```Shell npm install extend ``` -------------------------------- ### Initializing and Running Mocha Tests (JavaScript) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/url-template/test/index.html This snippet initializes the Mocha test framework using the 'bdd' interface, enables leak checking to identify global variable leaks, and then executes all defined tests. This is a typical setup for running Mocha tests in a browser environment. ```JavaScript mocha.setup('bdd') mocha.checkLeaks(); mocha.run(); ``` -------------------------------- ### Installing dunder-proto Package (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/dunder-proto/README.md This snippet demonstrates how to install the `dunder-proto` npm package as a dependency in a Node.js project. The `--save` flag ensures the package is added to the `dependencies` list in `package.json`. ```sh npm install --save dunder-proto ``` -------------------------------- ### Basic Usage of minimatch in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/minimatch/README.md Demonstrates the basic usage of the `minimatch` function to test paths against glob patterns. It shows how to require the library and perform simple matches, including an example with extended glob matching and the `debug` option. ```javascript var minimatch = require("minimatch") minimatch("bar.foo", "*.foo") // true! minimatch("bar.foo", "*.bar") // false! minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! ``` -------------------------------- ### Basic Usage of 'open' Package in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/open/readme.md This JavaScript example illustrates various ways to use the 'open' package. It shows how to open files (like images) and URLs, with options to wait for the opened application to quit, specify a particular browser, and pass command-line arguments to the application. ```JavaScript const open = require('open'); (async () => { // Opens the image in the default image viewer and waits for the opened app to quit. await open('unicorn.png', {wait: true}); console.log('The image viewer app quit'); // Opens the URL in the default browser. await open('https://sindresorhus.com'); // Opens the URL in a specified browser. await open('https://sindresorhus.com', {app: 'firefox'}); // Specify app arguments. await open('https://sindresorhus.com', {app: ['google chrome', '--incognito']}); })(); ``` -------------------------------- ### Installing object-inspect Package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/object-inspect/readme.markdown This command provides instructions for installing the `object-inspect` package using npm, the Node.js package manager. Successful execution of this command is a prerequisite for using the library in any JavaScript project. ```Shell npm install object-inspect ``` -------------------------------- ### Creating an MCP Server in TypeScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/@modelcontextprotocol/sdk/README.md This example illustrates how to set up an MCP server using the SDK. It defines request handlers for 'resources/list' and 'resources/read' methods, demonstrating how the server responds to client requests by providing resource metadata and content. The server uses StdioServerTransport for standard I/O communication. ```typescript import { Server } from "@modelcontextprotocol/sdk/server"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio"; const server = new Server({ name: "example-server", version: "1.0.0", }); server.setRequestHandler(ListResourcesRequestSchema, async () => { return { resources: [ { uri: "file:///example.txt", name: "Example Resource", }, ], }; }); server.setRequestHandler(ReadResourceRequestSchema, async (request) => { if (request.params.uri === "file:///example.txt") { return { contents: [ { uri: "file:///example.txt", mimeType: "text/plain", text: "This is the content of the example resource.", }, ], }; } else { throw new Error("Resource not found"); } }); const transport = new StdioServerTransport(); await server.connect(transport); ``` -------------------------------- ### Example Output of balanced-match in Bash Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/balanced-match/README.md This snippet shows the console output when running the JavaScript example code. It illustrates the structure of the objects returned by the `balanced()` function, including `start`, `end`, `pre`, `body`, and `post` properties for each matched pair. ```bash $ node example.js { start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } { start: 3, end: 9, pre: 'pre', body: 'first', post: 'between{second}post' } { start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } ``` -------------------------------- ### Installing the Google APIs Common Module Node.js Client Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/googleapis-common/README.md This command installs the `googleapis-common` client library using npm. It is the primary method for adding this dependency to a Node.js project. This library is a common tooling component for other Google API client libraries. ```bash npm install googleapis-common ``` -------------------------------- ### Installing bignumber.js in Node.js (npm) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/bignumber.js/README.md This command installs the bignumber.js package into a Node.js project using npm, the Node.js package manager. It adds the library to the project's `node_modules` directory and updates `package.json`. ```Bash npm install bignumber.js ``` -------------------------------- ### Installing is-wsl Package (npm) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/is-wsl/readme.md This command installs the `is-wsl` package using npm, the Node.js package manager. It adds the package to your project's dependencies, making it available for use in your JavaScript applications. ```Shell $ npm install is-wsl ``` -------------------------------- ### Fetching plain text or HTML with node-fetch Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/node-fetch/README.md This example demonstrates how to make a GET request to a URL and retrieve the response body as plain text or HTML. The `.text()` method is used to parse the response, and the content is then logged to the console. ```JavaScript fetch('https://github.com/') .then(res => res.text()) .then(body => console.log(body)); ``` -------------------------------- ### Using shx Commands on the Command Line Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shx/README.md These examples demonstrate various `shx` commands for common file system operations like listing directories (`ls`), changing directories (`pwd`), removing files (`rm`), creating files (`touch`), copying files (`cp`), creating directories (`mkdir`), and echoing text. They highlight `shx`'s cross-platform compatibility and support for options like `--silent`. ```Bash $ shx pwd /home/username/path/to/dir $ shx ls file.txt file2.txt $ shx rm *.txt $ shx ls $ shx echo "Hi there!" Hi there! $ shx touch helloworld.txt $ shx cp helloworld.txt foobar.txt $ shx mkdir sub $ shx ls foobar.txt helloworld.txt sub $ shx rm -r sub $ shx --silent ls fakeFileName ``` -------------------------------- ### ShellJS sed Function Example Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shx/README.md This JavaScript code demonstrates the direct usage of `shell.sed()` in ShellJS. It shows how to perform an in-place global replacement of a string within a specified file using a regular expression. ```JavaScript shell.sed('-i', /original string/g, 'replacement', 'filename.txt'); ``` -------------------------------- ### Creating an MCP Client in TypeScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/@modelcontextprotocol/sdk/README.md This snippet demonstrates how to initialize an MCP client using the SDK. It sets up a StdioClientTransport for communication, connects the client, and then shows how to list available resources and read content from a specific resource using the client's request method, adhering to the MCP specification. ```typescript import { Client } from "@modelcontextprotocol/sdk/client"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio"; const transport = new StdioClientTransport({ command: "path/to/server", }); const client = new Client({ name: "example-client", version: "1.0.0", }); await client.connect(transport); // List available resources const resources = await client.request( { method: "resources/list" }, ListResourcesResultSchema ); // Read a specific resource const resourceContent = await client.request( { method: "resources/read", params: { uri: "file:///example.txt" } }, ReadResourceResultSchema ); ``` -------------------------------- ### Running Tests and Performance Benchmarks for iconv-lite (Bash) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/iconv-lite/README.md This snippet provides a sequence of bash commands to set up, test, and analyze the performance and code coverage of the `iconv-lite` library. It includes steps for cloning the repository, installing dependencies, running unit tests, executing performance benchmarks, and generating/viewing test coverage reports. ```bash $ git clone git@github.com:ashtuchkin/iconv-lite.git $ cd iconv-lite $ npm install $ npm test $ # To view performance: $ node test/performance.js $ # To view test coverage: $ npm run coverage $ open coverage/lcov-report/index.html ``` -------------------------------- ### Establishing WebSocket Connections with HttpsProxyAgent (TypeScript) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/https-proxy-agent/README.md This example illustrates using `HttpsProxyAgent` to establish a WebSocket connection through an HTTP proxy. It initializes a `WebSocket` instance with the agent, sends a 'hello world' message upon successful connection, and logs received messages before closing the socket. ```ts import WebSocket from 'ws'; import { HttpsProxyAgent } from 'https-proxy-agent'; const agent = new HttpsProxyAgent('http://168.63.76.32:3128'); const socket = new WebSocket('ws://echo.websocket.org', { agent }); socket.on('open', function () { console.log('"open" event!'); socket.send('hello world'); }); socket.on('message', function (data, flags) { console.log('"message" event! %j %j', data, flags); socket.close(); }); ``` -------------------------------- ### Installing URI Template Library with npm (Node.js) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/url-template/README.md This command installs the `url-template` library for Node.js projects using the npm package manager. It makes the library available for use in your JavaScript code by adding it to your project's dependencies. ```Shell npm install url-template ``` -------------------------------- ### Basic Usage of qs for Parsing and Stringifying in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/qs/README.md This snippet demonstrates the fundamental usage of the 'qs' library. It shows how to parse a simple query string into an object using `qs.parse()` and then convert that object back into a query string using `qs.stringify()`, verifying the results with Node.js `assert` module. ```javascript var qs = require('qs'); var assert = require('assert'); var obj = qs.parse('a=c'); assert.deepEqual(obj, { a: 'c' }); var str = qs.stringify(obj); assert.equal(str, 'a=c'); ``` -------------------------------- ### Performing a simple POST request with node-fetch Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/node-fetch/README.md This example shows how to send a basic POST request with a plain string body. The `method` option is set to 'POST', and the `body` contains the data. The response is expected to be JSON and is logged. ```JavaScript fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) .then(res => res.json()) // expecting a json response .then(json => console.log(json)); ``` -------------------------------- ### Running Node.js App with DEBUG in CMD Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/debug/README.md This example shows how to set the `DEBUG` environment variable and then immediately execute a Node.js application (`app.js`) within the same Windows Command Prompt line. This enables all debug output for the running application. ```cmd set DEBUG=* & node app.js ``` -------------------------------- ### Using side-channel-map for storing and retrieving data in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel-map/README.md This example demonstrates how to initialize `side-channel-map`, store a value associated with an object key, retrieve it, and then delete it. It also shows the use of `assert` for verifying operations and `assert.throws` for expected errors when a key is not present. ```JavaScript const assert = require('assert'); const getSideChannelMap = require('side-channel-map'); const channel = getSideChannelMap(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Listing Package Exports with ls-exports (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/resolve/test/list-exports/packages/ls-exports/README.md This command-line example demonstrates how to use the `ls-exports` utility to inspect the exports of a specific package and version. It queries the `resolve` package at version `1` to show its exposed specifiers and other details. ```sh ls-exports package resolve@1 ``` -------------------------------- ### Accessing Blogger API with Async/Await in Node.js Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/googleapis/README.md This example demonstrates fetching Google Blogger API details using the modern async/await syntax, offering a more synchronous-looking approach to asynchronous code. It includes error handling by catching the promise rejection. ```js async function runSample() { const res = await blogger.blogs.get(params); console.log(`The blog url is ${res.data.url}`); } runSample().catch(console.error); ``` -------------------------------- ### Using shx sed for String Replacement Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shx/README.md This shell command illustrates how to use `shx sed` to perform string replacement, mimicking the Unix `sed` utility. It demonstrates an in-place global replacement of 'original string' with 'replacement' in 'filename.txt', highlighting the `s/regex/replacement/flags` syntax. ```Shell shx sed -i "s/original string/replacement/g" filename.txt ``` -------------------------------- ### Initializing GoogleToken with Raw Private Key String Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gtoken/README.md This example shows how to initialize `GoogleToken` by directly providing the RSA private key as a string instead of a file. It requires specifying the service account email and desired scopes, along with the raw key content, to obtain authentication tokens. ```js const key = '-----BEGIN RSA PRIVATE KEY-----\nXXXXXXXXXXX...'; const { GoogleToken } = require('gtoken'); const gtoken = new GoogleToken({ email: 'my_service_account_email@developer.gserviceaccount.com', scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes key: key, eagerRefreshThresholdMillis: 5 * 60 * 1000 }); ``` -------------------------------- ### Applying and Retrieving Multiple BigNumber.js Configurations (JavaScript) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/bignumber.js/doc/API.html Demonstrates how to set multiple configuration options simultaneously using `BigNumber.config()` and how to retrieve the current configuration object to inspect individual settings. ```JavaScript BigNumber.config({ DECIMAL_PLACES: 40, ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL, EXPONENTIAL_AT: [-10, 20], RANGE: [-500, 500], CRYPTO: true, MODULO_MODE: BigNumber.ROUND_FLOOR, POW_PRECISION: 80, FORMAT: { groupSize: 3, groupSeparator: ' ', decimalSeparator: ',' }, ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' }); obj = BigNumber.config(); obj.DECIMAL_PLACES // 40 obj.RANGE // [-500, 500] ``` -------------------------------- ### Installing is-docker npm package Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/is-docker/readme.md This command installs the `is-docker` package using npm, making it available for use in JavaScript projects. ```Shell npm install is-docker ``` -------------------------------- ### Obtaining Google Service Account Tokens with Callback (Key File) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/gtoken/README.md This example shows how to initialize `GoogleToken` using a `.pem` or `.json` key file and retrieve tokens via a callback function. It configures the service account email, scopes, and an eager refresh threshold, then logs the obtained access token and its details or any error. ```js const { GoogleToken } = require('gtoken'); const gtoken = new GoogleToken({ keyFile: 'path/to/key.pem', // or path to .json key file email: 'my_service_account_email@developer.gserviceaccount.com', scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes eagerRefreshThresholdMillis: 5 * 60 * 1000 }); gtoken.getToken((err, tokens) => { if (err) { console.log(err); return; } console.log(tokens); // { // access_token: 'very-secret-token', // expires_in: 3600, // token_type: 'Bearer' // } }); ``` -------------------------------- ### Example DeprecationError Stack Trace Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/depd/Readme.md This snippet provides an example of the `error.stack` output when a 'deprecation' event is emitted on `process`. It shows the structure of the stack trace for a `DeprecationError`. ```JavaScript DeprecationError: my-cool-module deprecated oldfunction at Object. ([eval]-wrapper:6:22) at Module._compile (module.js:456:26) at evalScript (node.js:532:25) at startup (node.js:80:7) at node.js:902:3 ``` -------------------------------- ### Installing Node.js TypeScript Types (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/raw-body/README.md This command installs the Node.js type declarations (`@types/node`), which are required for TypeScript projects using the `raw-body` module to enable autocompletion and type checking. ```Shell npm install @types/node ``` -------------------------------- ### Enabling and Using Server Destruction in Node.js Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/server-destroy/README.md This snippet illustrates how to integrate and utilize the 'server-destroy' module. It demonstrates importing the module, creating a standard HTTP server, making it listen on a port, enhancing it with the 'destroy' functionality, and finally invoking the 'destroy' method to shut down the server and its active connections. ```javascript var enableDestroy = require('server-destroy'); var server = http.createServer(function(req, res) { // do stuff, blah blah blah }); server.listen(PORT); // enhance with a 'destroy' function enableDestroy(server); // some time later... server.destroy(); ``` -------------------------------- ### Integrating Google Drive Server with Desktop App Configuration Source: https://github.com/isaacphi/mcp-gdrive/blob/main/README.md This JSON snippet illustrates how to configure the `mcp-gdrive` server within a desktop application's server configuration. It defines the command to run the server using `npx` and passes the necessary environment variables (`CLIENT_ID`, `CLIENT_SECRET`, `GDRIVE_CREDS_DIR`) for authentication and operation. ```JSON { "mcpServers": { "gdrive": { "command": "npx", "args": ["-y", "@isaacphi/mcp-gdrive"], "env": { "CLIENT_ID": "", "CLIENT_SECRET": "", "GDRIVE_CREDS_DIR": "/path/to/config/directory" } } } } ``` -------------------------------- ### Installing uuid Library with npm Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/uuid/README.md Instructions to install the 'uuid' library using the npm package manager. This is the first step to integrate the library into a JavaScript project. ```Shell npm install uuid ``` -------------------------------- ### Running Development Commands for Glob Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/glob/README.md This snippet provides common shell commands for developing and testing the `node-glob` library. It includes commands for running unit tests, regenerating test fixtures, benchmarking against other shell implementations, and profiling JavaScript code for performance analysis. ```Shell # to run tests npm test # to re-generate test fixtures npm run test-regen # to benchmark against bash/zsh npm run bench # to profile javascript npm run prof ``` -------------------------------- ### Performing Releases with standard-version (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/uuid/CONTRIBUTING.md These commands facilitate the release process for the mcp-gdrive library using `standard-version`. The first command performs a dry run to verify the output without making actual changes, while the second command executes the release, including version bumping and tag creation. ```shell npm run release -- --dry-run ``` ```shell npm run release ``` -------------------------------- ### Running Tests for node-jwa (Bash) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/jwa/README.md This command executes the test suite for the `node-jwa` library. It automatically generates necessary keypairs for testing. To force the generation of new keypairs, run `make clean` before executing `npm test` again. ```bash $ npm test ``` -------------------------------- ### Using side-channel for Data Storage and Assertion in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/side-channel/README.md This example demonstrates how to use the `side-channel` library to associate data with an object key. It shows initializing a channel, checking for key existence, setting and retrieving data, and using the `assert` method to verify key presence. It also illustrates how to delete a key and the resulting state. ```JavaScript const assert = require('assert'); const getSideChannel = require('side-channel'); const channel = getSideChannel(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Installing balanced-match via npm in Bash Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/balanced-match/README.md This snippet provides the command to install the `balanced-match` library using npm, the Node.js package manager. This command adds the package to the project's `node_modules` directory and updates `package.json` if `--save` or `--save-dev` is used (though not shown here, `npm install` by default adds to `dependencies` in newer npm versions). ```bash npm install balanced-match ``` -------------------------------- ### Executing ShellJS Commands via shx CLI Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shelljs/README.md Demonstrates how to use `shx`, a utility that exposes ShellJS commands to the command line for cross-platform Unix command execution. It shows creating a directory, touching a file, and removing a directory recursively. ```bash $ shx mkdir -p foo $ shx touch foo/bar.txt $ shx rm -rf foo ``` -------------------------------- ### Loading bignumber.js in Browser (Basic HTML) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/bignumber.js/README.md This snippet demonstrates how to include the bignumber.js library in an HTML page using a standard script tag, assuming the file is locally available. This makes the `BigNumber` constructor globally accessible. ```HTML ``` -------------------------------- ### Running `math-intrinsics` Tests (Shell) Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/math-intrinsics/README.md This command executes the test suite for the `math-intrinsics` library. It verifies the functionality of all implemented math intrinsics and helpers, ensuring they work as expected and adhere to specifications. ```Shell npm test ``` -------------------------------- ### Instantiating Minimatch Class in JavaScript Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/minimatch/README.md Shows how to create an instance of the `minimatch.Minimatch` class. This class allows for more granular control over pattern matching by providing access to properties like `pattern`, `options`, `set`, and `regexp`. ```javascript var Minimatch = require("minimatch").Minimatch var mm = new Minimatch(pattern, options) ``` -------------------------------- ### Installing Terser for JavaScript Minification in Bash Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/bignumber.js/README.md This command demonstrates how to globally install `terser`, a popular JavaScript minifier. Terser is a prerequisite for compressing and optimizing JavaScript files, including the BigNumber.js library. ```Bash npm install -g terser ``` -------------------------------- ### Copying Files and Directories with ShellJS cp Source: https://github.com/isaacphi/mcp-gdrive/blob/main/node_modules/shelljs/README.md Illustrates how to use the `cp` command to copy files and directories. Examples include copying a single file, recursively copying a directory, and copying multiple sources (using glob patterns and an array) to a destination. ```javascript cp('file1', 'dir1'); cp('-R', 'path/to/dir/', '~/newCopy/'); cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp'); cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above ```