frappe-mcp-server
Version:
Enhanced Model Context Protocol server for Frappe Framework with comprehensive API instructions and helper tools
117 lines (116 loc) • 3.27 kB
TypeScript
#!/usr/bin/env node
/**
* MCP Server Publisher Agent
*
* A specialized agent for NPM package publishing of MCP servers with proper workflow automation.
* Implements NPM best practices including version collision detection, proper versioning workflow,
* build validation, git integration, and comprehensive error handling.
*
* Features:
* - Pre-flight version collision detection
* - Proper NPM version workflow using `npm version`
* - Complete publication workflow with safety checks
* - Build validation and testing
* - Git integration with commits and tags
* - Error handling and rollback mechanisms
* - MCP server-specific validation
*/
interface PublishOptions {
versionType: 'patch' | 'minor' | 'major';
dryRun?: boolean;
skipTests?: boolean;
skipBuild?: boolean;
force?: boolean;
tag?: string;
customVersion?: string;
}
interface PublishResult {
success: boolean;
version?: string;
previousVersion?: string;
messages: string[];
errors: string[];
rollbackInstructions: string[];
}
export declare class MCPServerPublisher {
private projectRoot;
private packagePath;
private pkg;
constructor(projectRoot?: string);
/**
* Initialize the publisher by loading package.json
*/
initialize(): Promise<void>;
/**
* Check if a specific version already exists on NPM
*/
checkVersionExists(version: string, packageName?: string): Promise<boolean>;
/**
* Get the latest published version from NPM
*/
getLatestVersion(packageName?: string): Promise<string | null>;
/**
* Suggest the next available version based on version type
*/
suggestNextVersion(versionType: 'patch' | 'minor' | 'major'): Promise<string>;
/**
* Run pre-flight safety checks
*/
runPreflightChecks(): Promise<{
success: boolean;
messages: string[];
errors: string[];
}>;
/**
* Run build process
*/
runBuild(): Promise<{
success: boolean;
messages: string[];
errors: string[];
}>;
/**
* Run tests if available
*/
runTests(): Promise<{
success: boolean;
messages: string[];
errors: string[];
}>;
/**
* Update version using npm version command
*/
updateVersion(versionType: 'patch' | 'minor' | 'major', customVersion?: string): Promise<{
success: boolean;
version?: string;
messages: string[];
errors: string[];
}>;
/**
* Publish to NPM
*/
publishPackage(tag?: string): Promise<{
success: boolean;
messages: string[];
errors: string[];
}>;
/**
* Push git changes and tags
*/
pushGitChanges(): Promise<{
success: boolean;
messages: string[];
errors: string[];
}>;
/**
* Main publish workflow
*/
publish(options: PublishOptions): Promise<PublishResult>;
/**
* Command-line interface methods
*/
handleCheckVersion(version: string): Promise<void>;
handleSuggestVersion(): Promise<void>;
handlePublish(versionType: 'patch' | 'minor' | 'major', options?: Partial<PublishOptions>): Promise<void>;
}
export default MCPServerPublisher;