# Directory Structure ``` ├── dist │ ├── index.js │ └── schemas.js ├── index.ts ├── node_modules │ ├── .bin │ │ ├── resolve │ │ ├── shjs │ │ ├── shx │ │ ├── tsc │ │ └── tsserver │ ├── .package-lock.json │ ├── @modelcontextprotocol │ │ └── sdk │ │ ├── dist │ │ │ ├── cli.d.ts │ │ │ ├── cli.d.ts.map │ │ │ ├── cli.js │ │ │ ├── cli.js.map │ │ │ ├── client │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.d.ts.map │ │ │ │ ├── index.js │ │ │ │ ├── index.js.map │ │ │ │ ├── index.test.d.ts │ │ │ │ ├── index.test.d.ts.map │ │ │ │ ├── index.test.js │ │ │ │ ├── index.test.js.map │ │ │ │ ├── sse.d.ts │ │ │ │ ├── sse.d.ts.map │ │ │ │ ├── sse.js │ │ │ │ ├── sse.js.map │ │ │ │ ├── stdio.d.ts │ │ │ │ ├── stdio.d.ts.map │ │ │ │ ├── stdio.js │ │ │ │ ├── stdio.js.map │ │ │ │ ├── stdio.test.d.ts │ │ │ │ ├── stdio.test.d.ts.map │ │ │ │ ├── stdio.test.js │ │ │ │ ├── stdio.test.js.map │ │ │ │ ├── websocket.d.ts │ │ │ │ ├── websocket.d.ts.map │ │ │ │ ├── websocket.js │ │ │ │ └── websocket.js.map │ │ │ ├── inMemory.d.ts │ │ │ ├── inMemory.d.ts.map │ │ │ ├── inMemory.js │ │ │ ├── inMemory.js.map │ │ │ ├── inMemory.test.d.ts │ │ │ ├── inMemory.test.d.ts.map │ │ │ ├── inMemory.test.js │ │ │ ├── inMemory.test.js.map │ │ │ ├── server │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.d.ts.map │ │ │ │ ├── index.js │ │ │ │ ├── index.js.map │ │ │ │ ├── index.test.d.ts │ │ │ │ ├── index.test.d.ts.map │ │ │ │ ├── index.test.js │ │ │ │ ├── index.test.js.map │ │ │ │ ├── sse.d.ts │ │ │ │ ├── sse.d.ts.map │ │ │ │ ├── sse.js │ │ │ │ ├── sse.js.map │ │ │ │ ├── stdio.d.ts │ │ │ │ ├── stdio.d.ts.map │ │ │ │ ├── stdio.js │ │ │ │ ├── stdio.js.map │ │ │ │ ├── stdio.test.d.ts │ │ │ │ ├── stdio.test.d.ts.map │ │ │ │ ├── stdio.test.js │ │ │ │ └── stdio.test.js.map │ │ │ ├── shared │ │ │ │ ├── protocol.d.ts │ │ │ │ ├── protocol.d.ts.map │ │ │ │ ├── protocol.js │ │ │ │ ├── protocol.js.map │ │ │ │ ├── stdio.d.ts │ │ │ │ ├── stdio.d.ts.map │ │ │ │ ├── stdio.js │ │ │ │ ├── stdio.js.map │ │ │ │ ├── stdio.test.d.ts │ │ │ │ ├── stdio.test.d.ts.map │ │ │ │ ├── stdio.test.js │ │ │ │ ├── stdio.test.js.map │ │ │ │ ├── transport.d.ts │ │ │ │ ├── transport.d.ts.map │ │ │ │ ├── transport.js │ │ │ │ └── transport.js.map │ │ │ ├── types.d.ts │ │ │ ├── types.d.ts.map │ │ │ ├── types.js │ │ │ └── types.js.map │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── @types │ │ ├── node │ │ │ ├── assert │ │ │ │ └── strict.d.ts │ │ │ ├── assert.d.ts │ │ │ ├── async_hooks.d.ts │ │ │ ├── buffer.buffer.d.ts │ │ │ ├── buffer.d.ts │ │ │ ├── child_process.d.ts │ │ │ ├── cluster.d.ts │ │ │ ├── compatibility │ │ │ │ ├── disposable.d.ts │ │ │ │ ├── index.d.ts │ │ │ │ ├── indexable.d.ts │ │ │ │ └── iterators.d.ts │ │ │ ├── console.d.ts │ │ │ ├── constants.d.ts │ │ │ ├── crypto.d.ts │ │ │ ├── dgram.d.ts │ │ │ ├── diagnostics_channel.d.ts │ │ │ ├── dns │ │ │ │ └── promises.d.ts │ │ │ ├── dns.d.ts │ │ │ ├── dom-events.d.ts │ │ │ ├── domain.d.ts │ │ │ ├── events.d.ts │ │ │ ├── fs │ │ │ │ └── promises.d.ts │ │ │ ├── fs.d.ts │ │ │ ├── globals.d.ts │ │ │ ├── globals.typedarray.d.ts │ │ │ ├── http.d.ts │ │ │ ├── http2.d.ts │ │ │ ├── https.d.ts │ │ │ ├── index.d.ts │ │ │ ├── inspector.d.ts │ │ │ ├── LICENSE │ │ │ ├── module.d.ts │ │ │ ├── net.d.ts │ │ │ ├── os.d.ts │ │ │ ├── package.json │ │ │ ├── path.d.ts │ │ │ ├── perf_hooks.d.ts │ │ │ ├── process.d.ts │ │ │ ├── punycode.d.ts │ │ │ ├── querystring.d.ts │ │ │ ├── readline │ │ │ │ └── promises.d.ts │ │ │ ├── readline.d.ts │ │ │ ├── README.md │ │ │ ├── repl.d.ts │ │ │ ├── sea.d.ts │ │ │ ├── sqlite.d.ts │ │ │ ├── stream │ │ │ │ ├── consumers.d.ts │ │ │ │ ├── promises.d.ts │ │ │ │ └── web.d.ts │ │ │ ├── stream.d.ts │ │ │ ├── string_decoder.d.ts │ │ │ ├── test.d.ts │ │ │ ├── timers │ │ │ │ └── promises.d.ts │ │ │ ├── timers.d.ts │ │ │ ├── tls.d.ts │ │ │ ├── trace_events.d.ts │ │ │ ├── ts5.6 │ │ │ │ ├── buffer.buffer.d.ts │ │ │ │ ├── globals.typedarray.d.ts │ │ │ │ └── index.d.ts │ │ │ ├── tty.d.ts │ │ │ ├── url.d.ts │ │ │ ├── util.d.ts │ │ │ ├── v8.d.ts │ │ │ ├── vm.d.ts │ │ │ ├── wasi.d.ts │ │ │ ├── worker_threads.d.ts │ │ │ └── zlib.d.ts │ │ └── node-fetch │ │ ├── externals.d.ts │ │ ├── index.d.ts │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── asynckit │ │ ├── bench.js │ │ ├── index.js │ │ ├── lib │ │ │ ├── abort.js │ │ │ ├── async.js │ │ │ ├── defer.js │ │ │ ├── iterate.js │ │ │ ├── readable_asynckit.js │ │ │ ├── readable_parallel.js │ │ │ ├── readable_serial_ordered.js │ │ │ ├── readable_serial.js │ │ │ ├── state.js │ │ │ ├── streamify.js │ │ │ └── terminator.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── parallel.js │ │ ├── README.md │ │ ├── serial.js │ │ ├── serialOrdered.js │ │ └── stream.js │ ├── balanced-match │ │ ├── .github │ │ │ └── FUNDING.yml │ │ ├── index.js │ │ ├── LICENSE.md │ │ ├── package.json │ │ └── README.md │ ├── brace-expansion │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── bytes │ │ ├── History.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── Readme.md │ ├── combined-stream │ │ ├── lib │ │ │ └── combined_stream.js │ │ ├── License │ │ ├── package.json │ │ ├── Readme.md │ │ └── yarn.lock │ ├── concat-map │ │ ├── .travis.yml │ │ ├── example │ │ │ └── map.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.markdown │ │ └── test │ │ └── map.js │ ├── content-type │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── data-uri-to-buffer │ │ ├── dist │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ │ ├── package.json │ │ ├── README.md │ │ └── src │ │ └── index.ts │ ├── delayed-stream │ │ ├── .npmignore │ │ ├── lib │ │ │ └── delayed_stream.js │ │ ├── License │ │ ├── Makefile │ │ ├── package.json │ │ └── Readme.md │ ├── depd │ │ ├── History.md │ │ ├── index.js │ │ ├── lib │ │ │ └── browser │ │ │ └── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── Readme.md │ ├── fetch-blob │ │ ├── file.d.ts │ │ ├── file.js │ │ ├── from.d.ts │ │ ├── from.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── streams.cjs │ ├── form-data │ │ ├── index.d.ts │ │ ├── lib │ │ │ ├── browser.js │ │ │ ├── form_data.js │ │ │ └── populate.js │ │ ├── License │ │ ├── package.json │ │ └── Readme.md │ ├── formdata-polyfill │ │ ├── esm.min.d.ts │ │ ├── esm.min.js │ │ ├── formdata-to-blob.js │ │ ├── FormData.js │ │ ├── formdata.min.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── fs.realpath │ │ ├── index.js │ │ ├── LICENSE │ │ ├── old.js │ │ ├── package.json │ │ └── README.md │ ├── function-bind │ │ ├── .eslintrc │ │ ├── .github │ │ │ ├── FUNDING.yml │ │ │ └── SECURITY.md │ │ ├── .nycrc │ │ ├── CHANGELOG.md │ │ ├── implementation.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── test │ │ ├── .eslintrc │ │ └── index.js │ ├── glob │ │ ├── common.js │ │ ├── glob.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── sync.js │ ├── hasown │ │ ├── .eslintrc │ │ ├── .github │ │ │ └── FUNDING.yml │ │ ├── .nycrc │ │ ├── CHANGELOG.md │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── tsconfig.json │ ├── http-errors │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── iconv-lite │ │ ├── .github │ │ │ └── dependabot.yml │ │ ├── .idea │ │ │ ├── codeStyles │ │ │ │ ├── codeStyleConfig.xml │ │ │ │ └── Project.xml │ │ │ ├── iconv-lite.iml │ │ │ ├── inspectionProfiles │ │ │ │ └── Project_Default.xml │ │ │ ├── modules.xml │ │ │ └── vcs.xml │ │ ├── Changelog.md │ │ ├── encodings │ │ │ ├── dbcs-codec.js │ │ │ ├── dbcs-data.js │ │ │ ├── index.js │ │ │ ├── internal.js │ │ │ ├── sbcs-codec.js │ │ │ ├── sbcs-data-generated.js │ │ │ ├── sbcs-data.js │ │ │ ├── tables │ │ │ │ ├── big5-added.json │ │ │ │ ├── cp936.json │ │ │ │ ├── cp949.json │ │ │ │ ├── cp950.json │ │ │ │ ├── eucjp.json │ │ │ │ ├── gb18030-ranges.json │ │ │ │ ├── gbk-added.json │ │ │ │ └── shiftjis.json │ │ │ ├── utf16.js │ │ │ ├── utf32.js │ │ │ └── utf7.js │ │ ├── lib │ │ │ ├── bom-handling.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── streams.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── inflight │ │ ├── inflight.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── inherits │ │ ├── inherits_browser.js │ │ ├── inherits.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── interpret │ │ ├── CHANGELOG │ │ ├── index.js │ │ ├── LICENSE │ │ ├── mjs-stub.js │ │ ├── package.json │ │ └── README.md │ ├── is-core-module │ │ ├── .eslintrc │ │ ├── .nycrc │ │ ├── CHANGELOG.md │ │ ├── core.json │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── test │ │ └── index.js │ ├── mime-db │ │ ├── db.json │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── mime-types │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── minimatch │ │ ├── LICENSE │ │ ├── minimatch.js │ │ ├── package.json │ │ └── README.md │ ├── minimist │ │ ├── .eslintrc │ │ ├── .github │ │ │ └── FUNDING.yml │ │ ├── .nycrc │ │ ├── CHANGELOG.md │ │ ├── example │ │ │ └── parse.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── test │ │ ├── all_bool.js │ │ ├── bool.js │ │ ├── dash.js │ │ ├── default_bool.js │ │ ├── dotted.js │ │ ├── kv_short.js │ │ ├── long.js │ │ ├── num.js │ │ ├── parse_modified.js │ │ ├── parse.js │ │ ├── proto.js │ │ ├── short.js │ │ ├── stop_early.js │ │ ├── unknown.js │ │ └── whitespace.js │ ├── node-domexception │ │ ├── .history │ │ │ ├── index_20210527203842.js │ │ │ ├── index_20210527203947.js │ │ │ ├── index_20210527204259.js │ │ │ ├── index_20210527204418.js │ │ │ ├── index_20210527204756.js │ │ │ ├── index_20210527204833.js │ │ │ ├── index_20210527211208.js │ │ │ ├── index_20210527211248.js │ │ │ ├── index_20210527212722.js │ │ │ ├── index_20210527212731.js │ │ │ ├── index_20210527212746.js │ │ │ ├── index_20210527212900.js │ │ │ ├── index_20210527213022.js │ │ │ ├── index_20210527213822.js │ │ │ ├── index_20210527213843.js │ │ │ ├── index_20210527213852.js │ │ │ ├── index_20210527213910.js │ │ │ ├── index_20210527214034.js │ │ │ ├── index_20210527214643.js │ │ │ ├── index_20210527214654.js │ │ │ ├── index_20210527214700.js │ │ │ ├── package_20210527203733.json │ │ │ ├── package_20210527203825.json │ │ │ ├── package_20210527204621.json │ │ │ ├── package_20210527204913.json │ │ │ ├── package_20210527204925.json │ │ │ ├── package_20210527205145.json │ │ │ ├── package_20210527205156.json │ │ │ ├── README_20210527203617.md │ │ │ ├── README_20210527212714.md │ │ │ ├── README_20210527213345.md │ │ │ ├── README_20210527213411.md │ │ │ ├── README_20210527213803.md │ │ │ ├── README_20210527214323.md │ │ │ ├── README_20210527214408.md │ │ │ ├── test_20210527205603.js │ │ │ ├── test_20210527205957.js │ │ │ └── test_20210527210021.js │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── node-fetch │ │ ├── @types │ │ │ └── index.d.ts │ │ ├── LICENSE.md │ │ ├── package.json │ │ ├── README.md │ │ └── src │ │ ├── body.js │ │ ├── errors │ │ │ ├── abort-error.js │ │ │ ├── base.js │ │ │ └── fetch-error.js │ │ ├── headers.js │ │ ├── index.js │ │ ├── request.js │ │ ├── response.js │ │ └── utils │ │ ├── get-search.js │ │ ├── is-redirect.js │ │ ├── is.js │ │ ├── multipart-parser.js │ │ └── referrer.js │ ├── once │ │ ├── LICENSE │ │ ├── once.js │ │ ├── package.json │ │ └── README.md │ ├── path-is-absolute │ │ ├── index.js │ │ ├── license │ │ ├── package.json │ │ └── readme.md │ ├── path-parse │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── raw-body │ │ ├── HISTORY.md │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── SECURITY.md │ ├── rechoir │ │ ├── .npmignore │ │ ├── .travis.yml │ │ ├── CHANGELOG │ │ ├── index.js │ │ ├── lib │ │ │ ├── extension.js │ │ │ ├── normalize.js │ │ │ └── register.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── resolve │ │ ├── .editorconfig │ │ ├── .eslintrc │ │ ├── .github │ │ │ └── FUNDING.yml │ │ ├── async.js │ │ ├── bin │ │ │ └── resolve │ │ ├── example │ │ │ ├── async.js │ │ │ └── sync.js │ │ ├── index.js │ │ ├── lib │ │ │ ├── async.js │ │ │ ├── caller.js │ │ │ ├── core.js │ │ │ ├── core.json │ │ │ ├── homedir.js │ │ │ ├── is-core.js │ │ │ ├── node-modules-paths.js │ │ │ ├── normalize-options.js │ │ │ └── sync.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── readme.markdown │ │ ├── SECURITY.md │ │ ├── sync.js │ │ └── test │ │ ├── core.js │ │ ├── dotdot │ │ │ ├── abc │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── dotdot.js │ │ ├── faulty_basedir.js │ │ ├── filter_sync.js │ │ ├── filter.js │ │ ├── home_paths_sync.js │ │ ├── home_paths.js │ │ ├── mock_sync.js │ │ ├── mock.js │ │ ├── module_dir │ │ │ ├── xmodules │ │ │ │ └── aaa │ │ │ │ └── index.js │ │ │ ├── ymodules │ │ │ │ └── aaa │ │ │ │ └── index.js │ │ │ └── zmodules │ │ │ └── bbb │ │ │ ├── main.js │ │ │ └── package.json │ │ ├── module_dir.js │ │ ├── node_path │ │ │ ├── x │ │ │ │ ├── aaa │ │ │ │ │ └── index.js │ │ │ │ └── ccc │ │ │ │ └── index.js │ │ │ └── y │ │ │ ├── bbb │ │ │ │ └── index.js │ │ │ └── ccc │ │ │ └── index.js │ │ ├── node_path.js │ │ ├── node-modules-paths.js │ │ ├── nonstring.js │ │ ├── pathfilter │ │ │ └── deep_ref │ │ │ └── main.js │ │ ├── pathfilter.js │ │ ├── precedence │ │ │ ├── aaa │ │ │ │ ├── index.js │ │ │ │ └── main.js │ │ │ ├── aaa.js │ │ │ ├── bbb │ │ │ │ └── main.js │ │ │ └── bbb.js │ │ ├── precedence.js │ │ ├── resolver │ │ │ ├── baz │ │ │ │ ├── doom.js │ │ │ │ ├── package.json │ │ │ │ └── quux.js │ │ │ ├── browser_field │ │ │ │ ├── a.js │ │ │ │ ├── b.js │ │ │ │ └── package.json │ │ │ ├── cup.coffee │ │ │ ├── dot_main │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── dot_slash_main │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── false_main │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── foo.js │ │ │ ├── incorrect_main │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── invalid_main │ │ │ │ └── package.json │ │ │ ├── mug.coffee │ │ │ ├── mug.js │ │ │ ├── multirepo │ │ │ │ ├── lerna.json │ │ │ │ ├── package.json │ │ │ │ └── packages │ │ │ │ ├── package-a │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ └── package-b │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── nested_symlinks │ │ │ │ └── mylib │ │ │ │ ├── async.js │ │ │ │ ├── package.json │ │ │ │ └── sync.js │ │ │ ├── other_path │ │ │ │ ├── lib │ │ │ │ │ └── other-lib.js │ │ │ │ └── root.js │ │ │ ├── quux │ │ │ │ └── foo │ │ │ │ └── index.js │ │ │ ├── same_names │ │ │ │ ├── foo │ │ │ │ │ └── index.js │ │ │ │ └── foo.js │ │ │ ├── symlinked │ │ │ │ ├── _ │ │ │ │ │ ├── node_modules │ │ │ │ │ │ └── foo.js │ │ │ │ │ └── symlink_target │ │ │ │ │ └── .gitkeep │ │ │ │ └── package │ │ │ │ ├── bar.js │ │ │ │ └── package.json │ │ │ └── without_basedir │ │ │ └── main.js │ │ ├── resolver_sync.js │ │ ├── resolver.js │ │ ├── shadowed_core │ │ │ └── node_modules │ │ │ └── util │ │ │ └── index.js │ │ ├── shadowed_core.js │ │ ├── subdirs.js │ │ └── symlinks.js │ ├── safer-buffer │ │ ├── dangerous.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── Porting-Buffer.md │ │ ├── Readme.md │ │ ├── safer.js │ │ └── tests.js │ ├── setprototypeof │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── test │ │ └── index.js │ ├── shelljs │ │ ├── bin │ │ │ └── shjs │ │ ├── CHANGELOG.md │ │ ├── commands.js │ │ ├── global.js │ │ ├── LICENSE │ │ ├── make.js │ │ ├── package.json │ │ ├── plugin.js │ │ ├── README.md │ │ ├── shell.js │ │ └── src │ │ ├── cat.js │ │ ├── cd.js │ │ ├── chmod.js │ │ ├── common.js │ │ ├── cp.js │ │ ├── dirs.js │ │ ├── echo.js │ │ ├── error.js │ │ ├── exec-child.js │ │ ├── exec.js │ │ ├── find.js │ │ ├── grep.js │ │ ├── head.js │ │ ├── ln.js │ │ ├── ls.js │ │ ├── mkdir.js │ │ ├── mv.js │ │ ├── popd.js │ │ ├── pushd.js │ │ ├── pwd.js │ │ ├── rm.js │ │ ├── sed.js │ │ ├── set.js │ │ ├── sort.js │ │ ├── tail.js │ │ ├── tempdir.js │ │ ├── test.js │ │ ├── to.js │ │ ├── toEnd.js │ │ ├── touch.js │ │ ├── uniq.js │ │ └── which.js │ ├── shx │ │ ├── CHANGELOG.md │ │ ├── lib │ │ │ ├── cli.js │ │ │ ├── config.js │ │ │ ├── help.js │ │ │ ├── plugin-true-false.js │ │ │ ├── printCmdRet.js │ │ │ └── shx.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── statuses │ │ ├── codes.json │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── supports-preserve-symlinks-flag │ │ ├── .eslintrc │ │ ├── .github │ │ │ └── FUNDING.yml │ │ ├── .nycrc │ │ ├── browser.js │ │ ├── CHANGELOG.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── test │ │ └── index.js │ ├── toidentifier │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── typescript │ │ ├── bin │ │ │ ├── tsc │ │ │ └── tsserver │ │ ├── lib │ │ │ ├── _tsc.js │ │ │ ├── _tsserver.js │ │ │ ├── _typingsInstaller.js │ │ │ ├── cancellationToken.js │ │ │ ├── cs │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── de │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── es │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── fr │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── it │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── ja │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── ko │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── lib.d.ts │ │ │ ├── lib.decorators.d.ts │ │ │ ├── lib.decorators.legacy.d.ts │ │ │ ├── lib.dom.asynciterable.d.ts │ │ │ ├── lib.dom.d.ts │ │ │ ├── lib.dom.iterable.d.ts │ │ │ ├── lib.es2015.collection.d.ts │ │ │ ├── lib.es2015.core.d.ts │ │ │ ├── lib.es2015.d.ts │ │ │ ├── lib.es2015.generator.d.ts │ │ │ ├── lib.es2015.iterable.d.ts │ │ │ ├── lib.es2015.promise.d.ts │ │ │ ├── lib.es2015.proxy.d.ts │ │ │ ├── lib.es2015.reflect.d.ts │ │ │ ├── lib.es2015.symbol.d.ts │ │ │ ├── lib.es2015.symbol.wellknown.d.ts │ │ │ ├── lib.es2016.array.include.d.ts │ │ │ ├── lib.es2016.d.ts │ │ │ ├── lib.es2016.full.d.ts │ │ │ ├── lib.es2016.intl.d.ts │ │ │ ├── lib.es2017.arraybuffer.d.ts │ │ │ ├── lib.es2017.d.ts │ │ │ ├── lib.es2017.date.d.ts │ │ │ ├── lib.es2017.full.d.ts │ │ │ ├── lib.es2017.intl.d.ts │ │ │ ├── lib.es2017.object.d.ts │ │ │ ├── lib.es2017.sharedmemory.d.ts │ │ │ ├── lib.es2017.string.d.ts │ │ │ ├── lib.es2017.typedarrays.d.ts │ │ │ ├── lib.es2018.asyncgenerator.d.ts │ │ │ ├── lib.es2018.asynciterable.d.ts │ │ │ ├── lib.es2018.d.ts │ │ │ ├── lib.es2018.full.d.ts │ │ │ ├── lib.es2018.intl.d.ts │ │ │ ├── lib.es2018.promise.d.ts │ │ │ ├── lib.es2018.regexp.d.ts │ │ │ ├── lib.es2019.array.d.ts │ │ │ ├── lib.es2019.d.ts │ │ │ ├── lib.es2019.full.d.ts │ │ │ ├── lib.es2019.intl.d.ts │ │ │ ├── lib.es2019.object.d.ts │ │ │ ├── lib.es2019.string.d.ts │ │ │ ├── lib.es2019.symbol.d.ts │ │ │ ├── lib.es2020.bigint.d.ts │ │ │ ├── lib.es2020.d.ts │ │ │ ├── lib.es2020.date.d.ts │ │ │ ├── lib.es2020.full.d.ts │ │ │ ├── lib.es2020.intl.d.ts │ │ │ ├── lib.es2020.number.d.ts │ │ │ ├── lib.es2020.promise.d.ts │ │ │ ├── lib.es2020.sharedmemory.d.ts │ │ │ ├── lib.es2020.string.d.ts │ │ │ ├── lib.es2020.symbol.wellknown.d.ts │ │ │ ├── lib.es2021.d.ts │ │ │ ├── lib.es2021.full.d.ts │ │ │ ├── lib.es2021.intl.d.ts │ │ │ ├── lib.es2021.promise.d.ts │ │ │ ├── lib.es2021.string.d.ts │ │ │ ├── lib.es2021.weakref.d.ts │ │ │ ├── lib.es2022.array.d.ts │ │ │ ├── lib.es2022.d.ts │ │ │ ├── lib.es2022.error.d.ts │ │ │ ├── lib.es2022.full.d.ts │ │ │ ├── lib.es2022.intl.d.ts │ │ │ ├── lib.es2022.object.d.ts │ │ │ ├── lib.es2022.regexp.d.ts │ │ │ ├── lib.es2022.string.d.ts │ │ │ ├── lib.es2023.array.d.ts │ │ │ ├── lib.es2023.collection.d.ts │ │ │ ├── lib.es2023.d.ts │ │ │ ├── lib.es2023.full.d.ts │ │ │ ├── lib.es2023.intl.d.ts │ │ │ ├── lib.es2024.arraybuffer.d.ts │ │ │ ├── lib.es2024.collection.d.ts │ │ │ ├── lib.es2024.d.ts │ │ │ ├── lib.es2024.full.d.ts │ │ │ ├── lib.es2024.object.d.ts │ │ │ ├── lib.es2024.promise.d.ts │ │ │ ├── lib.es2024.regexp.d.ts │ │ │ ├── lib.es2024.sharedmemory.d.ts │ │ │ ├── lib.es2024.string.d.ts │ │ │ ├── lib.es5.d.ts │ │ │ ├── lib.es6.d.ts │ │ │ ├── lib.esnext.array.d.ts │ │ │ ├── lib.esnext.collection.d.ts │ │ │ ├── lib.esnext.d.ts │ │ │ ├── lib.esnext.decorators.d.ts │ │ │ ├── lib.esnext.disposable.d.ts │ │ │ ├── lib.esnext.full.d.ts │ │ │ ├── lib.esnext.intl.d.ts │ │ │ ├── lib.esnext.iterator.d.ts │ │ │ ├── lib.scripthost.d.ts │ │ │ ├── lib.webworker.asynciterable.d.ts │ │ │ ├── lib.webworker.d.ts │ │ │ ├── lib.webworker.importscripts.d.ts │ │ │ ├── lib.webworker.iterable.d.ts │ │ │ ├── pl │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── pt-br │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── ru │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── tr │ │ │ │ └── diagnosticMessages.generated.json │ │ │ ├── tsc.js │ │ │ ├── tsserver.js │ │ │ ├── tsserverlibrary.d.ts │ │ │ ├── tsserverlibrary.js │ │ │ ├── typescript.d.ts │ │ │ ├── typescript.js │ │ │ ├── typesMap.json │ │ │ ├── typingsInstaller.js │ │ │ ├── watchGuard.js │ │ │ ├── zh-cn │ │ │ │ └── diagnosticMessages.generated.json │ │ │ └── zh-tw │ │ │ └── diagnosticMessages.generated.json │ │ ├── LICENSE.txt │ │ ├── package.json │ │ ├── README.md │ │ ├── SECURITY.md │ │ └── ThirdPartyNoticeText.txt │ ├── undici-types │ │ ├── agent.d.ts │ │ ├── api.d.ts │ │ ├── balanced-pool.d.ts │ │ ├── cache.d.ts │ │ ├── client.d.ts │ │ ├── connector.d.ts │ │ ├── content-type.d.ts │ │ ├── cookies.d.ts │ │ ├── diagnostics-channel.d.ts │ │ ├── dispatcher.d.ts │ │ ├── env-http-proxy-agent.d.ts │ │ ├── errors.d.ts │ │ ├── eventsource.d.ts │ │ ├── fetch.d.ts │ │ ├── file.d.ts │ │ ├── filereader.d.ts │ │ ├── formdata.d.ts │ │ ├── global-dispatcher.d.ts │ │ ├── global-origin.d.ts │ │ ├── handlers.d.ts │ │ ├── header.d.ts │ │ ├── index.d.ts │ │ ├── interceptors.d.ts │ │ ├── LICENSE │ │ ├── mock-agent.d.ts │ │ ├── mock-client.d.ts │ │ ├── mock-errors.d.ts │ │ ├── mock-interceptor.d.ts │ │ ├── mock-pool.d.ts │ │ ├── package.json │ │ ├── patch.d.ts │ │ ├── pool-stats.d.ts │ │ ├── pool.d.ts │ │ ├── proxy-agent.d.ts │ │ ├── readable.d.ts │ │ ├── README.md │ │ ├── retry-agent.d.ts │ │ ├── retry-handler.d.ts │ │ ├── util.d.ts │ │ ├── webidl.d.ts │ │ └── websocket.d.ts │ ├── unpipe │ │ ├── HISTORY.md │ │ ├── index.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ ├── web-streams-polyfill │ │ ├── dist │ │ │ ├── polyfill.es2018.js │ │ │ ├── polyfill.es2018.js.map │ │ │ ├── polyfill.es2018.min.js │ │ │ ├── polyfill.es2018.min.js.map │ │ │ ├── polyfill.es2018.mjs │ │ │ ├── polyfill.es2018.mjs.map │ │ │ ├── polyfill.es6.js │ │ │ ├── polyfill.es6.js.map │ │ │ ├── polyfill.es6.min.js │ │ │ ├── polyfill.es6.min.js.map │ │ │ ├── polyfill.es6.mjs │ │ │ ├── polyfill.es6.mjs.map │ │ │ ├── polyfill.js │ │ │ ├── polyfill.js.map │ │ │ ├── polyfill.min.js │ │ │ ├── polyfill.min.js.map │ │ │ ├── polyfill.mjs │ │ │ ├── polyfill.mjs.map │ │ │ ├── ponyfill.es2018.js │ │ │ ├── ponyfill.es2018.js.map │ │ │ ├── ponyfill.es2018.mjs │ │ │ ├── ponyfill.es2018.mjs.map │ │ │ ├── ponyfill.es6.js │ │ │ ├── ponyfill.es6.js.map │ │ │ ├── ponyfill.es6.mjs │ │ │ ├── ponyfill.es6.mjs.map │ │ │ ├── ponyfill.js │ │ │ ├── ponyfill.js.map │ │ │ ├── ponyfill.mjs │ │ │ ├── ponyfill.mjs.map │ │ │ └── types │ │ │ ├── polyfill.d.ts │ │ │ ├── ponyfill.d.ts │ │ │ ├── ts3.6 │ │ │ │ ├── polyfill.d.ts │ │ │ │ └── ponyfill.d.ts │ │ │ └── tsdoc-metadata.json │ │ ├── es2018 │ │ │ └── package.json │ │ ├── es6 │ │ │ └── package.json │ │ ├── LICENSE │ │ ├── package.json │ │ ├── ponyfill │ │ │ ├── es2018 │ │ │ │ └── package.json │ │ │ ├── es6 │ │ │ │ └── package.json │ │ │ └── package.json │ │ └── README.md │ ├── wrappy │ │ ├── LICENSE │ │ ├── package.json │ │ ├── README.md │ │ └── wrappy.js │ ├── zod │ │ ├── index.d.ts │ │ ├── lib │ │ │ ├── __tests__ │ │ │ │ ├── Mocker.d.ts │ │ │ │ └── Mocker.js │ │ │ ├── benchmarks │ │ │ │ ├── datetime.d.ts │ │ │ │ ├── datetime.js │ │ │ │ ├── discriminatedUnion.d.ts │ │ │ │ ├── discriminatedUnion.js │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.js │ │ │ │ ├── ipv4.d.ts │ │ │ │ ├── ipv4.js │ │ │ │ ├── object.d.ts │ │ │ │ ├── object.js │ │ │ │ ├── primitives.d.ts │ │ │ │ ├── primitives.js │ │ │ │ ├── realworld.d.ts │ │ │ │ ├── realworld.js │ │ │ │ ├── string.d.ts │ │ │ │ ├── string.js │ │ │ │ ├── union.d.ts │ │ │ │ └── union.js │ │ │ ├── errors.d.ts │ │ │ ├── errors.js │ │ │ ├── external.d.ts │ │ │ ├── external.js │ │ │ ├── helpers │ │ │ │ ├── enumUtil.d.ts │ │ │ │ ├── enumUtil.js │ │ │ │ ├── errorUtil.d.ts │ │ │ │ ├── errorUtil.js │ │ │ │ ├── parseUtil.d.ts │ │ │ │ ├── parseUtil.js │ │ │ │ ├── partialUtil.d.ts │ │ │ │ ├── partialUtil.js │ │ │ │ ├── typeAliases.d.ts │ │ │ │ ├── typeAliases.js │ │ │ │ ├── util.d.ts │ │ │ │ └── util.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── index.mjs │ │ │ ├── index.umd.js │ │ │ ├── locales │ │ │ │ ├── en.d.ts │ │ │ │ └── en.js │ │ │ ├── types.d.ts │ │ │ ├── types.js │ │ │ ├── ZodError.d.ts │ │ │ └── ZodError.js │ │ ├── LICENSE │ │ ├── package.json │ │ └── README.md │ └── zod-to-json-schema │ ├── .github │ │ └── FUNDING.yml │ ├── .prettierrc.json │ ├── changelog.md │ ├── contributing.md │ ├── createIndex.ts │ ├── dist │ │ ├── cjs │ │ │ ├── errorMessages.js │ │ │ ├── index.js │ │ │ ├── Options.js │ │ │ ├── package.json │ │ │ ├── parseDef.js │ │ │ ├── parsers │ │ │ │ ├── any.js │ │ │ │ ├── array.js │ │ │ │ ├── bigint.js │ │ │ │ ├── boolean.js │ │ │ │ ├── branded.js │ │ │ │ ├── catch.js │ │ │ │ ├── date.js │ │ │ │ ├── default.js │ │ │ │ ├── effects.js │ │ │ │ ├── enum.js │ │ │ │ ├── intersection.js │ │ │ │ ├── literal.js │ │ │ │ ├── map.js │ │ │ │ ├── nativeEnum.js │ │ │ │ ├── never.js │ │ │ │ ├── null.js │ │ │ │ ├── nullable.js │ │ │ │ ├── number.js │ │ │ │ ├── object.js │ │ │ │ ├── optional.js │ │ │ │ ├── pipeline.js │ │ │ │ ├── promise.js │ │ │ │ ├── readonly.js │ │ │ │ ├── record.js │ │ │ │ ├── set.js │ │ │ │ ├── string.js │ │ │ │ ├── tuple.js │ │ │ │ ├── undefined.js │ │ │ │ ├── union.js │ │ │ │ └── unknown.js │ │ │ ├── Refs.js │ │ │ └── zodToJsonSchema.js │ │ ├── esm │ │ │ ├── errorMessages.js │ │ │ ├── index.js │ │ │ ├── Options.js │ │ │ ├── package.json │ │ │ ├── parseDef.js │ │ │ ├── parsers │ │ │ │ ├── any.js │ │ │ │ ├── array.js │ │ │ │ ├── bigint.js │ │ │ │ ├── boolean.js │ │ │ │ ├── branded.js │ │ │ │ ├── catch.js │ │ │ │ ├── date.js │ │ │ │ ├── default.js │ │ │ │ ├── effects.js │ │ │ │ ├── enum.js │ │ │ │ ├── intersection.js │ │ │ │ ├── literal.js │ │ │ │ ├── map.js │ │ │ │ ├── nativeEnum.js │ │ │ │ ├── never.js │ │ │ │ ├── null.js │ │ │ │ ├── nullable.js │ │ │ │ ├── number.js │ │ │ │ ├── object.js │ │ │ │ ├── optional.js │ │ │ │ ├── pipeline.js │ │ │ │ ├── promise.js │ │ │ │ ├── readonly.js │ │ │ │ ├── record.js │ │ │ │ ├── set.js │ │ │ │ ├── string.js │ │ │ │ ├── tuple.js │ │ │ │ ├── undefined.js │ │ │ │ ├── union.js │ │ │ │ └── unknown.js │ │ │ ├── Refs.js │ │ │ └── zodToJsonSchema.js │ │ └── types │ │ ├── errorMessages.d.ts │ │ ├── index.d.ts │ │ ├── Options.d.ts │ │ ├── parseDef.d.ts │ │ ├── parsers │ │ │ ├── any.d.ts │ │ │ ├── array.d.ts │ │ │ ├── bigint.d.ts │ │ │ ├── boolean.d.ts │ │ │ ├── branded.d.ts │ │ │ ├── catch.d.ts │ │ │ ├── date.d.ts │ │ │ ├── default.d.ts │ │ │ ├── effects.d.ts │ │ │ ├── enum.d.ts │ │ │ ├── intersection.d.ts │ │ │ ├── literal.d.ts │ │ │ ├── map.d.ts │ │ │ ├── nativeEnum.d.ts │ │ │ ├── never.d.ts │ │ │ ├── null.d.ts │ │ │ ├── nullable.d.ts │ │ │ ├── number.d.ts │ │ │ ├── object.d.ts │ │ │ ├── optional.d.ts │ │ │ ├── pipeline.d.ts │ │ │ ├── promise.d.ts │ │ │ ├── readonly.d.ts │ │ │ ├── record.d.ts │ │ │ ├── set.d.ts │ │ │ ├── string.d.ts │ │ │ ├── tuple.d.ts │ │ │ ├── undefined.d.ts │ │ │ ├── union.d.ts │ │ │ └── unknown.d.ts │ │ ├── Refs.d.ts │ │ └── zodToJsonSchema.d.ts │ ├── LICENSE │ ├── package.json │ ├── postcjs.ts │ ├── postesm.ts │ ├── README.md │ └── SECURITY.md ├── package-lock.json ├── package.json ├── README.md ├── schemas.ts └── tsconfig.json ``` # Files -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- ```markdown 1 | # Supabase MCP Server 2 | 3 | A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface. 4 | 5 | ## Features 6 | 7 | ### Project Management 8 | - List all projects 9 | - Get project details 10 | - Create new projects 11 | - Delete projects 12 | - Retrieve project API keys 13 | 14 | ### Organization Management 15 | - List all organizations 16 | - Get organization details 17 | - Create new organizations 18 | 19 | ## Installation 20 | Add the following to your Claude Config JSON file 21 | ``` 22 | { 23 | "mcpServers": { 24 | "supabase": { 25 | "command": "npx", 26 | "args": [ 27 | "y", 28 | "@joshuarileydev/supabase-mcp-server" 29 | ], 30 | "env": { 31 | "SUPABASE_API_KEY": "API_KEY_HERE" 32 | } 33 | } 34 | } 35 | } 36 | ``` ``` -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "Node16", 5 | "moduleResolution": "Node16", 6 | "strict": true, 7 | "esModuleInterop": true, 8 | "skipLibCheck": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "resolveJsonModule": true, 11 | "outDir": "./dist", 12 | "rootDir": "." 13 | }, 14 | "exclude": ["node_modules"], 15 | "include": [ 16 | "./**/*.ts" 17 | ] 18 | } 19 | ``` -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "@joshuarileydev/supabase-mcp-server", 3 | "version": "0.0.2", 4 | "description": "An MCP server for using the Supabase API", 5 | "license": "MIT", 6 | "type": "module", 7 | "bin": { 8 | "mcp-server": "dist/index.js" 9 | }, 10 | "files": [ 11 | "dist" 12 | ], 13 | "scripts": { 14 | "build": "tsc && shx chmod +x dist/*.js", 15 | "prepare": "npm run build", 16 | "watch": "tsc --watch" 17 | }, 18 | "dependencies": { 19 | "@modelcontextprotocol/sdk": "0.6.0", 20 | "@types/node-fetch": "^2.6.12", 21 | "node-fetch": "^3.3.2", 22 | "zod": "^3.22.4", 23 | "zod-to-json-schema": "^3.23.5" 24 | }, 25 | "devDependencies": { 26 | "shx": "^0.3.4", 27 | "typescript": "^5.6.2" 28 | } 29 | } ``` -------------------------------------------------------------------------------- /schemas.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { z } from 'zod'; 2 | 3 | // Common types 4 | export interface SupabaseResponse<T> { 5 | data: T; 6 | error: null | { 7 | message: string; 8 | }; 9 | } 10 | 11 | export interface Project { 12 | id: string; 13 | organization_id: string; 14 | name: string; 15 | region: string; 16 | created_at: string; 17 | } 18 | 19 | export interface Organization { 20 | id: string; 21 | name: string; 22 | billing_email: string; 23 | created_at: string; 24 | } 25 | 26 | export interface ProjectApiKey { 27 | api_key: string; 28 | name: string; 29 | tags?: string[]; 30 | created_at: string; 31 | } 32 | 33 | // Input Schemas 34 | // Projects 35 | export const ListProjectsInputSchema = z.object({ 36 | ref: z.string().optional() 37 | }); 38 | 39 | export const GetProjectInputSchema = z.object({ 40 | ref: z.string() 41 | }); 42 | 43 | export const CreateProjectInputSchema = z.object({ 44 | name: z.string(), 45 | organization_id: z.string(), 46 | region: z.string(), 47 | db_pass: z.string(), 48 | plan: z.string().optional() 49 | }); 50 | 51 | export const DeleteProjectInputSchema = z.object({ 52 | ref: z.string() 53 | }); 54 | 55 | // Organizations 56 | export const ListOrganizationsInputSchema = z.object({}); 57 | 58 | export const GetOrganizationInputSchema = z.object({ 59 | slug: z.string() 60 | }); 61 | 62 | export const CreateOrganizationInputSchema = z.object({ 63 | name: z.string(), 64 | billing_email: z.string() 65 | }); 66 | 67 | export const UpdateOrganizationInputSchema = z.object({ 68 | slug: z.string(), 69 | name: z.string().optional(), 70 | billing_email: z.string().optional() 71 | }); 72 | 73 | // Project API Keys 74 | export const GetProjectApiKeysInputSchema = z.object({ 75 | ref: z.string(), 76 | // Optional filter by key name 77 | name: z.string().optional() 78 | }); 79 | ``` -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- ```typescript 1 | #!/usr/bin/env node 2 | 3 | import { Server } from "@modelcontextprotocol/sdk/server/index.js"; 4 | import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; 5 | import { 6 | CallToolRequestSchema, 7 | ListToolsRequestSchema, 8 | } from "@modelcontextprotocol/sdk/types.js"; 9 | import fetch from "node-fetch"; 10 | import { z } from 'zod'; 11 | import { zodToJsonSchema } from 'zod-to-json-schema'; 12 | import { 13 | CreateProjectInputSchema, 14 | ListProjectsInputSchema, 15 | GetProjectInputSchema, 16 | DeleteProjectInputSchema, 17 | type SupabaseResponse, 18 | type Project, 19 | type Organization, 20 | ListOrganizationsInputSchema, 21 | GetOrganizationInputSchema, 22 | CreateOrganizationInputSchema, 23 | UpdateOrganizationInputSchema, 24 | ProjectApiKey, 25 | GetProjectApiKeysInputSchema, 26 | } from './schemas.js'; 27 | 28 | // Configuration 29 | const SUPABASE_API_URL = 'https://api.supabase.com/v1'; 30 | 31 | class SupabaseAPI { 32 | private apiKey: string; 33 | 34 | constructor(apiKey: string) { 35 | this.apiKey = apiKey; 36 | } 37 | 38 | private async makeRequest(endpoint: string, method: string = 'GET', body?: any): Promise<any> { 39 | const response = await fetch(`${SUPABASE_API_URL}${endpoint}`, { 40 | method, 41 | headers: { 42 | 'Authorization': `Bearer ${this.apiKey}`, 43 | 'Content-Type': 'application/json', 44 | }, 45 | body: body ? JSON.stringify(body) : undefined, 46 | }); 47 | 48 | if (!response.ok) { 49 | throw new Error(`Supabase API error: ${response.statusText}`); 50 | } 51 | 52 | return response.json(); 53 | } 54 | 55 | async listProjects(ref?: string): Promise<Project[]> { 56 | return this.makeRequest('/projects' + (ref ? `?ref=${ref}` : '')); 57 | } 58 | 59 | async getProject(ref: string): Promise<Project> { 60 | return this.makeRequest(`/projects/${ref}`); 61 | } 62 | 63 | async createProject(data: any): Promise<Project> { 64 | return this.makeRequest('/projects', 'POST', data); 65 | } 66 | 67 | async deleteProject(ref: string): Promise<void> { 68 | return this.makeRequest(`/projects/${ref}`, 'DELETE'); 69 | } 70 | 71 | async listOrganizations(): Promise<Organization[]> { 72 | return this.makeRequest('/organizations'); 73 | } 74 | 75 | async getOrganization(slug: string): Promise<Organization> { 76 | return this.makeRequest(`/organizations/${slug}`); 77 | } 78 | 79 | async createOrganization(data: any): Promise<Organization> { 80 | return this.makeRequest('/organizations', 'POST', data); 81 | } 82 | 83 | async getProjectApiKeys(ref: string): Promise<ProjectApiKey[]> { 84 | return this.makeRequest(`/projects/${ref}/api-keys`); 85 | } 86 | } 87 | 88 | // Initialize server and API client 89 | const apiKey = process.env.SUPABASE_API_KEY; 90 | if (!apiKey) { 91 | throw new Error('SUPABASE_API_KEY environment variable is required'); 92 | } 93 | 94 | const supabase = new SupabaseAPI(apiKey); 95 | const server = new Server({ 96 | name: "supabase-mcp", 97 | version: "1.0.0", 98 | }, { 99 | capabilities: { 100 | tools: {} 101 | } 102 | }); 103 | 104 | // List available tools 105 | server.setRequestHandler(ListToolsRequestSchema, async () => { 106 | return { 107 | tools: [ 108 | { 109 | name: "list_projects", 110 | description: "List all Supabase projects", 111 | inputSchema: zodToJsonSchema(ListProjectsInputSchema) 112 | }, 113 | { 114 | name: "get_project", 115 | description: "Get details of a specific Supabase project", 116 | inputSchema: zodToJsonSchema(GetProjectInputSchema) 117 | }, 118 | { 119 | name: "create_project", 120 | description: "Create a new Supabase project", 121 | inputSchema: zodToJsonSchema(CreateProjectInputSchema) 122 | }, 123 | { 124 | name: "delete_project", 125 | description: "Delete a Supabase project", 126 | inputSchema: zodToJsonSchema(DeleteProjectInputSchema) 127 | }, 128 | { 129 | name: "list_organizations", 130 | description: "List all organizations", 131 | inputSchema: zodToJsonSchema(ListOrganizationsInputSchema) 132 | }, 133 | { 134 | name: "get_organization", 135 | description: "Get details of a specific organization", 136 | inputSchema: zodToJsonSchema(GetOrganizationInputSchema) 137 | }, 138 | { 139 | name: "create_organization", 140 | description: "Create a new organization", 141 | inputSchema: zodToJsonSchema(CreateOrganizationInputSchema) 142 | }, 143 | { 144 | name: "get_project_api_keys", 145 | description: "Get API keys for a specific Supabase project", 146 | inputSchema: zodToJsonSchema(GetProjectApiKeysInputSchema) 147 | } 148 | ] 149 | }; 150 | }); 151 | 152 | // Handle tool calls 153 | server.setRequestHandler(CallToolRequestSchema, async (request) => { 154 | try { 155 | if (!request.params.arguments) { 156 | throw new Error("Arguments are required"); 157 | } 158 | 159 | switch (request.params.name) { 160 | case "list_projects": { 161 | const args = ListProjectsInputSchema.parse(request.params.arguments); 162 | const result = await supabase.listProjects(args.ref); 163 | return { toolResult: result }; 164 | } 165 | case "get_project": { 166 | const args = GetProjectInputSchema.parse(request.params.arguments); 167 | const result = await supabase.getProject(args.ref); 168 | return { toolResult: result }; 169 | } 170 | case "create_project": { 171 | const args = CreateProjectInputSchema.parse(request.params.arguments); 172 | const result = await supabase.createProject(args); 173 | return { toolResult: result }; 174 | } 175 | case "delete_project": { 176 | const args = DeleteProjectInputSchema.parse(request.params.arguments); 177 | await supabase.deleteProject(args.ref); 178 | return { toolResult: { success: true } }; 179 | } 180 | case "list_organizations": { 181 | const result = await supabase.listOrganizations(); 182 | return { toolResult: result }; 183 | } 184 | case "get_organization": { 185 | const args = GetOrganizationInputSchema.parse(request.params.arguments); 186 | const result = await supabase.getOrganization(args.slug); 187 | return { toolResult: result }; 188 | } 189 | case "create_organization": { 190 | const args = CreateOrganizationInputSchema.parse(request.params.arguments); 191 | const result = await supabase.createOrganization(args); 192 | return { toolResult: result }; 193 | } 194 | case "get_project_api_keys": { 195 | const args = GetProjectApiKeysInputSchema.parse(request.params.arguments); 196 | const result = await supabase.getProjectApiKeys(args.ref); 197 | if (args.name) { 198 | const filtered = result.filter(key => key.name === args.name); 199 | return { toolResult: filtered }; 200 | } 201 | return { toolResult: result }; 202 | } 203 | default: 204 | throw new Error(`Unknown tool: ${request.params.name}`); 205 | } 206 | } catch (error) { 207 | if (error instanceof z.ZodError) { 208 | throw new Error(`Invalid arguments: ${error.message}`); 209 | } 210 | throw error; 211 | } 212 | }); 213 | 214 | // Start the server 215 | async function runServer() { 216 | const transport = new StdioServerTransport(); 217 | await server.connect(transport); 218 | console.error("Supabase MCP Server running on stdio"); 219 | } 220 | 221 | runServer().catch((error) => { 222 | console.error("Fatal error in main():", error); 223 | process.exit(1); 224 | }); 225 | ```