A comprehensive guide to building, securing, and deploying a Model Context Protocol (MCP) server with Node.js and TypeScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clsx from "clsx"; | |
| import { | |
| useEffect, | |
| useRef, | |
| useState, | |
| type HTMLAttributes, | |
| type ReactNode, | |
| type RefObject, | |
| } from "react"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { projectId, teamId, newProjectName, accessToken } = inputData; | |
| const payload = { | |
| data: { | |
| name: newProjectName, | |
| team: teamId, | |
| include: [ | |
| "members", | |
| "notes", | |
| "task_notes", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export http_proxy="http://127.0.0.1:8000" | |
| export HTTP_PROXY="http://127.0.0.1:8000" | |
| export https_proxy="http://127.0.0.1:8000" | |
| export HTTPS_PROXY="http://127.0.0.1:8000" | |
| export GLOBAL_AGENT_HTTP_PROXY="http://127.0.0.1:8000" | |
| export CGI_HTTP_PROXY="http://127.0.0.1:8000" | |
| export npm_config_proxy="http://127.0.0.1:8000" | |
| export npm_config_https_proxy="http://127.0.0.1:8000" | |
| export npm_config_scripts_prepend_node_path="false" | |
| export GOPROXY="http://127.0.0.1:8000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this is wrapped in an \`async\` function | |
| // you can use await throughout the function | |
| // and another one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Fn = (...args: any[]) => any; | |
| type Callback<F extends Fn> = F extends Fn | |
| ? (...args: Parameters<F>) => ReturnType<F> | |
| : never; | |
| function debounce<T extends Fn, O extends Callback<T>>( | |
| func: O, | |
| wait: number, | |
| immediate?: boolean | |
| ): O { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetch = require("node-fetch"); | |
| const vm = require("vm"); | |
| async function requireLodash(url) { | |
| const context = {}; | |
| const rawData = await fetch( | |
| "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js" | |
| ).then((res) => res.text()); | |
| vm.runInNewContext([rawData, "global.lodash = _"].join("\n"), { | |
| global: context, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function load_local_fish_functions --on-variable PWD | |
| if test -e .autoload.fish | |
| source ./.autoload.fish | |
| end | |
| end | |
| load_local_fish_functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var EmailParser=function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=59)}([function(t,r){var n=Array.isArray;t.exports=n},function(t,r,n){var e=n(31),o="object"==ty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const retry = require("retry"); | |
| const sinon = require("sinon"); | |
| const sendRequest = sinon.stub(); | |
| sendRequest.onFirstCall().rejects(new Error("yaw kiw 1")); | |
| sendRequest.onSecondCall().rejects(new Error("yaw kiw 2")); | |
| sendRequest.onThirdCall().resolves({ message: "it works" }); | |
| const operation = retry.operation({ | |
| retries: 2, |
NewerOlder