### Install and Test Project Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/ajv/README.md Standard npm commands to install project dependencies, initialize git submodules, and run tests. This is a common setup for Node.js projects. ```bash npm install git submodule update --init npm test ``` -------------------------------- ### Create and Start a New Express Application Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/express/Readme.md These commands outline the process of creating a new Express application using the `express-generator`, navigating into the newly created application directory, installing its dependencies, and starting the development server. This sequence is part of the 'Quick Start' guide for Express. ```bash express /tmp/foo && cd /tmp/foo npm install npm start ``` -------------------------------- ### Run an Express.js Example Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/express/Readme.md After cloning the Express repository and installing dependencies, this command shows how to execute a specific example provided within the Express project. The example `content-negotiation` is run using Node.js. This helps in understanding various features of Express. ```bash node examples/content-negotiation ``` -------------------------------- ### Basic Express.js Server Setup Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/express/Readme.md This JavaScript snippet demonstrates the fundamental setup of an Express.js server. It imports the express module, creates an app instance, defines a basic route for the root URL ('/'), and starts the server listening on port 3000. This is a common starting point for Express applications. ```javascript import express from 'express' const app = express() app.get('/', (req, res) => { res.send('Hello World') }) app.listen(3000) ``` -------------------------------- ### Bootstrap Project Dependencies with Yarn (Bash) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Installs all project and subpackage dependencies using Yarn. This command is essential after initial setup or after running 'yarn clean'. ```bash yarn bootstrap ``` -------------------------------- ### Clone Express Repository and Install Dependencies Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/express/Readme.md This set of commands demonstrates how to clone the Express.js GitHub repository, navigate into the cloned directory, and install all necessary project dependencies. This is typically done to explore examples or contribute to the Express.js project itself. ```bash git clone https://github.com/expressjs/express.git --depth 1 && cd express npm install ``` -------------------------------- ### Full API Example with Middleware and JSON Body Parsing Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/router/README.md A comprehensive example demonstrating server setup, global middleware (compression), route-specific middleware (body-parser), and handling JSON PATCH requests. ```APIDOC ## GET / ### Description Retrieves a global message set by a PATCH request. ### Method GET ### Endpoint `/` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl http://127.0.0.1:8080 ``` ### Response #### Success Response (200) - **Content-Type** (string) - `text/plain; charset=utf-8` - **Body** (string) - The current message. #### Response Example ``` Hello World! ``` --- ## PATCH /api/set-message ### Description Updates a global message. Requires a JSON body with a `value` field. ### Method PATCH ### Endpoint `/api/set-message` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **value** (string) - Required - The new message to set. ### Request Example ```bash curl http://127.0.0.1:8080/api/set-message -X PATCH -H "Content-Type: application/json" -d '{"value":"Cats!"}' ``` ### Response #### Success Response (200) - **Content-Type** (string) - `text/plain; charset=utf-8` - **Body** (string) - The updated message. #### Response Example ``` Cats! ``` #### Error Response (400) - **Content-Type** (string) - `text/plain; charset=utf-8` - **Body** (string) - "Invalid API Syntax" #### Response Example ``` Invalid API Syntax ``` ``` -------------------------------- ### Execute Package Binary with get-bin-path (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/execa/readme.md Executes the current package's binary using `get-bin-path` to retrieve the path and `execa` to run it. This method validates the `package.json`'s `bin` field setup and requires `get-bin-path` and `execa` to be installed. ```javascript import {getBinPath} from 'get-bin-path'; const binPath = await getBinPath(); await execa(binPath); ``` -------------------------------- ### Clean Project with Yarn (Bash) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Removes Yarn and all installed dependencies from the workspace. After running this command, the workspace setup process must be repeated. ```bash yarn clean ``` -------------------------------- ### Basic router setup and GET request handling Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/router/README.md Sets up a basic HTTP server using Node.js's http module and the 'router' package. It defines a GET route for the root path ('/') that responds with 'Hello World!'. It also includes the 'finalhandler' middleware to gracefully handle response finalization. ```javascript var finalhandler = require('finalhandler') var http = require('http') var Router = require('router') var router = Router() router.get('/', function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) var server = http.createServer(function (req, res) { router(req, res, finalhandler(req, res)) }) server.listen(3000) ``` -------------------------------- ### Example: Using side-channel-map in JavaScript Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/side-channel-map/README.md Demonstrates how to initialize and use the side-channel-map. It covers setting, getting, asserting, and deleting keys, along with checking for key existence and handling errors when a key is not asserted. ```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); ``` -------------------------------- ### Emerging Technology Analysis Workflow Example Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/examples/llm-usage-guide.md Provides a workflow for analyzing emerging technologies, focusing on AI and ML. It includes exploring concepts, finding recent papers, comparing with established work, and analyzing specific breakthroughs. ```bash # 1. Explore AI/ML concepts list_categories(source="openalex") # 2. Find hot recent papers fetch_latest(source="arxiv", category="cs.LG", count=20) # 3. Compare with established work fetch_top_cited(concept="large language models", since="2022-01-01", count=30) # 4. Analyze specific breakthroughs fetch_content(source="arxiv", paper_id="[top cited paper ID]") ``` -------------------------------- ### Usage Example for side-channel-weakmap Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/side-channel-weakmap/README.md Demonstrates how to use the side-channel-weakmap library. It shows how to create a channel, set, get, delete, and assert keys. It also includes error handling for non-existent keys. ```javascript const assert = require('assert'); const getSideChannelList = require('side-channel-weakmap'); const channel = getSideChannelList(); 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); ``` -------------------------------- ### Developer Setup for ModuleImporter Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/@humanwhocodes/module-importer/README.md Provides instructions for setting up the development environment for the ModuleImporter project. This includes forking, cloning, installing dependencies, and running tests. ```bash 1. Fork the repository 2. Clone your fork 3. Run `npm install` to setup dependencies 4. Run `npm test` to run tests ``` -------------------------------- ### Contribution Guide Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Instructions on how to set up the repository locally, run commands, and contribute changes via Pull Requests. ```APIDOC # How to Contribute In this section of the documentation we will cover: 1) How to set up this repository locally 2) How to get started with running commands 3) How to contribute changes using Pull Requests ## Dependencies This package requires the following dependencies to run: 1) [Yarn V1](https://yarnpkg.com/getting-started/install) 3) [Docker](https://docs.docker.com/get-docker/) ## Setting up your workspace To contribute to this repository, start by setting up this project locally: 1) Fork this repository into your Git account 2) Clone the forked repository to your local directory using `git clone` 3) Install any of the above missing dependencies ## Launching the project Once the project is installed locally, you are ready to start up its services: 1) Ensure that your Docker service is running. 2) From the root directory of your project, run the `yarn` command in the command prompt to install yarn. 3) Run the `yarn bootstrap` command to install any necessary dependencies. 4) Run `yarn test:services:start` to start up this project's Docker container. The container will launch all services within your workspace. ## Available Commands Once the project is running, you can execute a variety of commands. The root workspace and each subpackage contain a `package.json` file with a `scripts` field listing all the commands that can be executed from that directory. This project also supports native `yarn`, and `docker` commands. Here, we'll cover the primary commands that can be executed from the root directory. Unless otherwise noted, these commands can also be executed from a subpackage. If executed from a subpackage, they will only affect that subpackage, rather than the entire workspace. ### `yarn` The `yarn` command installs yarn in the workspace. ### `yarn bootstrap` The `yarn bootstrap` command installs all dependencies in the workspace. ### `yarn test:services:start` The `yarn test:services:start` command starts up the project's Docker container, launching all services in the workspace. This command must be executed from the root directory. ### `yarn test:services:stop` The `yarn test:services:stop` command brings down the project's Docker container, halting all services. This command must be executed from the root directory. ### `yarn test` The `yarn test` command runs all tests in the workspace. ### `yarn clean` The `yarn clean` command removes yarn and all dependencies installed by yarn. After executing this command, you must repeat the steps in *Setting up your workspace* to rebuild your workspace. ``` -------------------------------- ### Example 1 - Dispatch GET request Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/undici/docs/docs/api/Dispatcher.md An example demonstrating how to dispatch a GET request using the Undici client. ```APIDOC ## GET / Example Request ### Description This example demonstrates dispatching a GET request with custom headers and handling various lifecycle events. ### Method GET ### Endpoint / ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```javascript import { createServer } from 'http' import { Client } from 'undici' import { once } from 'events' const server = createServer((request, response) => { response.end('Hello, World!') }).listen() await once(server, 'listening') const client = new Client(`http://localhost:${server.address().port}`) const data = [] client.dispatch({ path: '/', method: 'GET', headers: { 'x-foo': 'bar' } }, { onConnect: () => { console.log('Connected!') }, onError: (error) => { console.error(error) }, onHeaders: (statusCode, headers) => { console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`) }, onData: (chunk) => { console.log('onData: chunk received') data.push(chunk) }, onComplete: (trailers) => { console.log(`onComplete | trailers: ${trailers}`) const res = Buffer.concat(data).toString('utf8') console.log(`Data: ${res}`) client.close() server.close() } }) ``` ### Response #### Success Response (200) - **body** (string) - The response body, in this case 'Hello, World!'. #### Response Example ``` Hello, World! ``` ``` -------------------------------- ### Cross-Disciplinary Research Workflow Example Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/examples/llm-usage-guide.md Illustrates a workflow for cross-disciplinary research. It emphasizes starting broad with OpenAlex, narrowing focus with PMC, checking preprint activity on bioRxiv, and then diving into intersection papers. ```bash # 1. Start broad with OpenAlex fetch_top_cited(concept="artificial intelligence", since="2023-01-01", count=15) # 2. Narrow to specific applications fetch_latest(source="pmc", category="bioinformatics", count=10) # 3. Check preprint activity fetch_latest(source="biorxiv", category="bioinformatics", count=8) # 4. Deep dive into intersection papers fetch_content(source="pmc", paper_id="[relevant ID]") ``` -------------------------------- ### Configuring Keyv with Compression Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Shows how to enable gzip and brotli compression in Keyv by passing the 'compression' option to the constructor. It also demonstrates how to pass a custom compression function or use the pre-built compression adapters. ```javascript const KeyvGzip = require('@keyv/compress-gzip'); const Keyv = require('keyv'); const keyvGzip = new KeyvGzip(); const keyv = new Keyv({ compression: KeyvGzip }); ``` -------------------------------- ### Making GET Requests Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/axios/README.md Examples of how to perform GET requests using Axios, including with query parameters and async/await. ```APIDOC ## Making GET Requests ### Basic GET Request ```js axios.get('/user?ID=12345') .then(function (response) { // handle success console.log(response); }) .catch(function (error) { // handle error console.log(error); }) .finally(function () { // always executed }); ``` ### GET Request with `params` Object ```js axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed }); ``` ### Using `async/await` with GET Request ```js async function getUser() { try { const response = await axios.get('/user?ID=12345'); console.log(response); } catch (error) { console.error(error); } } ``` **Note**: `async/await` requires an environment that supports ECMAScript 2017. ``` -------------------------------- ### Get visitor keys for an AST node (evk.getKeys) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/eslint-visitor-keys/README.md Returns the visitor keys for a given AST node, excluding 'parent', 'leadingComments', 'trailingComments', and properties starting with '_'. Useful for traversing unknown node types. Example shows keys for a sample AssignmentExpression node. ```javascript const node = { type: "AssignmentExpression", left: { type: "Identifier", name: "foo" }, right: { type: "Literal", value: 0 } } console.log(evk.getKeys(node)) // → ["type", "left", "right"] ``` -------------------------------- ### Testing Custom Compression Adapters with Keyv Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Provides an example of how to test a custom compression adapter using the Keyv test suite. It imports the test suite and an example compression adapter (KeyvGzip) and runs the tests. ```javascript const {keyvCompresstionTests} = require('@keyv/test-suite'); const KeyvGzip = require('@keyv/compress-gzip'); keyvCompresstionTests(test, new KeyvGzip()); ``` -------------------------------- ### Install path-key using npm Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/npm-run-path/node_modules/path-key/readme.md This command installs the 'path-key' package using npm, making it available for use in your Node.js project. No specific dependencies are required for installation. ```bash $ npm install path-key ``` -------------------------------- ### Install Keyv and Storage Adapters Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Installs the core Keyv library and optional storage adapters for various databases such as Redis, MongoDB, SQLite, PostgreSQL, MySQL, and Etcd. These adapters extend Keyv's functionality to persistent storage solutions. ```bash npm install --save keyv npm install --save @keyv/redis npm install --save @keyv/mongo npm install --save @keyv/sqlite npm install --save @keyv/postgres npm install --save @keyv/mysql npm install --save @keyv/etcd ``` -------------------------------- ### Install Callsites NPM Package Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/callsites/readme.md This command installs the 'callsites' package using npm, making it available for use in your Node.js project. Ensure you have Node.js and npm installed. ```bash $ npm install callsites ``` -------------------------------- ### Install Dependencies with Yarn (Bash) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Installs project dependencies using Yarn. This command should be run from the root directory of the project after forking and cloning the repository. ```bash yarn ``` -------------------------------- ### Installation Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/serve-static/README.md Instructions on how to install the serve-static module using npm. ```APIDOC ## Installation This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/). Installation is done using the [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```sh $ npm install serve-static ``` ``` -------------------------------- ### Install dunder-proto Package Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/dunder-proto/README.md This command installs the 'dunder-proto' package using npm, making it available for use in your Node.js project. It is a dependency for the subsequent code examples. ```sh npm install --save dunder-proto ``` -------------------------------- ### Keyv Constructor Parameters Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Details the parameters accepted by the Keyv constructor, including URI and options. ```APIDOC ## Keyv Constructor ### Description Initializes a new Keyv instance, which can optionally connect to a specific storage URI or use provided options for configuration. ### Method `new Keyv([uri], [options])` ### Endpoint N/A (Constructor) ### Parameters #### `uri` - Type: `String` - Default: `undefined` - Description: The connection string URI for the storage adapter (e.g., `redis://localhost:6379`, `mongodb://localhost:27017/db`). This is merged into the `options.uri` property. #### `options` - Type: `Object` - Description: An object containing configuration options for Keyv and the storage adapter. The storage adapter may accept additional options documented in its own repository. ##### `options.namespace` - Type: `String` - Default: `'keyv'` - Description: A namespace string used to isolate keys within the storage. Useful when multiple Keyv instances share the same storage backend. ##### `options.ttl` - Type: `Number` - Default: `undefined` - Description: The default Time-To-Live (TTL) in milliseconds for all keys set in this instance. This can be overridden on a per-key basis using the `.set()` method. ##### `options.store` - Type: `Object` - Default: `undefined` - Description: An instance of a storage adapter that implements the `Map` API. If provided, the `uri` option is ignored. ##### `options.compression` - Type: `Object` | `Boolean` - Default: `undefined` - Description: Enables compression. Set to `true` for default gzip compression, or pass an instance of a compression adapter. ### Request Example ```javascript const Keyv = require('keyv'); // With URI const keyvRedis = new Keyv('redis://localhost:6379'); // With options object const keyvMongo = new Keyv({ uri: 'mongodb://localhost:27017/my_db', namespace: 'app_data' }); // With explicit TTL and custom store const myStore = new Map(); const keyvMap = new Keyv({ store: myStore, ttl: 3600000 }); // 1 hour TTL ``` ### Response N/A (Constructor returns a Keyv instance) ### Event Emitter - The Keyv instance is an `EventEmitter`. - Emits an `'error'` event if the storage adapter connection fails. ``` -------------------------------- ### Install stack-trace npm Package Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/stack-trace/Readme.md This command installs the stack-trace module using npm. It is a prerequisite for using the module in your Node.js project. ```bash npm install stack-trace ``` -------------------------------- ### Install parent-module using npm Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/parent-module/readme.md This snippet shows the command to install the parent-module package using npm, which is a prerequisite for using the module in a Node.js project. ```bash $ npm install parent-module ``` -------------------------------- ### Keyv Constructor with Third-Party Store Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Demonstrates how to initialize Keyv with a custom storage adapter that follows the Map API. ```APIDOC ## Initialize Keyv with a Custom Store ### Description This example shows how to use a third-party storage adapter or a custom implementation that adheres to the `Map` API with Keyv. ### Method `new Keyv(options)` ### Endpoint N/A (Constructor) ### Parameters #### Options - **store** (Object) - Required - An object that implements the `Map` API. ### Request Example ```javascript const Keyv = require('keyv'); const myAdapter = require('./my-storage-adapter'); // Assume this is a custom adapter const keyv = new Keyv({ store: myAdapter }); // Example using QuickLRU const QuickLRU = require('quick-lru'); const lru = new QuickLRU({ maxSize: 1000 }); const keyvLru = new Keyv({ store: lru }); ``` ### Response N/A (Constructor returns an instance) ### Notes Any object implementing the standard `Map` API (e.g., `new Map()`, `quick-lru`) can be used as a store. ``` -------------------------------- ### Install p-locate using npm Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/p-locate/readme.md This command installs the 'p-locate' package and its dependencies using npm, making it available for use in your project. ```bash $ npm install p-locate ``` -------------------------------- ### Full Server Example with Router, Middleware, and Routes Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/router/README.md This comprehensive example sets up an HTTP server using the `router` library. It includes importing necessary modules, initializing the router, applying middleware like compression and body-parser, defining routes for messages and API endpoints, and handling requests. ```javascript // import our modules var http = require('http') var Router = require('router') var finalhandler = require('finalhandler') var compression = require('compression') var bodyParser = require('body-parser') // store our message to display var message = 'Hello World!' // initialize the router & server and add a final callback. var router = Router() var server = http.createServer(function onRequest (req, res) { router(req, res, finalhandler(req, res)) }) // use some middleware and compress all outgoing responses router.use(compression()) // handle `GET` requests to `/message` router.get('/message', function (req, res) { res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') }) // create and mount a new router for our API var api = Router() router.use('/api/', api) // add a body parsing middleware to our API api.use(bodyParser.json()) // handle `PATCH` requests to `/api/set-message` api.patch('/set-message', function (req, res) { if (req.body.value) { message = req.body.value res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') } else { res.statusCode = 400 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Invalid API Syntax\n') } }) // make our http server listen to connections server.listen(8080) ``` -------------------------------- ### JavaScript: Get Current Filename using Callsites Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/callsites/readme.md This JavaScript example demonstrates how to use the 'callsites' library to retrieve the filename of the currently executing script. It requires the 'callsites' module and then accesses the first callsite object to get its filename. ```javascript const callsites = require('callsites'); function unicorn() { console.log(callsites()[0].getFileName()); //=> '/Users/sindresorhus/dev/callsites/test.js' } unicorn(); ``` -------------------------------- ### Start Docker Services with Yarn (Bash) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Starts the project's Docker container, launching all necessary services. This command must be executed from the root directory and requires Docker to be running. ```bash yarn test:services:start ``` -------------------------------- ### Install and Use 'entities' NPM Package Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/entities/readme.md Demonstrates how to install the 'entities' package via npm and provides examples of its core encoding and decoding functionalities for UTF8, XML, and HTML. ```bash npm install entities ``` ```javascript const entities = require("entities"); // Encoding entities.escapeUTF8("& ü"); // "& ü" entities.encodeXML("& ü"); // "& ü" entities.encodeHTML("& ü"); // "& ü" // Decoding entities.decodeXML("asdf & ÿ ü '"); // "asdf & ÿ ü '" entities.decodeHTML("asdf & ÿ ü '"); // "asdf & ÿ ü '" ``` -------------------------------- ### Usage Example: Get immediate parent module path Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/parent-module/readme.md Demonstrates how to use the parent-module function to get the path of the immediate parent module. The `require('parent-module')` statement imports the function, and calling it without arguments returns the parent's file path. ```javascript // bar.js const parentModule = require('parent-module'); module.exports = () => { console.log(parentModule()); //=> '/Users/sindresorhus/dev/unicorn/foo.js' }; // foo.js const bar = require('./bar'); bar(); ``` -------------------------------- ### Initialize Keyv with Default or Custom Backend Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Demonstrates how to create a new Keyv instance. It can be initialized with no arguments for in-memory storage, or by providing a connection string to automatically load a specific storage adapter (e.g., Redis, MongoDB, SQLite). Error handling for connection issues is also shown. ```javascript const Keyv = require('keyv'); // One of the following const keyv = new Keyv(); const keyv = new Keyv('redis://user:pass@localhost:6379'); const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname'); const keyv = new Keyv('sqlite://path/to/database.sqlite'); const keyv = new Keyv('postgresql://user:pass@localhost:5432/dbname'); const keyv = new Keyv('mysql://user:pass@localhost:3306/dbname'); const keyv = new Keyv('etcd://localhost:2379'); // Handle DB connection errors keyv.on('error', err => console.log('Connection Error', err)); ``` -------------------------------- ### Dispatch GET Request with Undici Client Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/undici/docs/docs/api/Dispatcher.md This JavaScript example demonstrates how to dispatch a GET request using the Undici client. It sets up a simple HTTP server, creates an Undici client, and then uses the dispatch method to send a request. The example includes handlers for connection, errors, headers, data, and completion, showcasing how to process the response and manage client and server lifecycles. ```javascript import { createServer } from 'http' import { Client } from 'undici' import { once } from 'events' const server = createServer((request, response) => { response.end('Hello, World!') }).listen() await once(server, 'listening') const client = new Client(`http://localhost:${server.address().port}`) const data = [] client.dispatch({ path: '/', method: 'GET', headers: { 'x-foo': 'bar' } }, { onConnect: () => { console.log('Connected!') }, onError: (error) => { console.error(error) }, onHeaders: (statusCode, headers) => { console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`) }, onData: (chunk) => { console.log('onData: chunk received') data.push(chunk) }, onComplete: (trailers) => { console.log(`onComplete | trailers: ${trailers}`) const res = Buffer.concat(data).toString('utf8') console.log(`Data: ${res}`) client.close() server.close() } }) ``` -------------------------------- ### Installation Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/axios/README.md Instructions on how to install Axios using various package managers. ```APIDOC ## Package Manager Installation ### Using npm ```bash $ npm install axios ``` ### Using bower ```bash $ bower install axios ``` ### Using yarn ```bash $ yarn add axios ``` ### Using pnpm ```bash $ pnpm add axios ``` ### Using bun ```bash $ bun add axios ``` ``` -------------------------------- ### Install ee-first npm package Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/ee-first/README.md Installs the 'ee-first' package using npm, the Node Package Manager. This command is typically run in the terminal within your project directory. ```sh npm install ee-first ``` -------------------------------- ### Project Initialization Steps (Bash) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/ai/architecture.md Provides the necessary bash commands to initialize a new Node.js project, including creating a directory, initializing npm, and setting up Git. This is the first manual step for setting up the project environment. ```bash mkdir latest-science-mcp cd latest-science-mcp npm init -y git init ``` -------------------------------- ### Mocking a GET request with Nock (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/nock/README.md Sets up an interceptor for a GET request to a specific URL, defining the response status and body. This is a basic usage example for testing HTTP interactions. ```javascript const nock = require('nock') const scope = nock('https://api.github.com') .get('/repos/atom/atom/license') .reply(200, { license: { key: 'mit', name: 'MIT License', spdx_id: 'MIT', url: 'https://api.github.com/licenses/mit', node_id: 'MDc6TGljZW5zZTEz', }, }) ``` -------------------------------- ### Basic Optionator Setup and Usage (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/optionator/README.md Demonstrates how to initialize Optionator with custom settings for options and help text, and then parse command-line arguments using `parseArgv`. It includes a check for a 'help' option to display generated help text. ```javascript var optionator = require('optionator')({ prepend: 'Usage: cmd [options]', append: 'Version 1.0.0', options: [{ option: 'help', alias: 'h', type: 'Boolean', description: 'displays help' }, { option: 'count', alias: 'c', type: 'Int', description: 'number of things', example: 'cmd --count 2' }] }); var options = optionator.parseArgv(process.argv); if (options.help) { console.log(optionator.generateHelp()); } ... ``` -------------------------------- ### Keyv Options Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Configuration options for Keyv instances, including compression, serialization, deserialization, and storage adapters. ```APIDOC ## Keyv Options ### `options.compression` - **Type**: `@keyv/compress-` - **Default**: `undefined` - **Description**: Compression package to use. See [Compression](#compression) for more details. ### `options.serialize` - **Type**: `Function` - **Default**: `JSONB.stringify` - **Description**: A custom serialization function. ### `options.deserialize` - **Type**: `Function` - **Default**: `JSONB.parse` - **Description**: A custom deserialization function. ### `options.store` - **Type**: `Storage adapter instance` - **Default**: `new Map()` - **Description**: The storage adapter instance to be used by Keyv. ### `options.adapter` - **Type**: `String` - **Default**: `undefined` - **Description**: Specify an adapter to use. e.g `'redis'` or `'mongodb'`. ``` -------------------------------- ### Install Chai as a Component Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/chai/ReleaseNotes.md Instructions for installing Chai as a component using its configuration file. It specifies devDependencies and provides a command-line installation alternative. Users should refer to the official Chai website for the latest stable version. ```json // relevant component.json devDependencies: { "chaijs/chai": "1.5.0" } ``` -------------------------------- ### Get Index Range of Balanced Pairs with balanced-match.range (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/balanced-match/README.md Illustrates the usage of the `balanced.range` function from the balanced-match module. This function returns an array containing the start and end indices of the first non-nested matching pair of strings within a given string. If no match is found, it returns undefined. The example showcases matching simple string delimiters and also demonstrates how unbalanced pairs are handled. ```javascript var balanced = require('balanced-match'); // Example with simple strings console.log(balanced.range('{', '}', 'pre{in{nested}}post')); // Example with unbalanced pairs console.log(balanced.range('{', '}', '{{a}')); console.log(balanced.range('{', '}', '{a}}')); ``` -------------------------------- ### Keyv Compression Configuration Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Explains how to enable and configure compression for Keyv storage. ```APIDOC ## Keyv Compression ### Description Keyv supports automatic compression of values using `gzip` and `brotli`. This reduces storage space and network bandwidth. ### Method `new Keyv(options)` with `compression` option ### Endpoint N/A (Constructor) ### Parameters #### Options - **compression** (Object | Boolean) - Optional - Enables compression. Can be `true` to use default compression (gzip), or an instance of a compression adapter (e.g., `KeyvGzip`). ### Request Example ```javascript const Keyv = require('keyv'); const KeyvGzip = require('@keyv/compress-gzip'); // Example compression adapter // Enable default gzip compression const keyvDefaultCompression = new Keyv({ compression: true }); // Use a specific compression adapter instance const keyvGzip = new Keyv({ compression: new KeyvGzip() }); ``` ### Response N/A (Constructor returns an instance) ### Notes - When `compression: true` is used, Keyv defaults to using `gzip`. - You can install other compression adapters like `@keyv/compress-brotli`. - For custom compression logic, implement the `CompressionAdapter` interface. ``` -------------------------------- ### Run Tests and Performance Benchmarks Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/iconv-lite/README.md Instructions for cloning the repository, installing dependencies, running tests, viewing performance, and checking test coverage. ```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 ``` -------------------------------- ### TypeScript Example for MCP Server Logging Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/docs/troubleshooting.md Illustrates how to use logging functions (`logInfo`, `logError`) within the MCP server project for effective debugging and monitoring. Shows basic usage and structured logging examples. ```typescript import { logInfo, logError } from "./core/logger.js"; // Ensure logger is properly configured logInfo('Server starting', { version: '1.0.0' }); ``` ```typescript logInfo('Tool called', { tool: 'fetch_latest', source, category, count, timestamp: new Date().toISOString() }); ``` -------------------------------- ### Router Initialization and Basic Usage Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/router/README.md Demonstrates how to initialize a router instance and set up a basic GET route for the root path. ```APIDOC ## Router Initialization and Basic Usage ### Description Initializes a router and defines a simple GET request handler for the root path. ### Method GET ### Endpoint / ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```javascript var finalhandler = require('finalhandler') var http = require('http') var Router = require('router') var router = Router() router.get('/', function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) var server = http.createServer(function (req, res) { router(req, res, finalhandler(req, res)) }) server.listen(3000) ``` ### Response #### Success Response (200) - **Content-Type** (string) - 'text/plain; charset=utf-8' - **Body** (string) - 'Hello World!' ``` -------------------------------- ### MockAgent Request Example (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/undici/docs/docs/api/MockAgent.md This example shows how to make a request using the MockAgent's `request` method in undici. It sets up an intercept for 'http://localhost:3000/foo' and then uses `mockAgent.request` to simulate a GET request to that endpoint, logging the response. ```javascript import { MockAgent } from 'undici' const mockAgent = new MockAgent() const mockPool = mockAgent.get('http://localhost:3000') mockPool.intercept({ path: '/foo' }).reply(200, 'foo') const { statusCode, body } = await mockAgent.request({ origin: 'http://localhost:3000', path: '/foo', method: 'GET' }) console.log('response received', statusCode) // response received 200 for await (const data of body) { console.log('data', data.toString('utf8')) // data foo } ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/send/README.md These commands are standard for Node.js projects. `npm install` downloads and installs all necessary project dependencies listed in `package.json`, while `npm test` executes the project's test suite defined in the configuration. ```bash $ npm install $ npm test ``` -------------------------------- ### API: Get parent module path with specified filepath Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/parent-module/readme.md Illustrates the use of the `parentModule([filepath])` API. By providing a `filepath` argument, you can determine the parent module path starting from a different module than the default `__filename`. ```javascript const path = require('path'); const readPkgUp = require('read-pkg-up'); const parentModule = require('parent-module'); console.log(readPkgUp.sync({cwd: path.dirname(parentModule())}).pkg); //=> {name: 'chalk', version: '1.0.0', …} ``` -------------------------------- ### Streaming Logs with Winston Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/winston/README.md Demonstrates how to stream log data from a Winston transport. The example shows how to initiate a stream, starting from the end of the log file (`start: -1`), and attach an event listener to process incoming log entries. ```javascript // Start at the end. winston.stream({ start: -1 }).on('log', function(log) { console.log(log); }); ``` -------------------------------- ### Initiating a Release Build Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/chai/CONTRIBUTING.md Commands to prepare a new release by automatically building the project, bumping version numbers, and creating a Git commit. These commands are typically run by core contributors. ```bash make release-major make release-minor make release-patch ``` -------------------------------- ### Keyv Instance Methods Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/keyv/README.md Core methods for interacting with a Keyv instance, including setting, getting, deleting, clearing, and iterating over entries. ```APIDOC ## Keyv Instance Methods Keys must always be strings. Values can be of any type. ### `.set(key, value, [ttl])` - **Description**: Set a value. By default keys are persistent. You can set an expiry TTL in milliseconds. - **Returns**: A promise which resolves to `true`. ### `.get(key, [options])` - **Description**: Returns a promise which resolves to the retrieved value. - **`options.raw`** (Boolean, Default: `false`): If set to true the raw DB object Keyv stores internally will be returned instead of just the value. This contains the TTL timestamp. ### `.delete(key)` - **Description**: Deletes an entry. - **Returns**: A promise which resolves to `true` if the key existed, `false` if not. ### `.clear()` - **Description**: Delete all entries in the current namespace. - **Returns**: A promise which is resolved when the entries have been cleared. ### `.iterator()` - **Description**: Iterate over all entries of the current namespace. - **Returns**: An iterable that can be iterated by for-of loops. #### Example ```js // please note that the "await" keyword should be used here for await (const [key, value] of this.keyv.iterator()) { console.log(key, value); }; ``` ``` -------------------------------- ### Install and Use get-proto for Object Prototype Retrieval (JavaScript) Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/get-proto/README.md This snippet demonstrates how to install the 'get-proto' package using npm and then use it in a JavaScript application to retrieve object prototypes. It showcases retrieving the prototype of a regular object, an object with a specified prototype, and an object with a null prototype. ```bash npm install --save get-proto ``` ```javascript const assert = require('assert'); const getProto = require('get-proto'); const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }; const b = { c: 3, __proto__: a }; assert.equal(getProto(b), a); assert.equal(getProto(a), Object.prototype); assert.equal(getProto({ __proto__: null }), null); ``` -------------------------------- ### Usage Example: Find first existing file asynchronously Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/p-locate/readme.md This example demonstrates how to use 'p-locate' to find the first file in a list that actually exists on disk. It utilizes the 'path-exists' package as the testing function. The result is the path of the first existing file or undefined if none are found. ```javascript const pathExists = require('path-exists'); const pLocate = require('p-locate'); const files = [ 'unicorn.png', 'rainbow.png', // Only this one actually exists on disk 'pony.png' ]; (async () => { const foundPath = await pLocate(files, file => pathExists(file)); console.log(foundPath); //=> 'rainbow' })(); ``` -------------------------------- ### Install Tinybench using npm Source: https://github.com/benedict2310/scientific-papers-mcp/blob/main/node_modules/tinybench/README.md This command installs the Tinybench library as a development dependency. It's a prerequisite for using Tinybench in your project. ```bash npm install -D tinybench ```