Type-safe configuration schemas and builders for MCP (Model Context Protocol) clients.
npm install @gleanwork/mcp-config-schema
import { MCPConfigRegistry } from '@gleanwork/mcp-config-schema';
const registry = new MCPConfigRegistry();
// Create a configuration builder for a specific client
const builder = registry.createBuilder('cursor');
// Generate configuration
const config = builder.buildConfiguration({
mode: 'remote',
serverUrl: 'https://your-server.com/mcp/default',
serverName: 'my-server'
});
// Write configuration to the client's config file (Node.js only)
await builder.writeConfiguration({
mode: 'remote',
serverUrl: 'https://your-server.com/mcp/default',
serverName: 'my-server'
});
// Generate one-click install URL for supported clients (currently only Cursor)
const oneClickUrl = builder.buildOneClickUrl({
mode: 'remote',
serverUrl: 'https://your-server.com/mcp/default',
serverName: 'my-server'
});
// Returns: cursor://anysphere.cursor-deeplink/mcp/install?name=my-server&config=...
This package serves as the Single Source of Truth for MCP client configurations. It provides:
- Registry of all MCP clients and their capabilities
- Configuration builders that generate correct configs for each client
- Type-safe schemas with TypeScript types and Zod validation
- Browser support for web-based configuration tools
- Client detection to identify which clients need special handling
For detailed configuration examples and requirements for each client, see CLIENTS.md.
Client | Connection Type | Requires mcp-remote? | Platform |
---|---|---|---|
Claude Code | HTTP native | No | macOS |
Visual Studio Code | HTTP native | No | All |
Claude Desktop | stdio only | Yes (for HTTP) | macOS |
Cursor | stdio only | Yes (for HTTP) | All |
Goose | stdio only | Yes (for HTTP) | macOS, Linux |
Windsurf | stdio only | Yes (for HTTP) | All |
- ChatGPT - Requires web UI configuration
- Claude Desktop (Organization) - Managed by organization admins
Currently, only Cursor has documented one-click installation support:
Client | Protocol | Format |
---|---|---|
Cursor | cursor:// |
cursor://anysphere.cursor-deeplink/mcp/install?name=...&config=... |
Note: VSCode may support one-click installation in the future, but the format has not been documented yet.
import { MCPConfigRegistry } from '@gleanwork/mcp-config-schema';
const registry = new MCPConfigRegistry();
// Get client configuration
const cursorConfig = registry.getConfig('cursor');
console.log(cursorConfig.displayName); // "Cursor"
console.log(cursorConfig.requiresMcpRemoteForHttp); // true
// Query different client groups
const httpClients = registry.getNativeHttpClients();
const bridgeClients = registry.getBridgeRequiredClients();
const macClients = registry.getClientsByPlatform('darwin');
const builder = registry.createBuilder('claude-code');
// Remote server configuration
const remoteConfig = builder.buildConfiguration({
mode: 'remote',
serverUrl: 'https://api.example.com/mcp/default',
serverName: 'my-server'
});
// Local server configuration
const localConfig = builder.buildConfiguration({
mode: 'local',
instance: 'your-instance',
apiToken: 'your-api-token'
});
import { validateServerConfig, safeValidateServerConfig } from '@gleanwork/mcp-config-schema';
// Validate input configuration
const result = safeValidateServerConfig({
mode: 'remote',
serverUrl: 'https://your-server.com/mcp/default'
});
if (!result.success) {
console.error('Validation errors:', result.error.issues);
}
This package works in browsers! Use the /browser
import path:
// Browser-safe import
import { MCPConfigRegistry, ConfigBuilder } from '@gleanwork/mcp-config-schema/browser';
const registry = new MCPConfigRegistry();
const builder = registry.createBuilder('cursor');
// Generate configuration (works in browser)
const config = builder.buildConfiguration({
mode: 'remote',
serverUrl: 'https://your-server.com/mcp/default'
});
// Copy to clipboard
navigator.clipboard.writeText(config);
Note: File operations (writeConfiguration
, getConfigPath
) are not available in browsers and will throw clear error messages.
import React from 'react';
import { MCPConfigRegistry, ClientId } from '@gleanwork/mcp-config-schema/browser';
function MCPConfigGenerator() {
const registry = new MCPConfigRegistry();
const handleGenerateConfig = (clientId: ClientId, serverUrl: string) => {
const builder = registry.createBuilder(clientId);
const config = builder.buildConfiguration({
mode: 'remote',
serverUrl,
serverName: 'glean'
});
navigator.clipboard.writeText(config);
};
const clients = registry.getSupportedClients();
return (
<div>
{clients.map(client => (
<button
key={client.id}
onClick={() => handleGenerateConfig(client.id, 'https://api.example.com/mcp')}
>
Configure {client.displayName}
</button>
))}
</div>
);
}
📖 For complete configuration examples for all clients, see CLIENTS.md
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "https://your-server.com/mcp/default"
}
}
}
{
"mcpServers": {
"my-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-server.com/mcp/default"]
}
}
}
extensions:
my-server:
name: my-server
cmd: npx
args: ['-y', 'mcp-remote', 'https://your-server.com/mcp/default']
type: stdio
timeout: 300
enabled: true
Client | macOS | Linux | Windows |
---|---|---|---|
Claude Code | ~/.claude.json |
- | - |
VS Code | ~/Library/Application Support/Code/User/mcp.json |
~/.config/Code/User/mcp.json |
%APPDATA%\Code\User\mcp.json |
Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json |
- | - |
Cursor | ~/.cursor/mcp.json |
~/.cursor/mcp.json |
%USERPROFILE%\.cursor\mcp.json |
Goose | ~/.config/goose/config.yaml |
~/.config/goose/config.yaml |
- |
Windsurf | ~/.codeium/windsurf/mcp_config.json |
~/.codeium/windsurf/mcp_config.json |
%USERPROFILE%\.codeium\windsurf\mcp_config.json |
ClientId
- Union of all supported client identifiersMCPClientConfig
- Full client configuration schemaGleanServerConfig
- Server connection configurationPlatform
- 'darwin' | 'linux' | 'win32'LocalConfigSupport
- 'full' | 'none'ClientConnectionSupport
- 'http' | 'stdio-only' | 'both'
getConfig(clientId)
- Get configuration for a specific clientgetAllConfigs()
- Get all client configurationsgetSupportedClients()
- Get clients with local config supportgetNativeHttpClients()
- Get HTTP-native clientsgetBridgeRequiredClients()
- Get clients needing mcp-remotegetClientsByPlatform(platform)
- Get platform-specific clientscreateBuilder(clientId)
- Create a configuration builder
buildConfiguration(serverConfig)
- Generate configuration contentwriteConfiguration(serverConfig)
- Write config to file (Node.js only)getConfigPath()
- Get the config file path (Node.js only)
validateServerConfig(config)
- Validate server configuration (throws)safeValidateServerConfig(config)
- Safe validation (returns result)validateGeneratedConfig(config, clientId)
- Validate generated output
# Install dependencies
npm install
# Build the package
npm run build
# Run tests
npm run test
# Run all checks (lint, typecheck, test)
npm run test:all
# Generate documentation
npm run generate:docs
- CLIENTS.md - Comprehensive client compatibility matrix with detailed configuration examples
- API Reference - Complete API documentation
MIT - See LICENSE file for details
This package is part of the Glean MCP ecosystem. For issues and contributions, please visit the repository.