Skip to main content
Glama

Weather & Stock MCP Server

by Jeetinida
queue.js1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.QueueOptionsSchema = void 0; const typebox_1 = require("@sinclair/typebox"); exports.QueueOptionsSchema = typebox_1.Type.Object({ // TODO: adds func type to json schema which is not supported //_queue?: Queue; concurrency: typebox_1.Type.Optional(typebox_1.Type.Number()), timeout: typebox_1.Type.Optional(typebox_1.Type.Number()), // TODO }, { additionalProperties: false, title: "QueueOptions", }); class Queue { constructor(opts = {}) { this.concurrency = 1; this._running = 0; this._queue = []; if (opts.concurrency) this.concurrency = opts.concurrency; } runNext() { const job = this._queue.shift(); if (!job) return; this._running++; job .func() .then((result) => job.resolve(result)) .catch((error) => job.reject(error)) .finally(() => { this._running--; this.checkQueue(); }); } checkQueue() { if (this._running < this.concurrency) this.runNext(); } add(func) { return new Promise((resolve, reject) => { this._queue.push({ func, resolve, reject }); this.checkQueue(); }); } } exports.default = Queue;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jeetinida/stocknews-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server