gem-context-server 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Gem model context server
2
+
3
+ Use for Zed & Cursor
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // src/index.ts
26
+ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
27
+ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
28
+ var import_adm_zip = __toESM(require("adm-zip"));
29
+ async function downloadDocs() {
30
+ const res = await fetch("https://github.com/mantou132/gem/archive/refs/heads/main.zip");
31
+ const buf = await res.arrayBuffer();
32
+ const zip = new import_adm_zip.default(Buffer.from(buf));
33
+ const zipEntries = zip.getEntries();
34
+ return zipEntries.filter((entry) => entry.entryName.includes("packages/gem/docs/en") && entry.entryName.endsWith(".md")).map((e) => ({
35
+ entryName: e.entryName,
36
+ content: zip.readAsText(e)
37
+ }));
38
+ }
39
+ var server = new import_mcp.McpServer({
40
+ name: "Gem",
41
+ version: "0.0.1"
42
+ });
43
+ var docsCache;
44
+ server.resource("docs", "docs://all", async () => {
45
+ const docs = docsCache || (docsCache = await downloadDocs());
46
+ return {
47
+ contents: docs.map(({ entryName, content }) => ({ uri: `docs://${entryName}`, text: content }))
48
+ };
49
+ });
50
+ var transport = new import_stdio.StdioServerTransport();
51
+ server.connect(transport);
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport AdmZip from 'adm-zip';\n\nasync function downloadDocs() {\n const res = await fetch('https://github.com/mantou132/gem/archive/refs/heads/main.zip');\n const buf = await res.arrayBuffer();\n const zip = new AdmZip(Buffer.from(buf));\n const zipEntries = zip.getEntries();\n return zipEntries\n .filter((entry) => entry.entryName.includes('packages/gem/docs/en') && entry.entryName.endsWith('.md'))\n .map((e) => ({\n entryName: e.entryName,\n content: zip.readAsText(e),\n }));\n}\n\nconst server = new McpServer({\n name: 'Gem',\n version: '0.0.1',\n});\n\nlet docsCache: Awaited<ReturnType<typeof downloadDocs>> | undefined;\nserver.resource('docs', 'docs://all', async () => {\n const docs = docsCache || (docsCache = await downloadDocs());\n return {\n contents: docs.map(({ entryName, content }) => ({ uri: `docs://${entryName}`, text: content })),\n };\n});\n\nconst transport = new StdioServerTransport();\nserver.connect(transport);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAA0B;AAC1B,mBAAqC;AACrC,qBAAmB;AAEnB,eAAe,eAAe;AAC5B,QAAM,MAAM,MAAM,MAAM,8DAA8D;AACtF,QAAM,MAAM,MAAM,IAAI,YAAY;AAClC,QAAM,MAAM,IAAI,eAAAA,QAAO,OAAO,KAAK,GAAG,CAAC;AACvC,QAAM,aAAa,IAAI,WAAW;AAClC,SAAO,WACJ,OAAO,CAAC,UAAU,MAAM,UAAU,SAAS,sBAAsB,KAAK,MAAM,UAAU,SAAS,KAAK,CAAC,EACrG,IAAI,CAAC,OAAO;AAAA,IACX,WAAW,EAAE;AAAA,IACb,SAAS,IAAI,WAAW,CAAC;AAAA,EAC3B,EAAE;AACN;AAEA,IAAM,SAAS,IAAI,qBAAU;AAAA,EAC3B,MAAM;AAAA,EACN,SAAS;AACX,CAAC;AAED,IAAI;AACJ,OAAO,SAAS,QAAQ,cAAc,YAAY;AAChD,QAAM,OAAO,cAAc,YAAY,MAAM,aAAa;AAC1D,SAAO;AAAA,IACL,UAAU,KAAK,IAAI,CAAC,EAAE,WAAW,QAAQ,OAAO,EAAE,KAAK,UAAU,SAAS,IAAI,MAAM,QAAQ,EAAE;AAAA,EAChG;AACF,CAAC;AAED,IAAM,YAAY,IAAI,kCAAqB;AAC3C,OAAO,QAAQ,SAAS;",
6
+ "names": ["AdmZip"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "gem-context-server",
3
+ "version": "0.0.1",
4
+ "description": "Model context server for Gem",
5
+ "keywords": [
6
+ "gem",
7
+ "MCP"
8
+ ],
9
+ "module": "src/index.ts",
10
+ "main": "src/index.ts",
11
+ "bin": "dist/index.js",
12
+ "files": [
13
+ "/dist/"
14
+ ],
15
+ "scripts": {
16
+ "prepublishOnly": "esbuild ./src/index.ts --outdir=./dist --platform=node --sourcemap --bundle --packages=external"
17
+ },
18
+ "dependencies": {
19
+ "adm-zip": "^0.5.16",
20
+ "@modelcontextprotocol/sdk": "^1.6.1"
21
+ },
22
+ "devDependencies": {
23
+ "@gemjs/config": "^2.1.0",
24
+ "@types/adm-zip": "^0.5.7"
25
+ },
26
+ "author": "mantou132",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/mantou132/gem.git",
31
+ "directory": "packages/context-server"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/mantou132/gem/issues"
35
+ },
36
+ "homepage": "https://github.com/mantou132/gem#readme"
37
+ }
package/src/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import AdmZip from 'adm-zip';
4
+
5
+ async function downloadDocs() {
6
+ const res = await fetch('https://github.com/mantou132/gem/archive/refs/heads/main.zip');
7
+ const buf = await res.arrayBuffer();
8
+ const zip = new AdmZip(Buffer.from(buf));
9
+ const zipEntries = zip.getEntries();
10
+ return zipEntries
11
+ .filter((entry) => entry.entryName.includes('packages/gem/docs/en') && entry.entryName.endsWith('.md'))
12
+ .map((e) => ({
13
+ entryName: e.entryName,
14
+ content: zip.readAsText(e),
15
+ }));
16
+ }
17
+
18
+ const server = new McpServer({
19
+ name: 'Gem',
20
+ version: '0.0.1',
21
+ });
22
+
23
+ let docsCache: Awaited<ReturnType<typeof downloadDocs>> | undefined;
24
+ server.resource('docs', 'docs://all', async () => {
25
+ const docs = docsCache || (docsCache = await downloadDocs());
26
+ return {
27
+ contents: docs.map(({ entryName, content }) => ({ uri: `docs://${entryName}`, text: content })),
28
+ };
29
+ });
30
+
31
+ const transport = new StdioServerTransport();
32
+ server.connect(transport);