@gleanwork/mcp-config 0.5.0
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/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/index.cjs +141 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Glean Technologies Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @gleanwork/mcp-config
|
|
2
|
+
|
|
3
|
+
Glean-specific MCP configuration defaults and helpers. Wraps `@gleanwork/mcp-config-schema` with Glean-specific constants and convenience functions.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @gleanwork/mcp-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import {
|
|
17
|
+
createGleanRegistry,
|
|
18
|
+
createGleanEnv,
|
|
19
|
+
createGleanHeaders,
|
|
20
|
+
buildGleanServerUrl,
|
|
21
|
+
} from '@gleanwork/mcp-config';
|
|
22
|
+
|
|
23
|
+
// Create a pre-configured registry
|
|
24
|
+
const registry = createGleanRegistry();
|
|
25
|
+
const builder = registry.createBuilder('cursor');
|
|
26
|
+
|
|
27
|
+
// Generate stdio configuration
|
|
28
|
+
const stdioConfig = builder.buildConfiguration({
|
|
29
|
+
transport: 'stdio',
|
|
30
|
+
env: createGleanEnv('my-company', 'my-api-token'),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Generate HTTP configuration
|
|
34
|
+
const httpConfig = builder.buildConfiguration({
|
|
35
|
+
transport: 'http',
|
|
36
|
+
serverUrl: buildGleanServerUrl('my-company'),
|
|
37
|
+
headers: createGleanHeaders('my-api-token'),
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Available Exports
|
|
42
|
+
|
|
43
|
+
#### Constants
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { GLEAN_REGISTRY_OPTIONS, GLEAN_ENV } from '@gleanwork/mcp-config';
|
|
47
|
+
|
|
48
|
+
// Registry options for Glean MCP server
|
|
49
|
+
GLEAN_REGISTRY_OPTIONS.serverPackage // '@gleanwork/local-mcp-server'
|
|
50
|
+
GLEAN_REGISTRY_OPTIONS.commandBuilder // Functions to generate CLI commands
|
|
51
|
+
GLEAN_REGISTRY_OPTIONS.serverNameBuilder // Callback that prefixes server names with glean_
|
|
52
|
+
|
|
53
|
+
// Environment variable names
|
|
54
|
+
GLEAN_ENV.INSTANCE // 'GLEAN_INSTANCE'
|
|
55
|
+
GLEAN_ENV.URL // 'GLEAN_URL'
|
|
56
|
+
GLEAN_ENV.API_TOKEN // 'GLEAN_API_TOKEN'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Helper Functions
|
|
60
|
+
|
|
61
|
+
| Function | Description |
|
|
62
|
+
|----------|-------------|
|
|
63
|
+
| `createGleanRegistry()` | Create MCPConfigRegistry with Glean defaults |
|
|
64
|
+
| `createGleanEnv(instance, apiToken?)` | Create env vars using instance name |
|
|
65
|
+
| `createGleanUrlEnv(url, apiToken?)` | Create env vars using full URL |
|
|
66
|
+
| `createGleanHeaders(apiToken)` | Create Authorization header |
|
|
67
|
+
| `buildGleanServerUrl(instance, endpoint?)` | Build Glean MCP server URL |
|
|
68
|
+
| `normalizeGleanProductName(productName?)` | Normalize product name for white-labeling (defaults to 'glean') |
|
|
69
|
+
| `buildGleanServerName(options)` | Build server name with glean_ prefix |
|
|
70
|
+
| `normalizeGleanServerName(name, productName?)` | Normalize server name to safe config key with prefix |
|
|
71
|
+
|
|
72
|
+
#### Server Name Functions
|
|
73
|
+
|
|
74
|
+
These functions handle server name generation with proper prefixing:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import {
|
|
78
|
+
normalizeGleanProductName,
|
|
79
|
+
buildGleanServerName,
|
|
80
|
+
normalizeGleanServerName,
|
|
81
|
+
} from '@gleanwork/mcp-config';
|
|
82
|
+
|
|
83
|
+
// Normalize product names for white-labeling
|
|
84
|
+
normalizeGleanProductName(); // 'glean'
|
|
85
|
+
normalizeGleanProductName('Acme Corp'); // 'acme_corp'
|
|
86
|
+
|
|
87
|
+
// Build server names with glean_ prefix
|
|
88
|
+
buildGleanServerName({ transport: 'stdio' }); // 'glean_local'
|
|
89
|
+
buildGleanServerName({ transport: 'http' }); // 'glean_default'
|
|
90
|
+
buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'
|
|
91
|
+
buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'
|
|
92
|
+
buildGleanServerName({ agents: true }); // 'glean_agents'
|
|
93
|
+
|
|
94
|
+
// Normalize existing server names
|
|
95
|
+
normalizeGleanServerName('custom'); // 'glean_custom'
|
|
96
|
+
normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Types
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import type { GleanConnectionOptions, GleanEnvVars } from '@gleanwork/mcp-config';
|
|
103
|
+
|
|
104
|
+
// GleanConnectionOptions extends MCPConnectionOptions with:
|
|
105
|
+
// - productName?: string (for white-label support)
|
|
106
|
+
// - agents?: boolean (use agents endpoint)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Re-exports
|
|
110
|
+
|
|
111
|
+
This package re-exports everything from `@gleanwork/mcp-config-schema`, so you can import both Glean-specific and generic types from a single package:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import {
|
|
115
|
+
// Glean-specific
|
|
116
|
+
createGleanRegistry,
|
|
117
|
+
createGleanEnv,
|
|
118
|
+
GLEAN_ENV,
|
|
119
|
+
|
|
120
|
+
// From mcp-config-schema
|
|
121
|
+
MCPConfigRegistry,
|
|
122
|
+
type MCPConnectionOptions,
|
|
123
|
+
type ClientId,
|
|
124
|
+
} from '@gleanwork/mcp-config';
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
GLEAN_ENV: () => GLEAN_ENV,
|
|
25
|
+
GLEAN_REGISTRY_OPTIONS: () => GLEAN_REGISTRY_OPTIONS,
|
|
26
|
+
buildGleanServerName: () => buildGleanServerName,
|
|
27
|
+
buildGleanServerUrl: () => buildGleanServerUrl,
|
|
28
|
+
createGleanEnv: () => createGleanEnv,
|
|
29
|
+
createGleanHeaders: () => createGleanHeaders,
|
|
30
|
+
createGleanRegistry: () => createGleanRegistry,
|
|
31
|
+
createGleanUrlEnv: () => createGleanUrlEnv,
|
|
32
|
+
normalizeGleanProductName: () => normalizeGleanProductName,
|
|
33
|
+
normalizeGleanServerName: () => normalizeGleanServerName
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_mcp_config_schema = require("@gleanwork/mcp-config-schema");
|
|
37
|
+
__reExport(index_exports, require("@gleanwork/mcp-config-schema"), module.exports);
|
|
38
|
+
var GLEAN_REGISTRY_OPTIONS = {
|
|
39
|
+
serverPackage: "@gleanwork/local-mcp-server",
|
|
40
|
+
commandBuilder: {
|
|
41
|
+
http: (clientId, options) => {
|
|
42
|
+
if (!options.serverUrl) return null;
|
|
43
|
+
return `npx -y @gleanwork/configure-mcp-server remote --url ${options.serverUrl} --client ${clientId}`;
|
|
44
|
+
},
|
|
45
|
+
stdio: (clientId, options) => {
|
|
46
|
+
const envFlags = Object.entries(options.env || {}).map(([k, v]) => `--env ${k}=${v}`).join(" ");
|
|
47
|
+
return `npx -y @gleanwork/configure-mcp-server local --client ${clientId}${envFlags ? ` ${envFlags}` : ""}`;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
serverNameBuilder: (options) => {
|
|
51
|
+
return buildGleanServerName(options);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var GLEAN_ENV = {
|
|
55
|
+
/** Environment variable for Glean instance name (e.g., 'my-company') */
|
|
56
|
+
INSTANCE: "GLEAN_INSTANCE",
|
|
57
|
+
/** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */
|
|
58
|
+
URL: "GLEAN_URL",
|
|
59
|
+
/** Environment variable for Glean API token */
|
|
60
|
+
API_TOKEN: "GLEAN_API_TOKEN"
|
|
61
|
+
};
|
|
62
|
+
function createGleanEnv(instance, apiToken) {
|
|
63
|
+
return {
|
|
64
|
+
[GLEAN_ENV.INSTANCE]: instance,
|
|
65
|
+
...apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createGleanUrlEnv(url, apiToken) {
|
|
69
|
+
return {
|
|
70
|
+
[GLEAN_ENV.URL]: url,
|
|
71
|
+
...apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function createGleanHeaders(apiToken) {
|
|
75
|
+
return {
|
|
76
|
+
Authorization: `Bearer ${apiToken}`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function createGleanRegistry() {
|
|
80
|
+
return new import_mcp_config_schema.MCPConfigRegistry(GLEAN_REGISTRY_OPTIONS);
|
|
81
|
+
}
|
|
82
|
+
function buildGleanServerUrl(instance, endpoint = "default") {
|
|
83
|
+
return `https://${instance}-be.glean.com/mcp/${endpoint}`;
|
|
84
|
+
}
|
|
85
|
+
function normalizeGleanProductName(productName) {
|
|
86
|
+
if (!productName) {
|
|
87
|
+
return "glean";
|
|
88
|
+
}
|
|
89
|
+
const normalized = productName.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
90
|
+
return normalized || "glean";
|
|
91
|
+
}
|
|
92
|
+
function buildGleanServerName(options) {
|
|
93
|
+
const productPrefix = normalizeGleanProductName(options.productName);
|
|
94
|
+
if (options.serverName) {
|
|
95
|
+
if (options.serverName === productPrefix || options.serverName.startsWith(`${productPrefix}_`)) {
|
|
96
|
+
return options.serverName;
|
|
97
|
+
}
|
|
98
|
+
return `${productPrefix}_${options.serverName}`;
|
|
99
|
+
}
|
|
100
|
+
if (options.agents) {
|
|
101
|
+
return `${productPrefix}_agents`;
|
|
102
|
+
}
|
|
103
|
+
const baseName = (0, import_mcp_config_schema.buildMcpServerName)({
|
|
104
|
+
transport: options.transport,
|
|
105
|
+
serverUrl: options.serverUrl
|
|
106
|
+
});
|
|
107
|
+
if (baseName === "default" && !options.transport && !options.serverUrl) {
|
|
108
|
+
return productPrefix;
|
|
109
|
+
}
|
|
110
|
+
return `${productPrefix}_${baseName}`;
|
|
111
|
+
}
|
|
112
|
+
function normalizeGleanServerName(name, productName) {
|
|
113
|
+
const productPrefix = normalizeGleanProductName(productName);
|
|
114
|
+
if (!name) {
|
|
115
|
+
return productPrefix;
|
|
116
|
+
}
|
|
117
|
+
const lowerName = name.toLowerCase();
|
|
118
|
+
if (lowerName === productPrefix || lowerName.startsWith(`${productPrefix}_`)) {
|
|
119
|
+
return lowerName;
|
|
120
|
+
}
|
|
121
|
+
if (lowerName.startsWith(productPrefix) && lowerName.length > productPrefix.length) {
|
|
122
|
+
const rest = lowerName.slice(productPrefix.length);
|
|
123
|
+
return `${productPrefix}_${rest}`;
|
|
124
|
+
}
|
|
125
|
+
return `${productPrefix}_${lowerName}`;
|
|
126
|
+
}
|
|
127
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
+
0 && (module.exports = {
|
|
129
|
+
GLEAN_ENV,
|
|
130
|
+
GLEAN_REGISTRY_OPTIONS,
|
|
131
|
+
buildGleanServerName,
|
|
132
|
+
buildGleanServerUrl,
|
|
133
|
+
createGleanEnv,
|
|
134
|
+
createGleanHeaders,
|
|
135
|
+
createGleanRegistry,
|
|
136
|
+
createGleanUrlEnv,
|
|
137
|
+
normalizeGleanProductName,
|
|
138
|
+
normalizeGleanServerName,
|
|
139
|
+
...require("@gleanwork/mcp-config-schema")
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n MCPConfigRegistry,\n buildMcpServerName as buildMcpServerNameBase,\n type MCPConnectionOptions,\n type RegistryOptions,\n} from '@gleanwork/mcp-config-schema';\n\n// Re-export everything from the base package for convenience\nexport * from '@gleanwork/mcp-config-schema';\n\n/**\n * Glean-specific registry options for stdio transport.\n */\nexport const GLEAN_REGISTRY_OPTIONS: RegistryOptions = {\n serverPackage: '@gleanwork/local-mcp-server',\n commandBuilder: {\n http: (clientId, options) => {\n if (!options.serverUrl) return null;\n return `npx -y @gleanwork/configure-mcp-server remote --url ${options.serverUrl} --client ${clientId}`;\n },\n stdio: (clientId, options) => {\n const envFlags = Object.entries(options.env || {})\n .map(([k, v]) => `--env ${k}=${v}`)\n .join(' ');\n return `npx -y @gleanwork/configure-mcp-server local --client ${clientId}${envFlags ? ` ${envFlags}` : ''}`;\n },\n },\n serverNameBuilder: (options) => {\n // Lazily call buildGleanServerName defined below\n return buildGleanServerName(options);\n },\n};\n\n/**\n * Glean environment variable names.\n */\nexport const GLEAN_ENV = {\n /** Environment variable for Glean instance name (e.g., 'my-company') */\n INSTANCE: 'GLEAN_INSTANCE',\n /** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */\n URL: 'GLEAN_URL',\n /** Environment variable for Glean API token */\n API_TOKEN: 'GLEAN_API_TOKEN',\n} as const;\n\n/**\n * Helper to create Glean environment variables for stdio transport.\n *\n * @param instance - Glean instance name (e.g., 'my-company')\n * @param apiToken - Optional API token\n * @returns Environment variables object for use in MCPConnectionOptions.env\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanEnv('my-company', 'my-api-token'),\n * });\n * ```\n */\nexport function createGleanEnv(instance: string, apiToken?: string): Record<string, string> {\n return {\n [GLEAN_ENV.INSTANCE]: instance,\n ...(apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }),\n };\n}\n\n/**\n * Helper to create Glean environment variables using a full URL.\n *\n * @param url - Full Glean URL (e.g., 'https://my-company.glean.com')\n * @param apiToken - Optional API token\n * @returns Environment variables object for use in MCPConnectionOptions.env\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanUrlEnv('https://my-company.glean.com', 'my-api-token'),\n * });\n * ```\n */\nexport function createGleanUrlEnv(url: string, apiToken?: string): Record<string, string> {\n return {\n [GLEAN_ENV.URL]: url,\n ...(apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }),\n };\n}\n\n/**\n * Helper to create Glean authorization headers for HTTP transport.\n *\n * @param apiToken - Glean API token\n * @returns Headers object for use in MCPConnectionOptions.headers\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'http',\n * serverUrl: 'https://my-company-be.glean.com/mcp/default',\n * headers: createGleanHeaders('my-api-token'),\n * });\n * ```\n */\nexport function createGleanHeaders(apiToken: string): Record<string, string> {\n return {\n Authorization: `Bearer ${apiToken}`,\n };\n}\n\n/**\n * Create an MCPConfigRegistry pre-configured with Glean defaults.\n *\n * @returns MCPConfigRegistry configured for Glean stdio transport\n *\n * @example\n * ```typescript\n * const registry = createGleanRegistry();\n * const builder = registry.createBuilder('cursor');\n *\n * // For stdio transport\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanEnv('my-company', 'my-api-token'),\n * });\n *\n * // For HTTP transport\n * const httpConfig = builder.buildConfiguration({\n * transport: 'http',\n * serverUrl: 'https://my-company-be.glean.com/mcp/default',\n * headers: createGleanHeaders('my-api-token'),\n * });\n * ```\n */\nexport function createGleanRegistry(): MCPConfigRegistry {\n return new MCPConfigRegistry(GLEAN_REGISTRY_OPTIONS);\n}\n\n/**\n * Build the Glean MCP server URL from an instance name.\n *\n * @param instance - Glean instance name (e.g., 'my-company')\n * @param endpoint - MCP endpoint (default: 'default')\n * @returns Full Glean MCP server URL\n *\n * @example\n * ```typescript\n * const url = buildGleanServerUrl('my-company');\n * // Returns: 'https://my-company-be.glean.com/mcp/default'\n *\n * const customUrl = buildGleanServerUrl('my-company', 'custom');\n * // Returns: 'https://my-company-be.glean.com/mcp/custom'\n * ```\n */\nexport function buildGleanServerUrl(instance: string, endpoint: string = 'default'): string {\n return `https://${instance}-be.glean.com/mcp/${endpoint}`;\n}\n\n// Type helpers for Glean-specific usage\nexport type GleanEnvVars = {\n [GLEAN_ENV.INSTANCE]?: string;\n [GLEAN_ENV.URL]?: string;\n [GLEAN_ENV.API_TOKEN]?: string;\n};\n\n/**\n * Options for Glean-specific connection configuration.\n * Extends MCPConnectionOptions with Glean-specific properties.\n */\nexport interface GleanConnectionOptions extends MCPConnectionOptions {\n /** Product name for white-label support (e.g., 'Glean', 'Acme Platform') */\n productName?: string;\n /** Use agents endpoint instead of default */\n agents?: boolean;\n}\n\n/**\n * Normalize a product name to a safe identifier.\n * Used for white-label support in Glean configurations.\n *\n * @param productName - Product name (e.g., 'Glean', 'Acme Platform')\n * @returns Normalized product name (e.g., 'glean', 'acme_platform')\n *\n * @example\n * ```typescript\n * normalizeGleanProductName('Glean'); // 'glean'\n * normalizeGleanProductName('Acme Platform'); // 'acme_platform'\n * normalizeGleanProductName('My-Product'); // 'my_product'\n * ```\n */\nexport function normalizeGleanProductName(productName?: string): string {\n if (!productName) {\n return 'glean';\n }\n const normalized = productName\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_|_$/g, '');\n return normalized || 'glean';\n}\n\n/**\n * Build a Glean-prefixed server name for MCP configurations.\n * Wraps the vendor-neutral buildMcpServerName with Glean-specific prefixing.\n *\n * Rules:\n * - If explicit serverName is provided and already has the product prefix, use it directly\n * - If explicit serverName is provided without prefix, add the product prefix\n * - If agents flag is set, return '{product}_agents'\n * - For stdio transport: '{product}_local'\n * - For http transport with URL: '{product}_{extracted-name}'\n * - Fallback: '{product}'\n *\n * @param options - Server name options\n * @returns Prefixed server name (e.g., 'glean_local', 'acme_analytics')\n *\n * @example\n * ```typescript\n * buildGleanServerName({ transport: 'stdio' }); // 'glean_local'\n * buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'\n * buildGleanServerName({ transport: 'stdio', productName: 'Acme' }); // 'acme_local'\n * buildGleanServerName({ agents: true }); // 'glean_agents'\n * buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'\n * ```\n */\nexport function buildGleanServerName(options: {\n transport?: 'stdio' | 'http';\n serverUrl?: string;\n serverName?: string;\n productName?: string;\n agents?: boolean;\n}): string {\n const productPrefix = normalizeGleanProductName(options.productName);\n\n // Handle explicit serverName\n if (options.serverName) {\n // If it already has the correct prefix, use it directly\n if (\n options.serverName === productPrefix ||\n options.serverName.startsWith(`${productPrefix}_`)\n ) {\n return options.serverName;\n }\n return `${productPrefix}_${options.serverName}`;\n }\n\n // Handle agents mode\n if (options.agents) {\n return `${productPrefix}_agents`;\n }\n\n // Get base name from vendor-neutral function\n const baseName = buildMcpServerNameBase({\n transport: options.transport,\n serverUrl: options.serverUrl,\n });\n\n // If baseName is 'default' and we have no specific info, just return the product prefix\n if (baseName === 'default' && !options.transport && !options.serverUrl) {\n return productPrefix;\n }\n\n return `${productPrefix}_${baseName}`;\n}\n\n/**\n * Normalize a server name with Glean product prefix.\n * Ensures the server name has the correct product prefix and is safe for use as a configuration key.\n *\n * @param name - Server name to normalize\n * @param productName - Optional product name for white-label support\n * @returns Normalized server name with product prefix\n *\n * @example\n * ```typescript\n * normalizeGleanServerName('custom'); // 'glean_custom'\n * normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)\n * normalizeGleanServerName('custom', 'acme'); // 'acme_custom'\n * ```\n */\nexport function normalizeGleanServerName(name: string, productName?: string): string {\n const productPrefix = normalizeGleanProductName(productName);\n\n if (!name) {\n return productPrefix;\n }\n\n const lowerName = name.toLowerCase();\n\n // If it already starts with the prefix, return as-is\n if (lowerName === productPrefix || lowerName.startsWith(`${productPrefix}_`)) {\n return lowerName;\n }\n\n // Handle case where name starts with just the product (e.g., 'gleancustom' -> 'glean_custom')\n if (lowerName.startsWith(productPrefix) && lowerName.length > productPrefix.length) {\n const rest = lowerName.slice(productPrefix.length);\n return `${productPrefix}_${rest}`;\n }\n\n return `${productPrefix}_${lowerName}`;\n}\n"],"mappings":"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","names":["buildMcpServerNameBase"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { RegistryOptions, MCPConfigRegistry, MCPConnectionOptions } from '@gleanwork/mcp-config-schema';
|
|
2
|
+
export * from '@gleanwork/mcp-config-schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Glean-specific registry options for stdio transport.
|
|
6
|
+
*/
|
|
7
|
+
declare const GLEAN_REGISTRY_OPTIONS: RegistryOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Glean environment variable names.
|
|
10
|
+
*/
|
|
11
|
+
declare const GLEAN_ENV: {
|
|
12
|
+
/** Environment variable for Glean instance name (e.g., 'my-company') */
|
|
13
|
+
readonly INSTANCE: "GLEAN_INSTANCE";
|
|
14
|
+
/** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */
|
|
15
|
+
readonly URL: "GLEAN_URL";
|
|
16
|
+
/** Environment variable for Glean API token */
|
|
17
|
+
readonly API_TOKEN: "GLEAN_API_TOKEN";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Helper to create Glean environment variables for stdio transport.
|
|
21
|
+
*
|
|
22
|
+
* @param instance - Glean instance name (e.g., 'my-company')
|
|
23
|
+
* @param apiToken - Optional API token
|
|
24
|
+
* @returns Environment variables object for use in MCPConnectionOptions.env
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const config = builder.buildConfiguration({
|
|
29
|
+
* transport: 'stdio',
|
|
30
|
+
* env: createGleanEnv('my-company', 'my-api-token'),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function createGleanEnv(instance: string, apiToken?: string): Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Helper to create Glean environment variables using a full URL.
|
|
37
|
+
*
|
|
38
|
+
* @param url - Full Glean URL (e.g., 'https://my-company.glean.com')
|
|
39
|
+
* @param apiToken - Optional API token
|
|
40
|
+
* @returns Environment variables object for use in MCPConnectionOptions.env
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const config = builder.buildConfiguration({
|
|
45
|
+
* transport: 'stdio',
|
|
46
|
+
* env: createGleanUrlEnv('https://my-company.glean.com', 'my-api-token'),
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function createGleanUrlEnv(url: string, apiToken?: string): Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Helper to create Glean authorization headers for HTTP transport.
|
|
53
|
+
*
|
|
54
|
+
* @param apiToken - Glean API token
|
|
55
|
+
* @returns Headers object for use in MCPConnectionOptions.headers
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const config = builder.buildConfiguration({
|
|
60
|
+
* transport: 'http',
|
|
61
|
+
* serverUrl: 'https://my-company-be.glean.com/mcp/default',
|
|
62
|
+
* headers: createGleanHeaders('my-api-token'),
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function createGleanHeaders(apiToken: string): Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Create an MCPConfigRegistry pre-configured with Glean defaults.
|
|
69
|
+
*
|
|
70
|
+
* @returns MCPConfigRegistry configured for Glean stdio transport
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const registry = createGleanRegistry();
|
|
75
|
+
* const builder = registry.createBuilder('cursor');
|
|
76
|
+
*
|
|
77
|
+
* // For stdio transport
|
|
78
|
+
* const config = builder.buildConfiguration({
|
|
79
|
+
* transport: 'stdio',
|
|
80
|
+
* env: createGleanEnv('my-company', 'my-api-token'),
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // For HTTP transport
|
|
84
|
+
* const httpConfig = builder.buildConfiguration({
|
|
85
|
+
* transport: 'http',
|
|
86
|
+
* serverUrl: 'https://my-company-be.glean.com/mcp/default',
|
|
87
|
+
* headers: createGleanHeaders('my-api-token'),
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function createGleanRegistry(): MCPConfigRegistry;
|
|
92
|
+
/**
|
|
93
|
+
* Build the Glean MCP server URL from an instance name.
|
|
94
|
+
*
|
|
95
|
+
* @param instance - Glean instance name (e.g., 'my-company')
|
|
96
|
+
* @param endpoint - MCP endpoint (default: 'default')
|
|
97
|
+
* @returns Full Glean MCP server URL
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const url = buildGleanServerUrl('my-company');
|
|
102
|
+
* // Returns: 'https://my-company-be.glean.com/mcp/default'
|
|
103
|
+
*
|
|
104
|
+
* const customUrl = buildGleanServerUrl('my-company', 'custom');
|
|
105
|
+
* // Returns: 'https://my-company-be.glean.com/mcp/custom'
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function buildGleanServerUrl(instance: string, endpoint?: string): string;
|
|
109
|
+
type GleanEnvVars = {
|
|
110
|
+
[GLEAN_ENV.INSTANCE]?: string;
|
|
111
|
+
[GLEAN_ENV.URL]?: string;
|
|
112
|
+
[GLEAN_ENV.API_TOKEN]?: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Options for Glean-specific connection configuration.
|
|
116
|
+
* Extends MCPConnectionOptions with Glean-specific properties.
|
|
117
|
+
*/
|
|
118
|
+
interface GleanConnectionOptions extends MCPConnectionOptions {
|
|
119
|
+
/** Product name for white-label support (e.g., 'Glean', 'Acme Platform') */
|
|
120
|
+
productName?: string;
|
|
121
|
+
/** Use agents endpoint instead of default */
|
|
122
|
+
agents?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Normalize a product name to a safe identifier.
|
|
126
|
+
* Used for white-label support in Glean configurations.
|
|
127
|
+
*
|
|
128
|
+
* @param productName - Product name (e.g., 'Glean', 'Acme Platform')
|
|
129
|
+
* @returns Normalized product name (e.g., 'glean', 'acme_platform')
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* normalizeGleanProductName('Glean'); // 'glean'
|
|
134
|
+
* normalizeGleanProductName('Acme Platform'); // 'acme_platform'
|
|
135
|
+
* normalizeGleanProductName('My-Product'); // 'my_product'
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
declare function normalizeGleanProductName(productName?: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* Build a Glean-prefixed server name for MCP configurations.
|
|
141
|
+
* Wraps the vendor-neutral buildMcpServerName with Glean-specific prefixing.
|
|
142
|
+
*
|
|
143
|
+
* Rules:
|
|
144
|
+
* - If explicit serverName is provided and already has the product prefix, use it directly
|
|
145
|
+
* - If explicit serverName is provided without prefix, add the product prefix
|
|
146
|
+
* - If agents flag is set, return '{product}_agents'
|
|
147
|
+
* - For stdio transport: '{product}_local'
|
|
148
|
+
* - For http transport with URL: '{product}_{extracted-name}'
|
|
149
|
+
* - Fallback: '{product}'
|
|
150
|
+
*
|
|
151
|
+
* @param options - Server name options
|
|
152
|
+
* @returns Prefixed server name (e.g., 'glean_local', 'acme_analytics')
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* buildGleanServerName({ transport: 'stdio' }); // 'glean_local'
|
|
157
|
+
* buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'
|
|
158
|
+
* buildGleanServerName({ transport: 'stdio', productName: 'Acme' }); // 'acme_local'
|
|
159
|
+
* buildGleanServerName({ agents: true }); // 'glean_agents'
|
|
160
|
+
* buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function buildGleanServerName(options: {
|
|
164
|
+
transport?: 'stdio' | 'http';
|
|
165
|
+
serverUrl?: string;
|
|
166
|
+
serverName?: string;
|
|
167
|
+
productName?: string;
|
|
168
|
+
agents?: boolean;
|
|
169
|
+
}): string;
|
|
170
|
+
/**
|
|
171
|
+
* Normalize a server name with Glean product prefix.
|
|
172
|
+
* Ensures the server name has the correct product prefix and is safe for use as a configuration key.
|
|
173
|
+
*
|
|
174
|
+
* @param name - Server name to normalize
|
|
175
|
+
* @param productName - Optional product name for white-label support
|
|
176
|
+
* @returns Normalized server name with product prefix
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* normalizeGleanServerName('custom'); // 'glean_custom'
|
|
181
|
+
* normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)
|
|
182
|
+
* normalizeGleanServerName('custom', 'acme'); // 'acme_custom'
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function normalizeGleanServerName(name: string, productName?: string): string;
|
|
186
|
+
|
|
187
|
+
export { GLEAN_ENV, GLEAN_REGISTRY_OPTIONS, type GleanConnectionOptions, type GleanEnvVars, buildGleanServerName, buildGleanServerUrl, createGleanEnv, createGleanHeaders, createGleanRegistry, createGleanUrlEnv, normalizeGleanProductName, normalizeGleanServerName };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { RegistryOptions, MCPConfigRegistry, MCPConnectionOptions } from '@gleanwork/mcp-config-schema';
|
|
2
|
+
export * from '@gleanwork/mcp-config-schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Glean-specific registry options for stdio transport.
|
|
6
|
+
*/
|
|
7
|
+
declare const GLEAN_REGISTRY_OPTIONS: RegistryOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Glean environment variable names.
|
|
10
|
+
*/
|
|
11
|
+
declare const GLEAN_ENV: {
|
|
12
|
+
/** Environment variable for Glean instance name (e.g., 'my-company') */
|
|
13
|
+
readonly INSTANCE: "GLEAN_INSTANCE";
|
|
14
|
+
/** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */
|
|
15
|
+
readonly URL: "GLEAN_URL";
|
|
16
|
+
/** Environment variable for Glean API token */
|
|
17
|
+
readonly API_TOKEN: "GLEAN_API_TOKEN";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Helper to create Glean environment variables for stdio transport.
|
|
21
|
+
*
|
|
22
|
+
* @param instance - Glean instance name (e.g., 'my-company')
|
|
23
|
+
* @param apiToken - Optional API token
|
|
24
|
+
* @returns Environment variables object for use in MCPConnectionOptions.env
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const config = builder.buildConfiguration({
|
|
29
|
+
* transport: 'stdio',
|
|
30
|
+
* env: createGleanEnv('my-company', 'my-api-token'),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function createGleanEnv(instance: string, apiToken?: string): Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Helper to create Glean environment variables using a full URL.
|
|
37
|
+
*
|
|
38
|
+
* @param url - Full Glean URL (e.g., 'https://my-company.glean.com')
|
|
39
|
+
* @param apiToken - Optional API token
|
|
40
|
+
* @returns Environment variables object for use in MCPConnectionOptions.env
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const config = builder.buildConfiguration({
|
|
45
|
+
* transport: 'stdio',
|
|
46
|
+
* env: createGleanUrlEnv('https://my-company.glean.com', 'my-api-token'),
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function createGleanUrlEnv(url: string, apiToken?: string): Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Helper to create Glean authorization headers for HTTP transport.
|
|
53
|
+
*
|
|
54
|
+
* @param apiToken - Glean API token
|
|
55
|
+
* @returns Headers object for use in MCPConnectionOptions.headers
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const config = builder.buildConfiguration({
|
|
60
|
+
* transport: 'http',
|
|
61
|
+
* serverUrl: 'https://my-company-be.glean.com/mcp/default',
|
|
62
|
+
* headers: createGleanHeaders('my-api-token'),
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function createGleanHeaders(apiToken: string): Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Create an MCPConfigRegistry pre-configured with Glean defaults.
|
|
69
|
+
*
|
|
70
|
+
* @returns MCPConfigRegistry configured for Glean stdio transport
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const registry = createGleanRegistry();
|
|
75
|
+
* const builder = registry.createBuilder('cursor');
|
|
76
|
+
*
|
|
77
|
+
* // For stdio transport
|
|
78
|
+
* const config = builder.buildConfiguration({
|
|
79
|
+
* transport: 'stdio',
|
|
80
|
+
* env: createGleanEnv('my-company', 'my-api-token'),
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // For HTTP transport
|
|
84
|
+
* const httpConfig = builder.buildConfiguration({
|
|
85
|
+
* transport: 'http',
|
|
86
|
+
* serverUrl: 'https://my-company-be.glean.com/mcp/default',
|
|
87
|
+
* headers: createGleanHeaders('my-api-token'),
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function createGleanRegistry(): MCPConfigRegistry;
|
|
92
|
+
/**
|
|
93
|
+
* Build the Glean MCP server URL from an instance name.
|
|
94
|
+
*
|
|
95
|
+
* @param instance - Glean instance name (e.g., 'my-company')
|
|
96
|
+
* @param endpoint - MCP endpoint (default: 'default')
|
|
97
|
+
* @returns Full Glean MCP server URL
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const url = buildGleanServerUrl('my-company');
|
|
102
|
+
* // Returns: 'https://my-company-be.glean.com/mcp/default'
|
|
103
|
+
*
|
|
104
|
+
* const customUrl = buildGleanServerUrl('my-company', 'custom');
|
|
105
|
+
* // Returns: 'https://my-company-be.glean.com/mcp/custom'
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function buildGleanServerUrl(instance: string, endpoint?: string): string;
|
|
109
|
+
type GleanEnvVars = {
|
|
110
|
+
[GLEAN_ENV.INSTANCE]?: string;
|
|
111
|
+
[GLEAN_ENV.URL]?: string;
|
|
112
|
+
[GLEAN_ENV.API_TOKEN]?: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Options for Glean-specific connection configuration.
|
|
116
|
+
* Extends MCPConnectionOptions with Glean-specific properties.
|
|
117
|
+
*/
|
|
118
|
+
interface GleanConnectionOptions extends MCPConnectionOptions {
|
|
119
|
+
/** Product name for white-label support (e.g., 'Glean', 'Acme Platform') */
|
|
120
|
+
productName?: string;
|
|
121
|
+
/** Use agents endpoint instead of default */
|
|
122
|
+
agents?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Normalize a product name to a safe identifier.
|
|
126
|
+
* Used for white-label support in Glean configurations.
|
|
127
|
+
*
|
|
128
|
+
* @param productName - Product name (e.g., 'Glean', 'Acme Platform')
|
|
129
|
+
* @returns Normalized product name (e.g., 'glean', 'acme_platform')
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* normalizeGleanProductName('Glean'); // 'glean'
|
|
134
|
+
* normalizeGleanProductName('Acme Platform'); // 'acme_platform'
|
|
135
|
+
* normalizeGleanProductName('My-Product'); // 'my_product'
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
declare function normalizeGleanProductName(productName?: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* Build a Glean-prefixed server name for MCP configurations.
|
|
141
|
+
* Wraps the vendor-neutral buildMcpServerName with Glean-specific prefixing.
|
|
142
|
+
*
|
|
143
|
+
* Rules:
|
|
144
|
+
* - If explicit serverName is provided and already has the product prefix, use it directly
|
|
145
|
+
* - If explicit serverName is provided without prefix, add the product prefix
|
|
146
|
+
* - If agents flag is set, return '{product}_agents'
|
|
147
|
+
* - For stdio transport: '{product}_local'
|
|
148
|
+
* - For http transport with URL: '{product}_{extracted-name}'
|
|
149
|
+
* - Fallback: '{product}'
|
|
150
|
+
*
|
|
151
|
+
* @param options - Server name options
|
|
152
|
+
* @returns Prefixed server name (e.g., 'glean_local', 'acme_analytics')
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* buildGleanServerName({ transport: 'stdio' }); // 'glean_local'
|
|
157
|
+
* buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'
|
|
158
|
+
* buildGleanServerName({ transport: 'stdio', productName: 'Acme' }); // 'acme_local'
|
|
159
|
+
* buildGleanServerName({ agents: true }); // 'glean_agents'
|
|
160
|
+
* buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function buildGleanServerName(options: {
|
|
164
|
+
transport?: 'stdio' | 'http';
|
|
165
|
+
serverUrl?: string;
|
|
166
|
+
serverName?: string;
|
|
167
|
+
productName?: string;
|
|
168
|
+
agents?: boolean;
|
|
169
|
+
}): string;
|
|
170
|
+
/**
|
|
171
|
+
* Normalize a server name with Glean product prefix.
|
|
172
|
+
* Ensures the server name has the correct product prefix and is safe for use as a configuration key.
|
|
173
|
+
*
|
|
174
|
+
* @param name - Server name to normalize
|
|
175
|
+
* @param productName - Optional product name for white-label support
|
|
176
|
+
* @returns Normalized server name with product prefix
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* normalizeGleanServerName('custom'); // 'glean_custom'
|
|
181
|
+
* normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)
|
|
182
|
+
* normalizeGleanServerName('custom', 'acme'); // 'acme_custom'
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function normalizeGleanServerName(name: string, productName?: string): string;
|
|
186
|
+
|
|
187
|
+
export { GLEAN_ENV, GLEAN_REGISTRY_OPTIONS, type GleanConnectionOptions, type GleanEnvVars, buildGleanServerName, buildGleanServerUrl, createGleanEnv, createGleanHeaders, createGleanRegistry, createGleanUrlEnv, normalizeGleanProductName, normalizeGleanServerName };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
MCPConfigRegistry,
|
|
4
|
+
buildMcpServerName as buildMcpServerNameBase
|
|
5
|
+
} from "@gleanwork/mcp-config-schema";
|
|
6
|
+
export * from "@gleanwork/mcp-config-schema";
|
|
7
|
+
var GLEAN_REGISTRY_OPTIONS = {
|
|
8
|
+
serverPackage: "@gleanwork/local-mcp-server",
|
|
9
|
+
commandBuilder: {
|
|
10
|
+
http: (clientId, options) => {
|
|
11
|
+
if (!options.serverUrl) return null;
|
|
12
|
+
return `npx -y @gleanwork/configure-mcp-server remote --url ${options.serverUrl} --client ${clientId}`;
|
|
13
|
+
},
|
|
14
|
+
stdio: (clientId, options) => {
|
|
15
|
+
const envFlags = Object.entries(options.env || {}).map(([k, v]) => `--env ${k}=${v}`).join(" ");
|
|
16
|
+
return `npx -y @gleanwork/configure-mcp-server local --client ${clientId}${envFlags ? ` ${envFlags}` : ""}`;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
serverNameBuilder: (options) => {
|
|
20
|
+
return buildGleanServerName(options);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var GLEAN_ENV = {
|
|
24
|
+
/** Environment variable for Glean instance name (e.g., 'my-company') */
|
|
25
|
+
INSTANCE: "GLEAN_INSTANCE",
|
|
26
|
+
/** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */
|
|
27
|
+
URL: "GLEAN_URL",
|
|
28
|
+
/** Environment variable for Glean API token */
|
|
29
|
+
API_TOKEN: "GLEAN_API_TOKEN"
|
|
30
|
+
};
|
|
31
|
+
function createGleanEnv(instance, apiToken) {
|
|
32
|
+
return {
|
|
33
|
+
[GLEAN_ENV.INSTANCE]: instance,
|
|
34
|
+
...apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createGleanUrlEnv(url, apiToken) {
|
|
38
|
+
return {
|
|
39
|
+
[GLEAN_ENV.URL]: url,
|
|
40
|
+
...apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function createGleanHeaders(apiToken) {
|
|
44
|
+
return {
|
|
45
|
+
Authorization: `Bearer ${apiToken}`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createGleanRegistry() {
|
|
49
|
+
return new MCPConfigRegistry(GLEAN_REGISTRY_OPTIONS);
|
|
50
|
+
}
|
|
51
|
+
function buildGleanServerUrl(instance, endpoint = "default") {
|
|
52
|
+
return `https://${instance}-be.glean.com/mcp/${endpoint}`;
|
|
53
|
+
}
|
|
54
|
+
function normalizeGleanProductName(productName) {
|
|
55
|
+
if (!productName) {
|
|
56
|
+
return "glean";
|
|
57
|
+
}
|
|
58
|
+
const normalized = productName.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
59
|
+
return normalized || "glean";
|
|
60
|
+
}
|
|
61
|
+
function buildGleanServerName(options) {
|
|
62
|
+
const productPrefix = normalizeGleanProductName(options.productName);
|
|
63
|
+
if (options.serverName) {
|
|
64
|
+
if (options.serverName === productPrefix || options.serverName.startsWith(`${productPrefix}_`)) {
|
|
65
|
+
return options.serverName;
|
|
66
|
+
}
|
|
67
|
+
return `${productPrefix}_${options.serverName}`;
|
|
68
|
+
}
|
|
69
|
+
if (options.agents) {
|
|
70
|
+
return `${productPrefix}_agents`;
|
|
71
|
+
}
|
|
72
|
+
const baseName = buildMcpServerNameBase({
|
|
73
|
+
transport: options.transport,
|
|
74
|
+
serverUrl: options.serverUrl
|
|
75
|
+
});
|
|
76
|
+
if (baseName === "default" && !options.transport && !options.serverUrl) {
|
|
77
|
+
return productPrefix;
|
|
78
|
+
}
|
|
79
|
+
return `${productPrefix}_${baseName}`;
|
|
80
|
+
}
|
|
81
|
+
function normalizeGleanServerName(name, productName) {
|
|
82
|
+
const productPrefix = normalizeGleanProductName(productName);
|
|
83
|
+
if (!name) {
|
|
84
|
+
return productPrefix;
|
|
85
|
+
}
|
|
86
|
+
const lowerName = name.toLowerCase();
|
|
87
|
+
if (lowerName === productPrefix || lowerName.startsWith(`${productPrefix}_`)) {
|
|
88
|
+
return lowerName;
|
|
89
|
+
}
|
|
90
|
+
if (lowerName.startsWith(productPrefix) && lowerName.length > productPrefix.length) {
|
|
91
|
+
const rest = lowerName.slice(productPrefix.length);
|
|
92
|
+
return `${productPrefix}_${rest}`;
|
|
93
|
+
}
|
|
94
|
+
return `${productPrefix}_${lowerName}`;
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
GLEAN_ENV,
|
|
98
|
+
GLEAN_REGISTRY_OPTIONS,
|
|
99
|
+
buildGleanServerName,
|
|
100
|
+
buildGleanServerUrl,
|
|
101
|
+
createGleanEnv,
|
|
102
|
+
createGleanHeaders,
|
|
103
|
+
createGleanRegistry,
|
|
104
|
+
createGleanUrlEnv,
|
|
105
|
+
normalizeGleanProductName,
|
|
106
|
+
normalizeGleanServerName
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n MCPConfigRegistry,\n buildMcpServerName as buildMcpServerNameBase,\n type MCPConnectionOptions,\n type RegistryOptions,\n} from '@gleanwork/mcp-config-schema';\n\n// Re-export everything from the base package for convenience\nexport * from '@gleanwork/mcp-config-schema';\n\n/**\n * Glean-specific registry options for stdio transport.\n */\nexport const GLEAN_REGISTRY_OPTIONS: RegistryOptions = {\n serverPackage: '@gleanwork/local-mcp-server',\n commandBuilder: {\n http: (clientId, options) => {\n if (!options.serverUrl) return null;\n return `npx -y @gleanwork/configure-mcp-server remote --url ${options.serverUrl} --client ${clientId}`;\n },\n stdio: (clientId, options) => {\n const envFlags = Object.entries(options.env || {})\n .map(([k, v]) => `--env ${k}=${v}`)\n .join(' ');\n return `npx -y @gleanwork/configure-mcp-server local --client ${clientId}${envFlags ? ` ${envFlags}` : ''}`;\n },\n },\n serverNameBuilder: (options) => {\n // Lazily call buildGleanServerName defined below\n return buildGleanServerName(options);\n },\n};\n\n/**\n * Glean environment variable names.\n */\nexport const GLEAN_ENV = {\n /** Environment variable for Glean instance name (e.g., 'my-company') */\n INSTANCE: 'GLEAN_INSTANCE',\n /** Environment variable for full Glean URL (e.g., 'https://my-company.glean.com') */\n URL: 'GLEAN_URL',\n /** Environment variable for Glean API token */\n API_TOKEN: 'GLEAN_API_TOKEN',\n} as const;\n\n/**\n * Helper to create Glean environment variables for stdio transport.\n *\n * @param instance - Glean instance name (e.g., 'my-company')\n * @param apiToken - Optional API token\n * @returns Environment variables object for use in MCPConnectionOptions.env\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanEnv('my-company', 'my-api-token'),\n * });\n * ```\n */\nexport function createGleanEnv(instance: string, apiToken?: string): Record<string, string> {\n return {\n [GLEAN_ENV.INSTANCE]: instance,\n ...(apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }),\n };\n}\n\n/**\n * Helper to create Glean environment variables using a full URL.\n *\n * @param url - Full Glean URL (e.g., 'https://my-company.glean.com')\n * @param apiToken - Optional API token\n * @returns Environment variables object for use in MCPConnectionOptions.env\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanUrlEnv('https://my-company.glean.com', 'my-api-token'),\n * });\n * ```\n */\nexport function createGleanUrlEnv(url: string, apiToken?: string): Record<string, string> {\n return {\n [GLEAN_ENV.URL]: url,\n ...(apiToken && { [GLEAN_ENV.API_TOKEN]: apiToken }),\n };\n}\n\n/**\n * Helper to create Glean authorization headers for HTTP transport.\n *\n * @param apiToken - Glean API token\n * @returns Headers object for use in MCPConnectionOptions.headers\n *\n * @example\n * ```typescript\n * const config = builder.buildConfiguration({\n * transport: 'http',\n * serverUrl: 'https://my-company-be.glean.com/mcp/default',\n * headers: createGleanHeaders('my-api-token'),\n * });\n * ```\n */\nexport function createGleanHeaders(apiToken: string): Record<string, string> {\n return {\n Authorization: `Bearer ${apiToken}`,\n };\n}\n\n/**\n * Create an MCPConfigRegistry pre-configured with Glean defaults.\n *\n * @returns MCPConfigRegistry configured for Glean stdio transport\n *\n * @example\n * ```typescript\n * const registry = createGleanRegistry();\n * const builder = registry.createBuilder('cursor');\n *\n * // For stdio transport\n * const config = builder.buildConfiguration({\n * transport: 'stdio',\n * env: createGleanEnv('my-company', 'my-api-token'),\n * });\n *\n * // For HTTP transport\n * const httpConfig = builder.buildConfiguration({\n * transport: 'http',\n * serverUrl: 'https://my-company-be.glean.com/mcp/default',\n * headers: createGleanHeaders('my-api-token'),\n * });\n * ```\n */\nexport function createGleanRegistry(): MCPConfigRegistry {\n return new MCPConfigRegistry(GLEAN_REGISTRY_OPTIONS);\n}\n\n/**\n * Build the Glean MCP server URL from an instance name.\n *\n * @param instance - Glean instance name (e.g., 'my-company')\n * @param endpoint - MCP endpoint (default: 'default')\n * @returns Full Glean MCP server URL\n *\n * @example\n * ```typescript\n * const url = buildGleanServerUrl('my-company');\n * // Returns: 'https://my-company-be.glean.com/mcp/default'\n *\n * const customUrl = buildGleanServerUrl('my-company', 'custom');\n * // Returns: 'https://my-company-be.glean.com/mcp/custom'\n * ```\n */\nexport function buildGleanServerUrl(instance: string, endpoint: string = 'default'): string {\n return `https://${instance}-be.glean.com/mcp/${endpoint}`;\n}\n\n// Type helpers for Glean-specific usage\nexport type GleanEnvVars = {\n [GLEAN_ENV.INSTANCE]?: string;\n [GLEAN_ENV.URL]?: string;\n [GLEAN_ENV.API_TOKEN]?: string;\n};\n\n/**\n * Options for Glean-specific connection configuration.\n * Extends MCPConnectionOptions with Glean-specific properties.\n */\nexport interface GleanConnectionOptions extends MCPConnectionOptions {\n /** Product name for white-label support (e.g., 'Glean', 'Acme Platform') */\n productName?: string;\n /** Use agents endpoint instead of default */\n agents?: boolean;\n}\n\n/**\n * Normalize a product name to a safe identifier.\n * Used for white-label support in Glean configurations.\n *\n * @param productName - Product name (e.g., 'Glean', 'Acme Platform')\n * @returns Normalized product name (e.g., 'glean', 'acme_platform')\n *\n * @example\n * ```typescript\n * normalizeGleanProductName('Glean'); // 'glean'\n * normalizeGleanProductName('Acme Platform'); // 'acme_platform'\n * normalizeGleanProductName('My-Product'); // 'my_product'\n * ```\n */\nexport function normalizeGleanProductName(productName?: string): string {\n if (!productName) {\n return 'glean';\n }\n const normalized = productName\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_|_$/g, '');\n return normalized || 'glean';\n}\n\n/**\n * Build a Glean-prefixed server name for MCP configurations.\n * Wraps the vendor-neutral buildMcpServerName with Glean-specific prefixing.\n *\n * Rules:\n * - If explicit serverName is provided and already has the product prefix, use it directly\n * - If explicit serverName is provided without prefix, add the product prefix\n * - If agents flag is set, return '{product}_agents'\n * - For stdio transport: '{product}_local'\n * - For http transport with URL: '{product}_{extracted-name}'\n * - Fallback: '{product}'\n *\n * @param options - Server name options\n * @returns Prefixed server name (e.g., 'glean_local', 'acme_analytics')\n *\n * @example\n * ```typescript\n * buildGleanServerName({ transport: 'stdio' }); // 'glean_local'\n * buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'\n * buildGleanServerName({ transport: 'stdio', productName: 'Acme' }); // 'acme_local'\n * buildGleanServerName({ agents: true }); // 'glean_agents'\n * buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'\n * ```\n */\nexport function buildGleanServerName(options: {\n transport?: 'stdio' | 'http';\n serverUrl?: string;\n serverName?: string;\n productName?: string;\n agents?: boolean;\n}): string {\n const productPrefix = normalizeGleanProductName(options.productName);\n\n // Handle explicit serverName\n if (options.serverName) {\n // If it already has the correct prefix, use it directly\n if (\n options.serverName === productPrefix ||\n options.serverName.startsWith(`${productPrefix}_`)\n ) {\n return options.serverName;\n }\n return `${productPrefix}_${options.serverName}`;\n }\n\n // Handle agents mode\n if (options.agents) {\n return `${productPrefix}_agents`;\n }\n\n // Get base name from vendor-neutral function\n const baseName = buildMcpServerNameBase({\n transport: options.transport,\n serverUrl: options.serverUrl,\n });\n\n // If baseName is 'default' and we have no specific info, just return the product prefix\n if (baseName === 'default' && !options.transport && !options.serverUrl) {\n return productPrefix;\n }\n\n return `${productPrefix}_${baseName}`;\n}\n\n/**\n * Normalize a server name with Glean product prefix.\n * Ensures the server name has the correct product prefix and is safe for use as a configuration key.\n *\n * @param name - Server name to normalize\n * @param productName - Optional product name for white-label support\n * @returns Normalized server name with product prefix\n *\n * @example\n * ```typescript\n * normalizeGleanServerName('custom'); // 'glean_custom'\n * normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)\n * normalizeGleanServerName('custom', 'acme'); // 'acme_custom'\n * ```\n */\nexport function normalizeGleanServerName(name: string, productName?: string): string {\n const productPrefix = normalizeGleanProductName(productName);\n\n if (!name) {\n return productPrefix;\n }\n\n const lowerName = name.toLowerCase();\n\n // If it already starts with the prefix, return as-is\n if (lowerName === productPrefix || lowerName.startsWith(`${productPrefix}_`)) {\n return lowerName;\n }\n\n // Handle case where name starts with just the product (e.g., 'gleancustom' -> 'glean_custom')\n if (lowerName.startsWith(productPrefix) && lowerName.length > productPrefix.length) {\n const rest = lowerName.slice(productPrefix.length);\n return `${productPrefix}_${rest}`;\n }\n\n return `${productPrefix}_${lowerName}`;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,sBAAsB;AAAA,OAGjB;AAGP,cAAc;AAKP,IAAM,yBAA0C;AAAA,EACrD,eAAe;AAAA,EACf,gBAAgB;AAAA,IACd,MAAM,CAAC,UAAU,YAAY;AAC3B,UAAI,CAAC,QAAQ,UAAW,QAAO;AAC/B,aAAO,uDAAuD,QAAQ,SAAS,aAAa,QAAQ;AAAA,IACtG;AAAA,IACA,OAAO,CAAC,UAAU,YAAY;AAC5B,YAAM,WAAW,OAAO,QAAQ,QAAQ,OAAO,CAAC,CAAC,EAC9C,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,EACjC,KAAK,GAAG;AACX,aAAO,yDAAyD,QAAQ,GAAG,WAAW,IAAI,QAAQ,KAAK,EAAE;AAAA,IAC3G;AAAA,EACF;AAAA,EACA,mBAAmB,CAAC,YAAY;AAE9B,WAAO,qBAAqB,OAAO;AAAA,EACrC;AACF;AAKO,IAAM,YAAY;AAAA;AAAA,EAEvB,UAAU;AAAA;AAAA,EAEV,KAAK;AAAA;AAAA,EAEL,WAAW;AACb;AAiBO,SAAS,eAAe,UAAkB,UAA2C;AAC1F,SAAO;AAAA,IACL,CAAC,UAAU,QAAQ,GAAG;AAAA,IACtB,GAAI,YAAY,EAAE,CAAC,UAAU,SAAS,GAAG,SAAS;AAAA,EACpD;AACF;AAiBO,SAAS,kBAAkB,KAAa,UAA2C;AACxF,SAAO;AAAA,IACL,CAAC,UAAU,GAAG,GAAG;AAAA,IACjB,GAAI,YAAY,EAAE,CAAC,UAAU,SAAS,GAAG,SAAS;AAAA,EACpD;AACF;AAiBO,SAAS,mBAAmB,UAA0C;AAC3E,SAAO;AAAA,IACL,eAAe,UAAU,QAAQ;AAAA,EACnC;AACF;AA0BO,SAAS,sBAAyC;AACvD,SAAO,IAAI,kBAAkB,sBAAsB;AACrD;AAkBO,SAAS,oBAAoB,UAAkB,WAAmB,WAAmB;AAC1F,SAAO,WAAW,QAAQ,qBAAqB,QAAQ;AACzD;AAkCO,SAAS,0BAA0B,aAA8B;AACtE,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,QAAM,aAAa,YAChB,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,OAAO,GAAG,EAClB,QAAQ,UAAU,EAAE;AACvB,SAAO,cAAc;AACvB;AA0BO,SAAS,qBAAqB,SAM1B;AACT,QAAM,gBAAgB,0BAA0B,QAAQ,WAAW;AAGnE,MAAI,QAAQ,YAAY;AAEtB,QACE,QAAQ,eAAe,iBACvB,QAAQ,WAAW,WAAW,GAAG,aAAa,GAAG,GACjD;AACA,aAAO,QAAQ;AAAA,IACjB;AACA,WAAO,GAAG,aAAa,IAAI,QAAQ,UAAU;AAAA,EAC/C;AAGA,MAAI,QAAQ,QAAQ;AAClB,WAAO,GAAG,aAAa;AAAA,EACzB;AAGA,QAAM,WAAW,uBAAuB;AAAA,IACtC,WAAW,QAAQ;AAAA,IACnB,WAAW,QAAQ;AAAA,EACrB,CAAC;AAGD,MAAI,aAAa,aAAa,CAAC,QAAQ,aAAa,CAAC,QAAQ,WAAW;AACtE,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,aAAa,IAAI,QAAQ;AACrC;AAiBO,SAAS,yBAAyB,MAAc,aAA8B;AACnF,QAAM,gBAAgB,0BAA0B,WAAW;AAE3D,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,KAAK,YAAY;AAGnC,MAAI,cAAc,iBAAiB,UAAU,WAAW,GAAG,aAAa,GAAG,GAAG;AAC5E,WAAO;AAAA,EACT;AAGA,MAAI,UAAU,WAAW,aAAa,KAAK,UAAU,SAAS,cAAc,QAAQ;AAClF,UAAM,OAAO,UAAU,MAAM,cAAc,MAAM;AACjD,WAAO,GAAG,aAAa,IAAI,IAAI;AAAA,EACjC;AAEA,SAAO,GAAG,aAAa,IAAI,SAAS;AACtC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gleanwork/mcp-config",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Glean-specific MCP configuration defaults and helpers",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"glean",
|
|
8
|
+
"configuration"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@github.com:gleanwork/mcp-config.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Glean",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"lint": "npm-run-all --sequential lint:*",
|
|
35
|
+
"lint:eslint": "eslint src --ext ts --fix",
|
|
36
|
+
"lint:package-json": "sort-package-json",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:all": "npm run lint && npm run typecheck && npm run test",
|
|
39
|
+
"format": "prettier --write '**/*.ts'",
|
|
40
|
+
"prepublishOnly": "npm run build"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@gleanwork/mcp-config-schema": "^3.0.0-beta.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
47
|
+
"@eslint/js": "^9.39.2",
|
|
48
|
+
"@types/node": "^22.15.21",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
51
|
+
"eslint": "^9.28.0",
|
|
52
|
+
"eslint-config-prettier": "^10.1.8",
|
|
53
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
54
|
+
"globals": "^17.0.0",
|
|
55
|
+
"npm-run-all": "^4.1.5",
|
|
56
|
+
"prettier": "^3.7.4",
|
|
57
|
+
"sort-package-json": "^3.6.0",
|
|
58
|
+
"tsup": "^8.5.0",
|
|
59
|
+
"typescript": "^5.8.3",
|
|
60
|
+
"vitest": "^4.0.0"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"registry": "https://registry.npmjs.org"
|
|
68
|
+
}
|
|
69
|
+
}
|