@ gleanwork/ mcp- 配置- glean
Glean- specific MCP 配置默认和帮助. 环绕 @gleanwork/mcp-config-schema 具有 Glean 特定常数和方便功能.
安装
npm install @gleanwork/mcp-config-glean
使用量
快速启动
import {
createGleanRegistry,
createGleanHeaders,
buildGleanMcpUrl,
} from '@gleanwork/mcp-config-glean';
// Create a pre-configured registry (remote / HTTP only)
const registry = createGleanRegistry();
const builder = registry.createBuilder('cursor');
// Generate HTTP configuration
const httpConfig = builder.buildConfiguration({
transport: 'http',
serverUrl: buildGleanMcpUrl('https://my-company-be.glean.com'),
headers: createGleanHeaders('my-api-token'),
});
// Pin the CLI version in generated install commands
const command = builder.buildCommand({
transport: 'http',
serverUrl: buildGleanMcpUrl('https://my-company-be.glean.com'),
headers: createGleanHeaders('my-api-token'),
cliVersion: '3.1.0',
});
// -> `npx -y @gleanwork/[email protected] remote --url ... --client cursor --token ...`
可用出口
常数
import { GLEAN_REGISTRY_OPTIONS, GLEAN_ENV } from '@gleanwork/mcp-config-glean';
// Registry options for Glean's remote MCP server (HTTP only)
GLEAN_REGISTRY_OPTIONS.tokenEnvVarName // 'GLEAN_API_TOKEN'
GLEAN_REGISTRY_OPTIONS.commandBuilder // Functions to generate CLI commands
GLEAN_REGISTRY_OPTIONS.serverNameBuilder // Callback that prefixes server names with glean_
GLEAN_REGISTRY_OPTIONS.managedSetupUrls // Admin setup destinations for managed clients
// Environment variable names
GLEAN_ENV.SERVER_URL // 'GLEAN_SERVER_URL'
GLEAN_ENV.API_TOKEN // 'GLEAN_API_TOKEN'
清册为ChatGPT提供管理下的设置目的地, 克劳德团队/企业和光标团队:
const registry = createGleanRegistry();
registry.getManagedSetupUrl('chatgpt');
// https://chatgpt.com/admin/apps?tab=available&q=glean
registry.getManagedSetupUrl('claude-teams-enterprise');
// https://claude.ai/directory/connectors/glean
registry.getManagedSetupUrl('cursor-team');
// https://cursor.com/dashboard/integrations
帮助函数
| 函数 | 说明 |
|---|---|
createGleanRegistry() | 创建带有 Glean 默认的 MCPConfig Registry |
createGleanServerUrlEnv(serverUrl, apiToken?) | 使用服务器 URL 创建 Env vars |
buildGleanMcpUrl(serverUrl, endpoint?) | 从服务器 URL 构建完整的 MCP 端点 URL |
createGleanHeaders(apiToken) | 创建授权页眉 |
normalizeGleanProductName(productName?) | 规范白标签产品名称( 默认为“ glean ”) |
buildGleanServerName(options) | 用 glean 前缀构建服务器名 |
normalizeGleanServerName(name, productName?) | 将服务器名称规范化为带有前缀的安全配置密钥 |
服务器名称函数
这些函数处理服务器名生成, 并带有适当的前缀 :
import {
normalizeGleanProductName,
buildGleanServerName,
normalizeGleanServerName,
} from '@gleanwork/mcp-config-glean';
// Normalize product names for white-labeling
normalizeGleanProductName(); // 'glean'
normalizeGleanProductName('Acme Corp'); // 'acme_corp'
// Build server names with glean_ prefix
buildGleanServerName({ transport: 'http' }); // 'glean_default'
buildGleanServerName({ transport: 'http', serverUrl: '.../mcp/analytics' }); // 'glean_analytics'
buildGleanServerName({ serverName: 'custom' }); // 'glean_custom'
buildGleanServerName({ agents: true }); // 'glean_agents'
// Normalize existing server names
normalizeGleanServerName('custom'); // 'glean_custom'
normalizeGleanServerName('glean_custom'); // 'glean_custom' (no double prefix)
类型
import type { GleanConnectionOptions, GleanEnvVars } from '@gleanwork/mcp-config-glean';
// GleanConnectionOptions extends MCPConnectionOptions with:
// - productName?: string (for white-label support)
// - agents?: boolean (use agents endpoint)
再出口
此软件包将全部从 @gleanwork/mcp-config-schema,这样您就可以从单个软件包中导入 Glean 特定类型和通用类型:
import {
// Glean-specific
createGleanRegistry,
createGleanServerUrlEnv,
GLEAN_ENV,
// From mcp-config-schema
MCPConfigRegistry,
type MCPConnectionOptions,
type ClientId,
} from '@gleanwork/mcp-config-glean';
从 @gleanwork/ mcp- config 迁移
如果你是从长者迁徙过来 @gleanwork/mcp-config 软件包 :
-
更新您的软件包。 json :
- "@gleanwork/mcp-config": "^3.x" + "@gleanwork/mcp-config-glean": "^4.x" -
更新您的导入 :
- import { ... } from '@gleanwork/mcp-config'; + import { ... } from '@gleanwork/mcp-config-glean';
API是完全相容的 - 在导入路径之外不需要更改代码 .
相关软件包
- @gleanwork/mcp-config-schema (英语) - 有核心类型和建造商的供应商中立基包
许可证
麻省理工学院