UNPKG

@hashgraphonline/standards-sdk

Version:

The Hashgraph Online Standards SDK provides a complete implementation of the Hashgraph Consensus Standards (HCS), giving developers all the tools needed to build applications on Hedera.

227 lines • 8.48 kB
import { MCPServerConfig, MCPServerVerification, MCPServerResource, MCPServerTool, MCPServerCapability, SocialPlatform, SocialLink } from './types'; import { NetworkType } from '../utils/types'; /** * MCPServerBuilder is a builder class for creating MCP server configurations. * It provides a fluent interface for setting various properties of the MCP server. * * Example usage: * ```typescript * const mcpBuilder = new MCPServerBuilder(); * mcpBuilder.setName('My MCP Server'); * mcpBuilder.setServerDescription('This is my MCP server for AI integration'); * mcpBuilder.setVersion('2024-06-01'); * mcpBuilder.setConnectionInfo('https://mcp.example.com', 'sse'); * mcpBuilder.setServices([MCPServerCapability.TOOL_PROVIDER, MCPServerCapability.API_INTEGRATION]); * mcpBuilder.setNetworkType('mainnet'); * mcpBuilder.addVerificationDNS('example.com', 'mcp-verify'); * const serverConfig = mcpBuilder.build(); * ``` */ export declare class MCPServerBuilder { private config; private socials; private logger; constructor(); /** * Sets the display name of the MCP server * * @param name The display name for the MCP server profile */ setName(name: string): this; /** * Sets the alias for the MCP server * * @param alias Alternative identifier for the MCP server */ setAlias(alias: string): this; /** * Sets the bio/description for the MCP server profile * * @param bio Brief description or biography for the MCP server */ setBio(bio: string): this; /** * @deprecated Use setBio instead */ setDescription(description: string): this; /** * Sets the version of the MCP server * * @param version The MCP server version (e.g., "2024-06-01") */ setVersion(version: string): this; /** * Sets the connection information for the MCP server * * @param url Base URL for the MCP server (e.g., "https://mcp.example.com") * @param transport Transport type ("stdio" or "sse") */ setConnectionInfo(url: string, transport: 'stdio' | 'sse'): this; /** * Sets the detailed description for the MCP server capabilities * * @param description Detailed description of server functionality */ setServerDescription(description: string): this; /** * Sets the services/capabilities provided by the MCP server * * @param services Array of service types offered by this MCP server */ setServices(services: MCPServerCapability[]): this; /** * Sets the minimum host version requirements * * @param minVersion Minimum host version required (e.g., "2024-11-05") */ setHostRequirements(minVersion?: string): this; /** * Sets the MCP capabilities supported by the server * * @param capabilities Array of capability strings (e.g., ["resources.get", "tools.invoke"]) */ setCapabilities(capabilities: string[]): this; /** * Adds a resource that the MCP server exposes * * @param name Resource name identifier (e.g., "hcs_topics") * @param description Human-readable description of the resource */ addResource(name: string, description: string): this; /** * Sets all resources the MCP server exposes (replaces existing resources) * * @param resources Array of resource objects with name and description */ setResources(resources: MCPServerResource[]): this; /** * Adds a tool that the MCP server provides * * @param name Tool name identifier (e.g., "topic_submit") * @param description Human-readable description of what the tool does */ addTool(name: string, description: string): this; /** * Sets all tools the MCP server provides (replaces existing tools) * * @param tools Array of tool objects with name and description */ setTools(tools: MCPServerTool[]): this; /** * Sets information about who maintains the MCP server * * @param maintainer Organization or entity maintaining this MCP server */ setMaintainer(maintainer: string): this; /** * Sets the URL to the source code repository * * @param repository URL to source code repository */ setRepository(repository: string): this; /** * Sets the URL to the server documentation * * @param docs URL to server documentation */ setDocs(docs: string): this; /** * Sets the verification information for the MCP server * * @param verification Complete verification object */ setVerification(verification: MCPServerVerification): this; /** * Adds DNS-based verification of endpoint ownership * * For DNS verification, the MCP server owner must add a DNS TXT record to their domain with: * - Name: By default, `_hedera` or a custom name specified in `dnsField` (automatically prefixed with `_`) * - Value: Equal to their Hedera account ID (e.g., `0.0.12345678`) * * Example DNS record: * ``` * _hedera.example.com. 3600 IN TXT "0.0.12345678" * ``` * * @param domain The fully qualified domain name to check (e.g., "example.com") * @param dnsField Optional custom DNS TXT record name (defaults to "hedera") */ addVerificationDNS(domain: string, dnsField?: string): this; /** * Adds signature-based verification of endpoint ownership * * For signature verification: * 1. The message to be signed must be the server URL exactly as it appears in the connectionInfo.url field * 2. The signature must be created using the ED25519 key associated with the Hedera account * 3. The signature must be encoded as a hexadecimal string with no `0x` prefix * * @param signature Hex-encoded ED25519 signature of the server URL */ addVerificationSignature(signature: string): this; /** * Adds challenge-based verification of endpoint ownership * * For challenge verification: * 1. The MCP server must expose an endpoint that responds to HTTP GET requests * 2. The endpoint path defaults to "/hedera-verification" or can be customized with challengePath * 3. The server must respond with a JSON object containing: * ```json * { * "accountId": "0.0.12345678", * "timestamp": 1620000000000, * "signature": "a1b2c3d4e5f6..." * } * ``` * 4. The signature must be an ED25519 signature of the UTF-8 encoded string `{accountId}:{timestamp}` * * @param challengePath Optional custom challenge endpoint path (defaults to "hedera-verification") */ addVerificationChallenge(challengePath?: string): this; /** * Adds a social media link to the profile * * @param platform Social media platform (e.g., "twitter", "github") * @param handle Username on the platform (e.g., "@username", "username") */ addSocial(platform: SocialPlatform, handle: string): this; /** * Sets all social media links for the profile (replaces existing links) * * @param socials Array of social media links */ setSocials(socials: SocialLink[]): this; /** * Sets the profile picture for the MCP server * * @param pfpBuffer Buffer containing the profile picture data * @param pfpFileName Filename for the profile picture including extension */ setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): this; /** * Sets a reference to an existing profile picture * * @param pfpTopicId Topic ID containing the profile picture (for reuse) */ setExistingProfilePicture(pfpTopicId: string): this; /** * Sets the network type (mainnet or testnet) * * @param network Network type ("mainnet" or "testnet") */ setNetworkType(network: NetworkType): this; /** * Sets an existing account to use for the MCP server * * @param accountId Hedera account ID (e.g., "0.0.12345678") * @param privateKey ED25519 private key as a string */ setExistingAccount(accountId: string, privateKey: string): this; /** * Builds and validates the MCP server configuration * * @returns Complete MCPServerConfig object ready for use * @throws Error if required fields are missing */ build(): MCPServerConfig; } //# sourceMappingURL=mcp-server-builder.d.ts.map