#
tokens: 12925/50000 9/9 files
lines: off (toggle) GitHub
raw markdown copy
# Directory Structure

```
├── build
│   ├── cache.js
│   ├── index.js
│   ├── tool-chain.js
│   └── types.js
├── config-example.json
├── node_modules
│   ├── .bin
│   │   ├── 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
│   │       ├── 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
│   ├── 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
│   ├── axios
│   │   ├── CHANGELOG.md
│   │   ├── dist
│   │   │   ├── axios.js
│   │   │   ├── axios.js.map
│   │   │   ├── axios.min.js
│   │   │   ├── axios.min.js.map
│   │   │   ├── browser
│   │   │   │   ├── axios.cjs
│   │   │   │   └── axios.cjs.map
│   │   │   ├── esm
│   │   │   │   ├── axios.js
│   │   │   │   ├── axios.js.map
│   │   │   │   ├── axios.min.js
│   │   │   │   └── axios.min.js.map
│   │   │   └── node
│   │   │       ├── axios.cjs
│   │   │       └── axios.cjs.map
│   │   ├── index.d.cts
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── lib
│   │   │   ├── adapters
│   │   │   │   ├── adapters.js
│   │   │   │   ├── fetch.js
│   │   │   │   ├── http.js
│   │   │   │   ├── README.md
│   │   │   │   └── xhr.js
│   │   │   ├── axios.js
│   │   │   ├── cancel
│   │   │   │   ├── CanceledError.js
│   │   │   │   ├── CancelToken.js
│   │   │   │   └── isCancel.js
│   │   │   ├── core
│   │   │   │   ├── Axios.js
│   │   │   │   ├── AxiosError.js
│   │   │   │   ├── AxiosHeaders.js
│   │   │   │   ├── buildFullPath.js
│   │   │   │   ├── dispatchRequest.js
│   │   │   │   ├── InterceptorManager.js
│   │   │   │   ├── mergeConfig.js
│   │   │   │   ├── README.md
│   │   │   │   ├── settle.js
│   │   │   │   └── transformData.js
│   │   │   ├── defaults
│   │   │   │   ├── index.js
│   │   │   │   └── transitional.js
│   │   │   ├── env
│   │   │   │   ├── classes
│   │   │   │   │   └── FormData.js
│   │   │   │   ├── data.js
│   │   │   │   └── README.md
│   │   │   ├── helpers
│   │   │   │   ├── AxiosTransformStream.js
│   │   │   │   ├── AxiosURLSearchParams.js
│   │   │   │   ├── bind.js
│   │   │   │   ├── buildURL.js
│   │   │   │   ├── callbackify.js
│   │   │   │   ├── combineURLs.js
│   │   │   │   ├── composeSignals.js
│   │   │   │   ├── cookies.js
│   │   │   │   ├── deprecatedMethod.js
│   │   │   │   ├── formDataToJSON.js
│   │   │   │   ├── formDataToStream.js
│   │   │   │   ├── fromDataURI.js
│   │   │   │   ├── HttpStatusCode.js
│   │   │   │   ├── isAbsoluteURL.js
│   │   │   │   ├── isAxiosError.js
│   │   │   │   ├── isURLSameOrigin.js
│   │   │   │   ├── null.js
│   │   │   │   ├── parseHeaders.js
│   │   │   │   ├── parseProtocol.js
│   │   │   │   ├── progressEventReducer.js
│   │   │   │   ├── readBlob.js
│   │   │   │   ├── README.md
│   │   │   │   ├── resolveConfig.js
│   │   │   │   ├── speedometer.js
│   │   │   │   ├── spread.js
│   │   │   │   ├── throttle.js
│   │   │   │   ├── toFormData.js
│   │   │   │   ├── toURLEncodedForm.js
│   │   │   │   ├── trackStream.js
│   │   │   │   ├── validator.js
│   │   │   │   └── ZlibHeaderTransformStream.js
│   │   │   ├── platform
│   │   │   │   ├── browser
│   │   │   │   │   ├── classes
│   │   │   │   │   │   ├── Blob.js
│   │   │   │   │   │   ├── FormData.js
│   │   │   │   │   │   └── URLSearchParams.js
│   │   │   │   │   └── index.js
│   │   │   │   ├── common
│   │   │   │   │   └── utils.js
│   │   │   │   ├── index.js
│   │   │   │   └── node
│   │   │   │       ├── classes
│   │   │   │       │   ├── FormData.js
│   │   │   │       │   └── URLSearchParams.js
│   │   │   │       └── index.js
│   │   │   └── utils.js
│   │   ├── LICENSE
│   │   ├── MIGRATION_GUIDE.md
│   │   ├── package.json
│   │   ├── README.md
│   │   └── SECURITY.md
│   ├── bytes
│   │   ├── History.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── Readme.md
│   ├── combined-stream
│   │   ├── lib
│   │   │   └── combined_stream.js
│   │   ├── License
│   │   ├── package.json
│   │   ├── Readme.md
│   │   └── yarn.lock
│   ├── content-type
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── 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
│   ├── follow-redirects
│   │   ├── debug.js
│   │   ├── http.js
│   │   ├── https.js
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── form-data
│   │   ├── index.d.ts
│   │   ├── lib
│   │   │   ├── browser.js
│   │   │   ├── form_data.js
│   │   │   └── populate.js
│   │   ├── License
│   │   ├── package.json
│   │   └── Readme.md
│   ├── 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
│   ├── inherits
│   │   ├── inherits_browser.js
│   │   ├── inherits.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── mime-db
│   │   ├── db.json
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── mime-types
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── proxy-from-env
│   │   ├── .eslintrc
│   │   ├── .travis.yml
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── test.js
│   ├── raw-body
│   │   ├── HISTORY.md
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── SECURITY.md
│   ├── 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
│   ├── statuses
│   │   ├── codes.json
│   │   ├── HISTORY.md
│   │   ├── index.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   └── README.md
│   ├── 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
│   └── 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
│       │   ├── standard-schema.d.ts
│       │   ├── standard-schema.js
│       │   ├── types.d.ts
│       │   ├── types.js
│       │   ├── ZodError.d.ts
│       │   └── ZodError.js
│       ├── LICENSE
│       ├── package.json
│       └── README.md
├── package-lock.json
├── package.json
├── README.md
├── src
│   ├── cache.ts
│   ├── index.ts
│   ├── tool-chain.ts
│   └── types.ts
├── test
│   └── test-chain.js
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
# DeepSeek MCP Server

An MCP server implementation that provides code generation and completion capabilities using the DeepSeek API, with support for tool chaining and cost optimization.

## Features

- Code generation with language-specific support
- Code completion with context awareness
- Code optimization with multiple targets
- Tool chaining for complex operations
- Built-in caching for cost optimization
- TypeScript implementation with full type safety

## Tools

### 1. generate_code
Generate code using DeepSeek API with language-specific support.
```json
{
  "name": "generate_code",
  "params": {
    "prompt": "Write a function that sorts an array",
    "language": "typescript",
    "temperature": 0.7
  }
}
```

### 2. complete_code
Get intelligent code completions based on existing context.
```json
{
  "name": "complete_code",
  "params": {
    "code": "function processData(data) {",
    "prompt": "Add input validation and error handling",
    "temperature": 0.7
  }
}
```

### 3. optimize_code
Optimize existing code for performance, memory usage, or readability.
```json
{
  "name": "optimize_code",
  "params": {
    "code": "your code here",
    "target": "performance"
  }
}
```

### 4. execute_chain
Execute a chain of tools in sequence, with context passing between steps.
```json
{
  "name": "execute_chain",
  "params": {
    "steps": [
      {
        "toolName": "generate_code",
        "params": {
          "prompt": "Create a REST API endpoint",
          "language": "typescript"
        }
      },
      {
        "toolName": "optimize_code",
        "params": {
          "target": "performance"
        }
      }
    ]
  }
}
```

## Installation

1. Clone the repository
2. Install dependencies:
```bash
npm install
```

3. Build the project:
```bash
npm run build
```

4. Configure your DeepSeek API key in the MCP settings file:
```json
{
  "mcpServers": {
    "deepseek": {
      "command": "node",
      "args": ["/path/to/deepseek-mcp/build/index.js"],
      "env": {
        "DEEPSEEK_API_KEY": "your-api-key"
      }
    }
  }
}
```

## Usage

The server can be used with any MCP-compatible client. Here's an example using the MCP CLI:

```bash
mcp use deepseek generate_code --params '{"prompt": "Write a hello world program", "language": "python"}'
```

## Tool Chaining

Tool chaining allows you to combine multiple operations into a single workflow. Each tool in the chain can access the results of previous tools through the chain context.

Example chain:
1. Generate initial code
2. Complete the code with error handling
3. Optimize the final result

```json
{
  "steps": [
    {
      "toolName": "generate_code",
      "params": {
        "prompt": "Create a user authentication function",
        "language": "typescript"
      }
    },
    {
      "toolName": "complete_code",
      "params": {
        "prompt": "Add input validation and error handling"
      }
    },
    {
      "toolName": "optimize_code",
      "params": {
        "target": "security"
      }
    }
  ]
}
```

## Cost Optimization

The server implements several strategies to optimize API costs:

1. Request caching with TTL
2. Chain result caching
3. Smart prompt construction
4. Metadata tracking for usage analysis

## Development

To start development:

```bash
npm run dev
```

To clean and rebuild:

```bash
npm run rebuild
```

## Requirements

- Node.js >= 18.0.0
- DeepSeek API key
- MCP-compatible client

## License

ISC

```

--------------------------------------------------------------------------------
/config-example.json:
--------------------------------------------------------------------------------

```json
{
  "mcpServers": {
    "deepseek": {
      "command": "node",
      "args": ["PATH_TO_SERVER/build/index.js"],
      "env": {
        "DEEPSEEK_API_KEY": "your-api-key-here",
        "NODE_ENV": "production"
      }
    }
  }
}

```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ES2020",
    "moduleResolution": "node",
    "outDir": "./build",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}

```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
{
  "name": "deepseek-mcp",
  "version": "1.0.0",
  "description": "DeepSeek MCP Server for code generation and completion",
  "main": "build/index.js",
  "type": "module",
  "scripts": {
    "build": "tsc && chmod +x build/index.js",
    "start": "node build/index.js",
    "dev": "tsc -w",
    "clean": "rm -rf build",
    "rebuild": "npm run clean && npm run build"
  },
  "keywords": ["mcp", "deepseek", "ai", "code-generation"],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@modelcontextprotocol/sdk": "latest",
    "axios": "^1.6.0"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "typescript": "^5.0.0"
  },
  "engines": {
    "node": ">=18.0.0"
  }
}

```

--------------------------------------------------------------------------------
/src/types.ts:
--------------------------------------------------------------------------------

```typescript
export interface ToolChainContext {
  previousResults: any[];
  metadata: Record<string, any>;
}

export interface DeepSeekResponse {
  text: string;
  usage: {
    prompt_tokens: number;
    completion_tokens: number;
  };
}

export interface CacheEntry {
  result: string;
  timestamp: number;
  ttl: number;
  metadata?: Record<string, any>;
}

export interface ToolResult {
  success: boolean;
  result: any;
  error?: string;
  metadata?: Record<string, any>;
}

export interface ChainableToolConfig {
  name: string;
  description: string;
  inputSchema: Record<string, any>;
  chainable: boolean;
  requiresPrevious?: boolean;
  metadataSchema?: Record<string, any>;
}

export interface ToolChainStep {
  toolName: string;
  params: Record<string, any>;
  metadata?: Record<string, any>;
}

export interface ToolChain {
  steps: ToolChainStep[];
  context: ToolChainContext;
}

```

--------------------------------------------------------------------------------
/test/test-chain.js:
--------------------------------------------------------------------------------

```javascript
#!/usr/bin/env node

// Example test chain for the DeepSeek MCP server
const chain = {
  steps: [
    {
      toolName: 'generate_code',
      params: {
        prompt: 'Create a simple Express.js server with one GET endpoint that returns "Hello World"',
        language: 'typescript',
        temperature: 0.7
      }
    },
    {
      toolName: 'optimize_code',
      params: {
        target: 'performance'
      }
    }
  ]
};

// Print the chain configuration
console.log('Test Chain Configuration:');
console.log(JSON.stringify(chain, null, 2));

// Instructions for testing
console.log('\nTo test this chain, run:');
console.log('mcp use deepseek execute_chain --params \'{"steps": ' + JSON.stringify(chain.steps) + '}\'');

// Note about environment setup
console.log('\nMake sure to:');
console.log('1. Set DEEPSEEK_API_KEY in your MCP settings');
console.log('2. Add the DeepSeek MCP server to your MCP configuration');
console.log('3. Start the server using: npm start');

```

--------------------------------------------------------------------------------
/src/cache.ts:
--------------------------------------------------------------------------------

```typescript
import { CacheEntry } from './types';

export class Cache {
  private store: Map<string, CacheEntry>;

  constructor() {
    this.store = new Map();
  }

  get(key: string): string | null {
    const entry = this.store.get(key);
    if (!entry) return null;

    const now = Date.now();
    if (now - entry.timestamp > entry.ttl * 1000) {
      this.store.delete(key);
      return null;
    }

    return entry.result;
  }

  set(key: string, result: string, ttl: number, metadata?: Record<string, any>): void {
    this.store.set(key, {
      result,
      timestamp: Date.now(),
      ttl,
      metadata
    });
  }

  getMetadata(key: string): Record<string, any> | null {
    const entry = this.store.get(key);
    return entry?.metadata || null;
  }

  has(key: string): boolean {
    return this.get(key) !== null;
  }

  delete(key: string): void {
    this.store.delete(key);
  }

  clear(): void {
    this.store.clear();
  }

  // Helper method to generate cache keys for tool chains
  static generateChainKey(steps: { toolName: string; params: any }[]): string {
    return steps.map(step => 
      `${step.toolName}:${JSON.stringify(step.params)}`
    ).join('|');
  }

  // Cleanup expired entries
  cleanup(): void {
    const now = Date.now();
    for (const [key, entry] of this.store.entries()) {
      if (now - entry.timestamp > entry.ttl * 1000) {
        this.store.delete(key);
      }
    }
  }
}

```

--------------------------------------------------------------------------------
/src/tool-chain.ts:
--------------------------------------------------------------------------------

```typescript
import { ToolChain, ToolChainContext, ToolChainStep, ToolResult, ChainableToolConfig } from './types';
import { Cache } from './cache';

interface SchemaProperty {
  type: string;
  description?: string;
}

interface ValidationSchema {
  properties: Record<string, SchemaProperty>;
  required?: string[];
}

export class ToolChainManager {
  private tools: Map<string, ChainableToolConfig>;
  private cache: Cache;

  constructor() {
    this.tools = new Map();
    this.cache = new Cache();
  }

  registerTool(config: ChainableToolConfig): void {
    this.tools.set(config.name, config);
  }

  async executeChain(chain: ToolChain): Promise<ToolResult[]> {
    const results: ToolResult[] = [];
    const context: ToolChainContext = {
      previousResults: [],
      metadata: {}
    };

    // Check cache for entire chain result
    const chainKey = Cache.generateChainKey(chain.steps);
    const cachedResult = this.cache.get(chainKey);
    if (cachedResult) {
      try {
        const parsed = JSON.parse(cachedResult);
        return parsed;
      } catch (error) {
        console.error('Error parsing cached chain result:', error);
      }
    }

    // Execute each step in the chain
    for (const step of chain.steps) {
      try {
        const result = await this.executeStep(step, context);
        results.push(result);
        
        if (!result.success) {
          break; // Stop chain execution on failure
        }

        // Update context for next step
        context.previousResults.push(result);
        if (result.metadata) {
          context.metadata = { ...context.metadata, ...result.metadata };
        }
      } catch (error) {
        results.push({
          success: false,
          result: null,
          error: error instanceof Error ? error.message : 'Unknown error'
        });
        break;
      }
    }

    // Cache successful chain results
    if (results.every(r => r.success)) {
      this.cache.set(chainKey, JSON.stringify(results), 3600); // 1 hour TTL
    }

    return results;
  }

  private async executeStep(step: ToolChainStep, context: ToolChainContext): Promise<ToolResult> {
    const tool = this.tools.get(step.toolName);
    if (!tool) {
      throw new Error(`Tool not found: ${step.toolName}`);
    }

    // Validate tool requirements
    if (tool.requiresPrevious && context.previousResults.length === 0) {
      throw new Error(`Tool ${step.toolName} requires previous results`);
    }

    // Validate input parameters
    this.validateParams(step.params, tool.inputSchema as ValidationSchema);

    // Check step-level cache
    const stepKey = `${step.toolName}:${JSON.stringify(step.params)}`;
    const cachedResult = this.cache.get(stepKey);
    if (cachedResult) {
      try {
        return JSON.parse(cachedResult);
      } catch (error) {
        console.error('Error parsing cached step result:', error);
      }
    }

    try {
      // Execute tool with context
      const result: ToolResult = {
        success: true,
        result: await this.executeTool(tool, step.params, context),
        metadata: step.metadata
      };

      // Cache successful results
      this.cache.set(stepKey, JSON.stringify(result), 3600); // 1 hour TTL
      return result;
    } catch (error) {
      return {
        success: false,
        result: null,
        error: error instanceof Error ? error.message : 'Unknown error',
        metadata: step.metadata
      };
    }
  }

  private async executeTool(
    tool: ChainableToolConfig,
    params: Record<string, any>,
    context: ToolChainContext
  ): Promise<any> {
    // This would be implemented by the specific tool handler
    throw new Error('Tool execution not implemented');
  }

  private validateParams(params: Record<string, any>, schema: ValidationSchema): void {
    // Basic schema validation
    for (const [key, value] of Object.entries(schema.properties)) {
      if (schema.required?.includes(key) && !(key in params)) {
        throw new Error(`Missing required parameter: ${key}`);
      }

      if (key in params) {
        const paramValue = params[key];
        if (value.type && typeof paramValue !== value.type) {
          throw new Error(`Invalid type for parameter ${key}: expected ${value.type}, got ${typeof paramValue}`);
        }
      }
    }
  }

  // Helper methods for chain manipulation
  addStep(chain: ToolChain, step: ToolChainStep): void {
    chain.steps.push(step);
  }

  removeStep(chain: ToolChain, index: number): void {
    chain.steps.splice(index, 1);
  }

  clearChain(chain: ToolChain): void {
    chain.steps = [];
    chain.context = { previousResults: [], metadata: {} };
  }
}

```

--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------

```typescript
#!/usr/bin/env node
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
  Request
} from '@modelcontextprotocol/sdk/types.js';
import axios, { AxiosError } from 'axios';
import { ToolChainManager } from './tool-chain';
import { ChainableToolConfig, ToolChain } from './types';

interface ToolRequest extends Request {
  params: {
    name: string;
    arguments: Record<string, unknown>;
  };
}

interface ChainStep {
  toolName: string;
  params: Record<string, unknown>;
}

interface ChainRequest extends Request {
  params: {
    name: string;
    arguments: {
      steps: ChainStep[];
    };
  };
}

const API_KEY = process.env.DEEPSEEK_API_KEY;
if (!API_KEY) {
  throw new Error('DEEPSEEK_API_KEY environment variable is required');
}

interface DeepSeekResponse {
  choices: Array<{
    text: string;
  }>;
}

class DeepSeekServer {
  private server: Server;
  private chainManager: ToolChainManager;
  private axiosInstance;

  constructor() {
    this.server = new Server(
      {
        name: 'deepseek-server',
        version: '0.1.0',
      },
      {
        capabilities: {
          tools: {},
        },
      }
    );

    this.chainManager = new ToolChainManager();
    
    this.axiosInstance = axios.create({
      baseURL: 'https://api.deepseek.com/v1',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
      },
    });

    this.setupTools();
    this.setupErrorHandling();
  }

  private setupTools(): void {
    // Code Generation Tool
    const generateCodeConfig: ChainableToolConfig = {
      name: 'generate_code',
      description: 'Generate code using DeepSeek API',
      chainable: true,
      inputSchema: {
        properties: {
          prompt: {
            type: 'string',
            description: 'The code generation prompt'
          },
          language: {
            type: 'string',
            description: 'Target programming language'
          },
          temperature: {
            type: 'number',
            description: 'Sampling temperature (0-1)'
          }
        },
        required: ['prompt']
      }
    };

    // Code Completion Tool
    const completeCodeConfig: ChainableToolConfig = {
      name: 'complete_code',
      description: 'Get code completions using DeepSeek',
      chainable: true,
      inputSchema: {
        properties: {
          code: {
            type: 'string',
            description: 'Existing code context'
          },
          prompt: {
            type: 'string',
            description: 'Completion prompt'
          },
          temperature: {
            type: 'number',
            description: 'Sampling temperature'
          }
        },
        required: ['code', 'prompt']
      }
    };

    // Code Optimization Tool
    const optimizeCodeConfig: ChainableToolConfig = {
      name: 'optimize_code',
      description: 'Optimize code using DeepSeek',
      chainable: true,
      requiresPrevious: true,
      inputSchema: {
        properties: {
          code: {
            type: 'string',
            description: 'Code to optimize'
          },
          target: {
            type: 'string',
            description: 'Optimization target (performance, memory, readability)'
          }
        },
        required: ['code']
      }
    };

    // Register tools
    this.chainManager.registerTool(generateCodeConfig);
    this.chainManager.registerTool(completeCodeConfig);
    this.chainManager.registerTool(optimizeCodeConfig);

    // Set up MCP tool handlers
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'generate_code',
          description: 'Generate code using DeepSeek API',
          inputSchema: generateCodeConfig.inputSchema
        },
        {
          name: 'complete_code',
          description: 'Get code completions using DeepSeek',
          inputSchema: completeCodeConfig.inputSchema
        },
        {
          name: 'optimize_code',
          description: 'Optimize code using DeepSeek',
          inputSchema: optimizeCodeConfig.inputSchema
        },
        {
          name: 'execute_chain',
          description: 'Execute a chain of DeepSeek tools',
          inputSchema: {
            type: 'object',
            properties: {
              steps: {
                type: 'array',
                items: {
                  type: 'object',
                  properties: {
                    toolName: { type: 'string' },
                    params: { type: 'object' }
                  },
                  required: ['toolName', 'params']
                }
              }
            },
            required: ['steps']
          }
        }
      ]
    }));

    this.server.setRequestHandler(CallToolRequestSchema, async (request: Request) => {
      try {
        if (!request.params?.name) {
          throw new Error('Invalid request: missing tool name');
        }

        if (request.params.name === 'execute_chain') {
          const chainRequest = request as ChainRequest;
          if (!chainRequest.params.arguments?.steps) {
            throw new Error('Invalid chain request: missing steps');
          }

          const chain: ToolChain = {
            steps: chainRequest.params.arguments.steps,
            context: { previousResults: [], metadata: {} }
          };
          
          const results = await this.chainManager.executeChain(chain);
          return {
            content: [{
              type: 'text',
              text: JSON.stringify(results, null, 2)
            }]
          };
        }

        // Handle individual tool calls
        const toolRequest = request as ToolRequest;
        const result = await this.handleToolCall(
          toolRequest.params.name,
          toolRequest.params.arguments
        );

        return {
          content: [{
            type: 'text',
            text: result
          }]
        };
      } catch (error: unknown) {
        return {
          content: [{
            type: 'text',
            text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          }],
          isError: true
        };
      }
    });
  }

  private async handleToolCall(name: string, params: Record<string, unknown>): Promise<string> {
    try {
      const response = await this.axiosInstance.post<DeepSeekResponse>('/completions', {
        prompt: this.buildPrompt(name, params),
        temperature: params.temperature || 0.7,
        max_tokens: 2000
      });

      return response.data.choices[0].text;
    } catch (error: unknown) {
      if (error instanceof AxiosError) {
        throw new Error(`DeepSeek API error: ${error.response?.data?.error || error.message}`);
      }
      throw error;
    }
  }

  private buildPrompt(toolName: string, params: Record<string, unknown>): string {
    switch (toolName) {
      case 'generate_code':
        return `
### Task: Code Generation
### Language: ${params.language || 'any'}
### Requirements:
${params.prompt}
### Response:
`;

      case 'complete_code':
        return `
### Task: Code Completion
### Context:
${params.code}
### Requirements:
${params.prompt}
### Response:
`;

      case 'optimize_code':
        return `
### Task: Code Optimization
### Target: ${params.target || 'performance'}
### Code:
${params.code}
### Response:
`;

      default:
        throw new Error(`Unknown tool: ${toolName}`);
    }
  }

  private setupErrorHandling(): void {
    this.server.onerror = (error: Error) => {
      console.error('[MCP Error]', error);
    };

    process.on('SIGINT', async () => {
      await this.server.close();
      process.exit(0);
    });
  }

  async run(): Promise<void> {
    const transport = new StdioServerTransport();
    await this.server.connect(transport);
    console.error('DeepSeek MCP server running on stdio');
  }
}

const server = new DeepSeekServer();
server.run().catch(console.error);

```