@dollhousemcp/mcp-server
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
460 lines • 12.6 kB
TypeScript
#!/usr/bin/env node
import { DollhouseContainer } from "./di/Container.js";
import type { IndicatorConfig } from "./config/indicator-config.js";
import type { IToolHandler } from "./server/index.js";
import type { EnsembleElement } from "./elements/ensembles/types.js";
export declare class DollhouseMCPServer implements IToolHandler {
private server;
personasDir: string | null;
private currentUser;
private isInitialized;
private initializationPromise;
private container;
private toolRegistry?;
private enhancedIndexHandler?;
private personaHandler?;
private elementCRUDHandler?;
private collectionHandler?;
private portfolioHandler?;
private githubAuthHandler?;
private displayConfigHandler?;
private identityHandler?;
private configHandler?;
private syncHandler?;
private resourceHandler?;
/**
* Create a new DollhouseMCPServer instance
*
* @param container DollhouseContainer instance for dependency injection.
* Use `new DollhouseContainer()` for production or
* `createIntegrationContainer().container` for tests.
*/
constructor(container: DollhouseContainer);
private initializePortfolio;
/**
* Complete initialization after portfolio is ready
* FIX #610: This was previously in a .then() callback in the constructor
* Now called synchronously from run() to prevent race condition
*/
private completeInitialization;
/**
* Initialize MCP Resources handlers if enabled in configuration
* This is separate from other handlers because it requires dynamic import
* and conditional registration based on configuration
*/
private initializeResourceHandlers;
/**
* Ensure server is initialized before any operation
* FIX #610: Added for test compatibility - tests don't call run()
*/
private ensureInitialized;
listPersonas(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
reloadPersonas(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
listElements(type: string): Promise<import("./services/query/AggregationService.js").AggregationResult | import("./handlers/element-crud/listElements.js").ListElementsResult | import("./handlers/element-crud/listElements.js").StructuredError | {
content: {
type: string;
text: string;
}[];
}>;
activateElement(name: string, type: string, context?: Record<string, any>): Promise<import("./handlers/strategies/ElementActivationStrategy.js").MCPResponse>;
getActiveElements(type: string): Promise<import("./handlers/strategies/ElementActivationStrategy.js").MCPResponse>;
deactivateElement(name: string, type: string): Promise<import("./handlers/strategies/ElementActivationStrategy.js").MCPResponse>;
getElementDetails(name: string, type: string): Promise<import("./handlers/strategies/ElementActivationStrategy.js").MCPResponse>;
reloadElements(type: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
renderTemplate(name: string, variables: Record<string, any>): Promise<{
content: {
type: string;
text: string;
}[];
}>;
executeAgent(name: string, parameters: Record<string, any>): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Create a new element in the portfolio.
* @param args.elements - For ensembles: array of element references (Issue #278)
*/
createElement(args: {
name: string;
type: string;
description: string;
content?: string;
instructions?: string;
metadata?: Record<string, unknown>;
elements?: EnsembleElement[];
}): Promise<import("./handlers/element-crud/responseFormatter.js").McpToolResponse | {
content: {
type: string;
text: string;
}[];
}>;
editElement(args: {
name: string;
type: string;
input: Record<string, unknown>;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
validateElement(args: {
name: string;
type: string;
strict?: boolean;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
deleteElement(args: {
name: string;
type: string;
deleteData?: boolean;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
browseCollection(section?: string, type?: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
searchCollection(query: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
searchCollectionEnhanced(query: string, options?: any): Promise<{
content: {
type: string;
text: string;
}[];
}>;
getCollectionContent(path: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
installContent(inputPath: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
submitContent(contentIdentifier: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
getCollectionCacheHealth(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
setUserIdentity(username: string, email?: string): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
getUserIdentity(): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
clearUserIdentity(): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
private getCurrentUserForAttribution;
setupGitHubAuth(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
checkGitHubAuth(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
getOAuthHelperStatus(verbose?: boolean): Promise<{
content: {
type: string;
text: string;
}[];
}>;
clearGitHubAuth(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
configureOAuth(client_id?: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Configure indicator settings (delegated to DisplayConfigHandler)
*/
configureIndicator(config: Partial<IndicatorConfig>): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
/**
* Get current indicator configuration (delegated to DisplayConfigHandler)
*/
getIndicatorConfig(): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
/**
* Configure collection submission settings (delegated to CollectionHandler)
*/
configureCollectionSubmission(autoSubmit: boolean): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Get collection submission configuration (delegated to CollectionHandler)
*/
getCollectionSubmissionConfig(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Export a single persona
*/
exportPersona(personaName: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Export all personas
*/
exportAllPersonas(includeDefaults?: boolean): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Import a persona
*/
importPersona(source: string, overwrite?: boolean): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Portfolio management methods
*/
/**
* Check portfolio status including repository existence and sync information
*/
portfolioStatus(username?: string): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Initialize a new GitHub portfolio repository
*/
initPortfolio(options: {
repositoryName?: string;
private?: boolean;
description?: string;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Configure portfolio settings
*/
portfolioConfig(options: {
autoSync?: boolean;
defaultVisibility?: string;
autoSubmit?: boolean;
repositoryName?: string;
}): Promise<{
content: {
type: string;
text: string;
}[];
data: {
config: {
autoSubmit: boolean;
repositoryName: string;
defaultVisibility: string;
};
};
} | {
content: {
type: string;
text: string;
}[];
data?: undefined;
}>;
/**
* Sync portfolio with GitHub
*/
syncPortfolio(options: {
direction: string;
mode?: string;
force: boolean;
dryRun: boolean;
confirmDeletions?: boolean;
}): Promise<import("./handlers/PortfolioPullHandler.js").PullResult>;
/**
* Handle configuration operations - delegates to ConfigHandler
*/
handleConfigOperation(options: any): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Handle sync operations - delegates to SyncHandler
*/
handleSyncOperation(options: any): Promise<{
content: {
type: string;
text: string;
}[];
}>;
dispose(): Promise<void>;
/**
* Search local portfolio using the metadata index system
* This provides fast, comprehensive search across all element types
*/
searchPortfolio(options: {
query: string;
elementType?: string;
fuzzyMatch?: boolean;
maxResults?: number;
includeKeywords?: boolean;
includeTags?: boolean;
includeTriggers?: boolean;
includeDescriptions?: boolean;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Search across all sources (local, GitHub, collection) using UnifiedIndexManager
* This provides comprehensive search with duplicate detection and version comparison
*/
searchAll(options: {
query: string;
sources?: string[];
elementType?: string;
page?: number;
pageSize?: number;
sortBy?: string;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Find semantically similar elements using Enhanced Index
*/
findSimilarElements(options: {
elementName: string;
elementType?: string;
limit: number;
threshold: number;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Get all relationships for a specific element
*/
getElementRelationships(options: {
elementName: string;
elementType?: string;
relationshipTypes?: string[];
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Search for elements by action verb
*/
searchByVerb(options: {
verb: string;
limit: number;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;
/**
* Get statistics about Enhanced Index relationships
*/
getRelationshipStats(): Promise<{
content: {
type: string;
text: string;
}[];
}>;
run(): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map