diff --git a/package-lock.json b/package-lock.json index 18de9f8b8b..81ede797a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -480,6 +480,21 @@ "node": ">=12" } }, + "node_modules/@google-cloud/local-auth": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@google-cloud/local-auth/-/local-auth-3.0.1.tgz", + "integrity": "sha512-YJ3GFbksfHyEarbVHPSCzhKpjbnlAhdzg2SEf79l6ODukrSM1qUOqfopY232Xkw26huKSndyzmJz+A6b2WYn7Q==", + "license": "Apache-2.0", + "dependencies": { + "arrify": "^2.0.1", + "google-auth-library": "^9.0.0", + "open": "^7.0.3", + "server-destroy": "^1.0.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@hono/node-server": { "version": "1.19.9", "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", @@ -699,6 +714,10 @@ "resolved": "src/filesystem", "link": true }, + "node_modules/@modelcontextprotocol/server-gdrive": { + "resolved": "src/gdrive", + "link": true + }, "node_modules/@modelcontextprotocol/server-memory": { "resolved": "src/memory", "link": true @@ -1358,6 +1377,15 @@ "node": ">= 0.6" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/ajv": { "version": "8.17.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", @@ -1413,6 +1441,15 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1428,6 +1465,35 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/body-parser": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz", @@ -1461,6 +1527,12 @@ "balanced-match": "^1.0.0" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -1717,6 +1789,15 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "license": "MIT" }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -1934,6 +2015,12 @@ "express": ">= 4.11" } }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2040,6 +2127,56 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gaxios": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", + "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==", + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "is-stream": "^2.0.0", + "node-fetch": "^2.6.9", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/gaxios/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/gcp-metadata": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", + "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", + "license": "Apache-2.0", + "dependencies": { + "gaxios": "^6.1.1", + "google-logging-utils": "^0.0.2", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -2105,6 +2242,62 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/google-auth-library": { + "version": "9.15.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", + "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^6.1.1", + "gcp-metadata": "^6.1.0", + "gtoken": "^7.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-logging-utils": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", + "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/googleapis": { + "version": "144.0.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-144.0.0.tgz", + "integrity": "sha512-ELcWOXtJxjPX4vsKMh+7V+jZvgPwYMlEhQFiu2sa9Qmt5veX8nwXPksOWGGN6Zk4xCiLygUyaz7xGtcMO+Onxw==", + "license": "Apache-2.0", + "dependencies": { + "google-auth-library": "^9.0.0", + "googleapis-common": "^7.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/googleapis-common": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-7.2.0.tgz", + "integrity": "sha512-/fhDZEJZvOV3X5jmD+fKxMqma5q2Q9nZNSF3kn1F18tpxmA86BcTxAGBQdM0N89Z3bEaIs+HVznSmFJEAmMTjA==", + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "gaxios": "^6.0.3", + "google-auth-library": "^9.7.0", + "qs": "^6.7.0", + "url-template": "^2.0.8", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -2117,6 +2310,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gtoken": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", + "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", + "license": "MIT", + "dependencies": { + "gaxios": "^6.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2181,6 +2387,19 @@ "node": ">= 0.8" } }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/iconv-lite": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", @@ -2261,6 +2480,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2275,6 +2509,30 @@ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "license": "MIT" }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2350,6 +2608,15 @@ "url": "https://github.com/sponsors/panva" } }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -2374,6 +2641,27 @@ "setimmediate": "^1.0.5" } }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/lie": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", @@ -2595,6 +2883,22 @@ "wrappy": "1" } }, + "node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -2953,6 +3257,26 @@ "url": "https://opencollective.com/express" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -3007,6 +3331,12 @@ "node": ">= 18" } }, + "node_modules/server-destroy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz", + "integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==", + "license": "ISC" + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -3385,6 +3715,12 @@ "node": ">=0.6" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, "node_modules/type-is": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", @@ -3428,12 +3764,31 @@ "node": ">= 0.8" } }, + "node_modules/url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==", + "license": "BSD" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -3591,6 +3946,22 @@ } } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3854,8 +4225,7 @@ }, "src/gdrive": { "name": "@modelcontextprotocol/server-gdrive", - "version": "0.6.2", - "extraneous": true, + "version": "0.7.0", "license": "MIT", "dependencies": { "@google-cloud/local-auth": "^3.0.1", @@ -3871,6 +4241,17 @@ "typescript": "^5.6.2" } }, + "src/gdrive/node_modules/@modelcontextprotocol/sdk": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.0.1.tgz", + "integrity": "sha512-slLdFaxQJ9AlRg+hw28iiTtGvShAOgOKXcD0F91nUcRYiOMuS9ZBYjcdNZRXW9G5JQ511GRTdUy1zQVZDpJ+4w==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "raw-body": "^3.0.0", + "zod": "^3.23.8" + } + }, "src/github": { "name": "@modelcontextprotocol/server-github", "version": "0.6.2", diff --git a/src/gdrive/Dockerfile b/src/gdrive/Dockerfile new file mode 100644 index 0000000000..923ffa7e09 --- /dev/null +++ b/src/gdrive/Dockerfile @@ -0,0 +1,29 @@ +FROM node:22.12-alpine AS builder + +COPY src/gdrive /app +COPY tsconfig.json /tsconfig.json + +WORKDIR /app + +RUN --mount=type=cache,target=/root/.npm npm install + +RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev + +FROM node:22-alpine AS release + +WORKDIR /app + +COPY --from=builder /app/dist /app/dist +COPY --from=builder /app/package.json /app/package.json +COPY --from=builder /app/package-lock.json /app/package-lock.json +COPY src/gdrive/replace_open.sh /replace_open.sh + +ENV NODE_ENV=production + +RUN npm ci --ignore-scripts --omit-dev + +RUN sh /replace_open.sh + +RUN rm /replace_open.sh + +ENTRYPOINT ["node", "dist/index.js"] \ No newline at end of file diff --git a/src/gdrive/README.md b/src/gdrive/README.md new file mode 100644 index 0000000000..28edf44774 --- /dev/null +++ b/src/gdrive/README.md @@ -0,0 +1,174 @@ +# Google Drive server + +This MCP server integrates with Google Drive to allow listing, reading, and searching over files. + +## Components + +### Tools + +- **search** + - Search for files in Google Drive + - Input: `query` (string): Search query + - Returns file names, MIME types, and file IDs of matching files + - File IDs are included in the output as `[id:...]` so they can be used with other tools + +- **download** + - Download a file from Google Drive to a local temp path + - Input: `fileId` (string): The Google Drive file ID (from search results) + - Returns the local file path so the client can read it with native tools + - Google Workspace files are automatically exported (Docs → Markdown, Sheets → CSV, Presentations → Plain text, Drawings → PNG) + - Binary files (PDFs, images, etc.) are saved as-is + - Files are saved to `/tmp/gdrive-downloads/` by default (configurable via `GDRIVE_DOWNLOAD_DIR` env var) + +### Resources + +The server provides access to Google Drive files: + +- **Files** (`gdrive:///`) + - Supports all file types + - Google Workspace files are automatically exported: + - Docs → Markdown + - Sheets → CSV + - Presentations → Plain text + - Drawings → PNG + - Other files are provided in their native format + +### Environment Variables + +| Variable | Description | Default | +|---|---|---| +| `GDRIVE_OAUTH_PATH` | Path to the OAuth client keys JSON file | `gcp-oauth.keys.json` in repo root | +| `GDRIVE_CREDENTIALS_PATH` | Path to the saved credentials JSON file | `.gdrive-server-credentials.json` in repo root | +| `GDRIVE_DOWNLOAD_DIR` | Directory where the `download` tool saves files | `/tmp/gdrive-downloads` | + +## Getting started + +1. [Create a new Google Cloud project](https://console.cloud.google.com/projectcreate) +2. [Enable the Google Drive API](https://console.cloud.google.com/workspace-api/products) +3. [Configure an OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) ("internal" is fine for testing) +4. Add OAuth scope `https://www.googleapis.com/auth/drive.readonly` +5. [Create an OAuth Client ID](https://console.cloud.google.com/apis/credentials/oauthclient) for application type "Desktop App" +6. Download the JSON file of your client's OAuth keys +7. Rename the key file to `gcp-oauth.keys.json` and place into the root of this repo (i.e. `servers/gcp-oauth.keys.json`) + +Make sure to build the server with either `npm run build` or `npm run watch`. + +### Authentication + +To authenticate and save credentials: + +1. Run the server with the `auth` argument: `node ./dist auth` +2. This will open an authentication flow in your system browser +3. Complete the authentication process +4. Credentials will be saved in the root of this repo (i.e. `servers/.gdrive-server-credentials.json`) + +### Usage with Desktop App + +To integrate this server with the desktop app, add the following to your app's server configuration: + +#### Docker + +Authentication: + +Assuming you have completed setting up the OAuth application on Google Cloud, you can now auth the server with the following command, replacing `/path/to/gcp-oauth.keys.json` with the path to your OAuth keys file: + +```bash +docker run -i --rm --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth +``` + +The command will print the URL to open in your browser. Open this URL in your browser and complete the authentication process. The credentials will be saved in the `mcp-gdrive` volume. + +Once authenticated, you can use the server in your app's server configuration: + +```json +{ + "mcpServers": { + "gdrive": { + "command": "docker", + "args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"] + } + } +} +``` + +#### NPX + +```json +{ + "mcpServers": { + "gdrive": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-gdrive" + ], + "env": { + "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json" + } + } + } +} +``` + +### Usage with VS Code + +For quick installation, use one of the one-click install buttons below.. + +[![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-NPM-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gdrive&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22credentials_path%22%2C%22description%22%3A%22Path%20to%20.gdrive-server-credentials.json%20file%22%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-gdrive%22%5D%2C%22env%22%3A%7B%22GDRIVE_CREDENTIALS_PATH%22%3A%22%24%7Binput%3Acredentials_path%7D%22%7D%7D) [![Install with NPX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-NPM-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gdrive&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22credentials_path%22%2C%22description%22%3A%22Path%20to%20.gdrive-server-credentials.json%20file%22%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-gdrive%22%5D%2C%22env%22%3A%7B%22GDRIVE_CREDENTIALS_PATH%22%3A%22%24%7Binput%3Acredentials_path%7D%22%7D%7D&quality=insiders) + +[![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Docker-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gdrive&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-v%22%2C%22mcp-gdrive%3A%2Fgdrive-server%22%2C%22-e%22%2C%22GDRIVE_CREDENTIALS_PATH%3D%2Fgdrive-server%2Fcredentials.json%22%2C%22mcp%2Fgdrive%22%5D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Docker-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gdrive&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-v%22%2C%22mcp-gdrive%3A%2Fgdrive-server%22%2C%22-e%22%2C%22GDRIVE_CREDENTIALS_PATH%3D%2Fgdrive-server%2Fcredentials.json%22%2C%22mcp%2Fgdrive%22%5D%7D&quality=insiders) + +For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open User Settings (JSON)`. + +Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others. + +> Note that the `mcp` key is not needed in the `.vscode/mcp.json` file. + +#### NPX + +```json +{ + "mcp": { + "servers": { + "gdrive": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-gdrive" + ], + "env": { + "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json" + } + } + } + } +} +``` + +#### Docker + +```json +{ + "mcp": { + "servers": { + "gdrive": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-v", + "mcp-gdrive:/gdrive-server", + "-e", + "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", + "mcp/gdrive" + ] + } + } + } +} +``` + +## License + +This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. diff --git a/src/gdrive/index.ts b/src/gdrive/index.ts new file mode 100644 index 0000000000..d6929335a3 --- /dev/null +++ b/src/gdrive/index.ts @@ -0,0 +1,328 @@ +#!/usr/bin/env node + +import { authenticate } from "@google-cloud/local-auth"; +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { + CallToolRequestSchema, + ListResourcesRequestSchema, + ListToolsRequestSchema, + ReadResourceRequestSchema, +} from "@modelcontextprotocol/sdk/types.js"; +import fs from "fs"; +import { google } from "googleapis"; +import path from "path"; +import { fileURLToPath } from 'url'; + +const drive = google.drive("v3"); + +// Resource handlers call drive.files.list() on every resources/list request, +// which some MCP clients invoke during initialization. Set this env var to +// "true" to expose Drive files as MCP resources; leave unset for tools-only +// mode (search + download), which is compatible with all MCP clients. +const enableResources = process.env.GDRIVE_ENABLE_RESOURCES === "true"; + +const server = new Server( + { + name: "example-servers/gdrive", + version: "0.1.0", + }, + { + capabilities: { + ...(enableResources ? { resources: {} } : {}), + tools: {}, + }, + }, +); + +if (enableResources) { + server.setRequestHandler(ListResourcesRequestSchema, async (request) => { + const pageSize = 10; + const params: any = { + pageSize, + fields: "nextPageToken, files(id, name, mimeType)", + }; + + if (request.params?.cursor) { + params.pageToken = request.params.cursor; + } + + const res = await drive.files.list(params); + const files = res.data.files!; + + return { + resources: files.map((file) => ({ + uri: `gdrive:///${file.id}`, + mimeType: file.mimeType, + name: file.name, + })), + nextCursor: res.data.nextPageToken, + }; + }); + + server.setRequestHandler(ReadResourceRequestSchema, async (request) => { + const fileId = request.params.uri.replace("gdrive:///", ""); + + // First get file metadata to check mime type + const file = await drive.files.get({ + fileId, + fields: "mimeType", + }); + + // For Google Docs/Sheets/etc we need to export + if (file.data.mimeType?.startsWith("application/vnd.google-apps")) { + let exportMimeType: string; + switch (file.data.mimeType) { + case "application/vnd.google-apps.document": + exportMimeType = "text/markdown"; + break; + case "application/vnd.google-apps.spreadsheet": + exportMimeType = "text/csv"; + break; + case "application/vnd.google-apps.presentation": + exportMimeType = "text/plain"; + break; + case "application/vnd.google-apps.drawing": + exportMimeType = "image/png"; + break; + default: + exportMimeType = "text/plain"; + } + + const res = await drive.files.export( + { fileId, mimeType: exportMimeType }, + { responseType: "text" }, + ); + + return { + contents: [ + { + uri: request.params.uri, + mimeType: exportMimeType, + text: res.data, + }, + ], + }; + } + + // For regular files download content + const res = await drive.files.get( + { fileId, alt: "media" }, + { responseType: "arraybuffer" }, + ); + const mimeType = file.data.mimeType || "application/octet-stream"; + if (mimeType.startsWith("text/") || mimeType === "application/json") { + return { + contents: [ + { + uri: request.params.uri, + mimeType: mimeType, + text: Buffer.from(res.data as ArrayBuffer).toString("utf-8"), + }, + ], + }; + } else { + return { + contents: [ + { + uri: request.params.uri, + mimeType: mimeType, + blob: Buffer.from(res.data as ArrayBuffer).toString("base64"), + }, + ], + }; + } + }); +} + +const DOWNLOAD_DIR = process.env.GDRIVE_DOWNLOAD_DIR || "/tmp/gdrive-downloads"; + +server.setRequestHandler(ListToolsRequestSchema, async () => { + return { + tools: [ + { + name: "search", + description: "Search for files in Google Drive", + inputSchema: { + type: "object", + properties: { + query: { + type: "string", + description: "Search query", + }, + }, + required: ["query"], + }, + }, + { + name: "download", + description: + "Download a file from Google Drive to a local temp path. Returns the local file path so the client can read it with native tools. For Google Docs/Sheets/Presentations, exports to markdown/csv/text.", + inputSchema: { + type: "object", + properties: { + fileId: { + type: "string", + description: "The Google Drive file ID (from search results)", + }, + }, + required: ["fileId"], + }, + }, + ], + }; +}); + +server.setRequestHandler(CallToolRequestSchema, async (request) => { + if (request.params.name === "search") { + const userQuery = request.params.arguments?.query as string; + const escapedQuery = userQuery.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); + const formattedQuery = `fullText contains '${escapedQuery}'`; + + const res = await drive.files.list({ + q: formattedQuery, + pageSize: 10, + fields: "files(id, name, mimeType, modifiedTime, size)", + }); + + const fileList = res.data.files + ?.map((file: any) => `${file.name} (${file.mimeType}) [id:${file.id}]`) + .join("\n"); + return { + content: [ + { + type: "text", + text: `Found ${res.data.files?.length ?? 0} files:\n${fileList}`, + }, + ], + isError: false, + }; + } + if (request.params.name === "download") { + const fileId = request.params.arguments?.fileId as string; + if (!fileId) { + return { + content: [{ type: "text", text: "Error: fileId is required" }], + isError: true, + }; + } + + fs.mkdirSync(DOWNLOAD_DIR, { recursive: true }); + + const file = await drive.files.get({ fileId, fields: "name, mimeType" }); + const fileName = (file.data.name || "unnamed").replace( + /[/\\:*?"<>|\u00A0\u202F\u2000-\u200A\u2028\u2029\u205F\u3000\uFEFF]/g, + "_", + ); + const mimeType = file.data.mimeType; + + let localPath: string; + if (mimeType?.startsWith("application/vnd.google-apps")) { + let exportMimeType: string; + let ext: string; + switch (mimeType) { + case "application/vnd.google-apps.document": + exportMimeType = "text/markdown"; + ext = ".md"; + break; + case "application/vnd.google-apps.spreadsheet": + exportMimeType = "text/csv"; + ext = ".csv"; + break; + case "application/vnd.google-apps.presentation": + exportMimeType = "text/plain"; + ext = ".txt"; + break; + case "application/vnd.google-apps.drawing": + exportMimeType = "image/png"; + ext = ".png"; + break; + default: + exportMimeType = "text/plain"; + ext = ".txt"; + } + const res = await drive.files.export( + { fileId, mimeType: exportMimeType }, + { responseType: "arraybuffer" }, + ); + localPath = path.join(DOWNLOAD_DIR, `${fileName}${ext}`); + fs.writeFileSync(localPath, Buffer.from(res.data as ArrayBuffer)); + } else { + const res = await drive.files.get( + { fileId, alt: "media" }, + { responseType: "arraybuffer" }, + ); + localPath = path.join(DOWNLOAD_DIR, fileName); + fs.writeFileSync(localPath, Buffer.from(res.data as ArrayBuffer)); + } + + const stats = fs.statSync(localPath); + return { + content: [ + { + type: "text", + text: `Downloaded to: ${localPath}\nSize: ${stats.size} bytes\nMIME type: ${mimeType}`, + }, + ], + isError: false, + }; + } + + throw new Error("Tool not found"); +}); + +const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join( + path.dirname(fileURLToPath(import.meta.url)), + "../../../.gdrive-server-credentials.json", +); + +async function authenticateAndSaveCredentials() { + console.log("Launching auth flow…"); + const auth = await authenticate({ + keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join( + path.dirname(fileURLToPath(import.meta.url)), + "../../../gcp-oauth.keys.json", + ), + scopes: ["https://www.googleapis.com/auth/drive.readonly"], + }); + fs.writeFileSync(credentialsPath, JSON.stringify(auth.credentials)); + console.log("Credentials saved. You can now run the server."); +} + +async function loadCredentialsAndRunServer() { + if (!fs.existsSync(credentialsPath)) { + console.error( + "Credentials not found. Please run with 'auth' argument first.", + ); + process.exit(1); + } + + const credentials = JSON.parse(fs.readFileSync(credentialsPath, "utf-8")); + + // Load client_id and client_secret from OAuth keys so the client can + // auto-refresh expired access tokens using the refresh_token. + const oauthKeysPath = process.env.GDRIVE_OAUTH_PATH || path.join( + path.dirname(fileURLToPath(import.meta.url)), + "../../../gcp-oauth.keys.json", + ); + const oauthKeys = JSON.parse(fs.readFileSync(oauthKeysPath, "utf-8")); + const keyData = oauthKeys.installed || oauthKeys.web; + + const auth = new google.auth.OAuth2( + keyData.client_id, + keyData.client_secret, + keyData.redirect_uris?.[0], + ); + auth.setCredentials(credentials); + google.options({ auth }); + + console.error("Credentials loaded. Starting server."); + const transport = new StdioServerTransport(); + await server.connect(transport); +} + +if (process.argv[2] === "auth") { + authenticateAndSaveCredentials().catch(console.error); +} else { + loadCredentialsAndRunServer().catch(console.error); +} diff --git a/src/gdrive/package.json b/src/gdrive/package.json new file mode 100644 index 0000000000..7e63276b50 --- /dev/null +++ b/src/gdrive/package.json @@ -0,0 +1,31 @@ +{ + "name": "@modelcontextprotocol/server-gdrive", + "version": "0.7.0", + "description": "MCP server for interacting with Google Drive", + "license": "MIT", + "author": "Anthropic, PBC (https://anthropic.com)", + "homepage": "https://modelcontextprotocol.io", + "bugs": "https://github.com/modelcontextprotocol/servers/issues", + "type": "module", + "bin": { + "mcp-server-gdrive": "dist/index.js" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "tsc && shx chmod +x dist/*.js", + "prepare": "npm run build", + "watch": "tsc --watch" + }, + "dependencies": { + "@google-cloud/local-auth": "^3.0.1", + "@modelcontextprotocol/sdk": "1.0.1", + "googleapis": "^144.0.0" + }, + "devDependencies": { + "@types/node": "^22", + "shx": "^0.3.4", + "typescript": "^5.6.2" + } +} \ No newline at end of file diff --git a/src/gdrive/replace_open.sh b/src/gdrive/replace_open.sh new file mode 100644 index 0000000000..6727854b8b --- /dev/null +++ b/src/gdrive/replace_open.sh @@ -0,0 +1,5 @@ +#! /bin/bash + +# Basic script to replace opn(authorizeUrl, { wait: false }).then(cp => cp.unref()); with process.stdout.write(`Open this URL in your browser: ${authorizeUrl}`); + +sed -i 's/opn(authorizeUrl, { wait: false }).then(cp => cp.unref());/process.stderr.write(`Open this URL in your browser: ${authorizeUrl}\n`);/' node_modules/@google-cloud/local-auth/build/src/index.js diff --git a/src/gdrive/tsconfig.json b/src/gdrive/tsconfig.json new file mode 100644 index 0000000000..849db91328 --- /dev/null +++ b/src/gdrive/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "Node16", + "moduleResolution": "Node16", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": [ + "./**/*.ts" + ] +}