Skip to main content
Glama
dasein108

Cyb MCP Server

by dasein108

getCyberlink

Retrieve content from IPFS by CID through the Cyber gateway to access decentralized information stored on the network.

Instructions

Retrieve content from IPFS by CID through the Cyber gateway

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesIPFS CID to retrieve content for

Implementation Reference

  • The primary handler function for the 'getCyberlink' tool. Validates the CID input and fetches the content from IPFS via the Cyber gateway using the retrieveContentByCID helper. Handles errors and formats the response.
    private async handleGetCyberlink(args: { cid: string }) { try { if (!isValidCID(args.cid)) { return { content: [ { type: 'text', text: `Invalid CID format: ${args.cid}`, }, ], isError: true, }; } const contentItem = await this.retrieveContentByCID(args.cid); // Add CID info for text content if (contentItem.type === 'text' && contentItem.text && !contentItem.text.startsWith('Error')) { contentItem.text = `Content from CID: ${args.cid}\n\n${contentItem.text}`; } return { content: [contentItem], }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving content for CID ${args.cid}: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Input schema definition for the 'getCyberlink' tool, specifying a required 'cid' string parameter.
    inputSchema: { type: 'object', properties: { cid: { type: 'string', description: 'IPFS CID to retrieve content for', }, }, required: ['cid'], },
  • src/index.ts:118-131 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema.
    { name: 'getCyberlink', description: 'Retrieve content from IPFS by CID through the Cyber gateway', inputSchema: { type: 'object', properties: { cid: { type: 'string', description: 'IPFS CID to retrieve content for', }, }, required: ['cid'], }, },
  • src/index.ts:144-145 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handleGetCyberlink method.
    case 'getCyberlink': return await this.handleGetCyberlink(args as any);
  • Helper method used by getCyberlink to fetch and categorize content (text or image) from the Cyber gateway.
    private async retrieveContentByCID(cid: string): Promise<ContentItem> { try { const { content, mimeType, isImage } = await fetchContentFromGateway( this.config.cyberGateway, cid ); if (isImage) { return { type: 'image', data: content, // base64 encoded image data mimeType, }; } else { return { type: 'text', text: content, }; } } catch (error) { return { type: 'text', text: `Error retrieving content: ${error instanceof Error ? error.message : String(error)}`, }; }

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dasein108/cyb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server