Skip to main content
Glama
SunZhi-Will

Website to Markdown MCP Server

by SunZhi-Will

list_configured_websites

Retrieve all websites configured for conversion to Markdown with AI-powered content cleanup and ad removal.

Instructions

List all configured websites

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler logic for the 'list_configured_websites' tool. It maps over the configured websites and formats them into a markdown list, returning it as tool content.
    if (name === 'list_configured_websites') {
      const websiteList = config.websites.map(site => 
        `- **${site.name}**: ${site.url}${site.description ? ` - ${site.description}` : ''}`
      ).join('\n');
    
      return {
        content: [
          {
            type: 'text',
            text: `# Configured Websites\n\n${websiteList}\n\nYou can:\n1. Ask any question directly, I will automatically search relevant websites\n2. Use \`fetch_website\` tool to fetch specific websites\n3. Use corresponding dedicated tools to fetch configured websites`
          }
        ]
      };
    }
  • src/index.ts:560-567 (registration)
    Registration of the 'list_configured_websites' tool in the ListToolsRequestSchema handler, including its schema (empty input).
    {
      name: 'list_configured_websites',
      description: 'List all configured websites',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    }
  • Zod schema for validating the configuration object that contains the list of websites used by the tool.
    const ConfigSchema = z.object({
      websites: z.array(z.object({
        name: z.string(),
        url: z.string().url(),
        description: z.string().optional()
      }))
    });
  • Helper function that loads the website configuration from environment variables, specified file, default file, or built-in defaults, and parses it using ConfigSchema.
    const getConfig = () => {
      // 1. First check environment variable specified config file path
      const configPath = process.env.WEBSITES_CONFIG_PATH;
      if (configPath) {
        try {
          let fullPath = configPath;
          // If relative path, relative to current working directory
          if (!configPath.startsWith('/') && !configPath.includes(':')) {
            fullPath = join(process.cwd(), configPath);
          }
          
          if (existsSync(fullPath)) {
            const configFile = readFileSync(fullPath, 'utf-8');
            const parsed = JSON.parse(configFile);
            console.error(`Loading configuration from specified file: ${fullPath}`);
            return ConfigSchema.parse(parsed);
          } else {
            console.error(`Specified configuration file does not exist: ${fullPath}`);
          }
        } catch (error) {
          console.error('Failed to read specified configuration file:', error);
        }
      }
    
      // 2. Try to get configuration from environment variables (backward compatibility)
      const configJson = process.env.WEBSITES_CONFIG;
      if (configJson) {
        try {
          const parsed = JSON.parse(configJson);
          console.error('Loading configuration from environment variable');
          return ConfigSchema.parse(parsed);
        } catch (error) {
          console.error('Environment variable configuration parsing error:', error);
        }
      }
    
      // 3. Try to read default config.json file
      const defaultConfigPath = join(__dirname, '..', 'config.json');
      if (existsSync(defaultConfigPath)) {
        try {
          const configFile = readFileSync(defaultConfigPath, 'utf-8');
          const parsed = JSON.parse(configFile);
          console.error(`Loading configuration from default file: ${defaultConfigPath}`);
          return ConfigSchema.parse(parsed);
        } catch (error) {
          console.error('Failed to read default configuration file:', error);
        }
      }
    
      // 4. Use built-in default configuration
      console.error('Using built-in default configuration');
      return {
        websites: [
          {
            name: "tailwind_css",
            url: "https://tailwindcss.com",
            description: "Tailwind CSS Official Website"
          },
          {
            name: "nextjs",
            url: "https://nextjs.org", 
            description: "Next.js Official Documentation"
          },
          {
            name: "react",
            url: "https://react.dev",
            description: "React Official Documentation"
          }
        ]
      };
    };

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/SunZhi-Will/website-to-markdown-mcp'

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