Skip to main content
Glama
chatmcp

mcp-server-collector

by chatmcp

extract-mcp-servers-from-url

Extract MCP servers from a specified URL to collect and organize server information from web sources.

Instructions

Extract MCP Servers from a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • Main tool handler function (@server.call_tool()). For 'extract-mcp-servers-from-url', fetches content from URL via helper, then extracts MCP servers using shared logic and returns as text.
    @server.call_tool()
    async def handle_call_tool(
        name: str, arguments: dict | None
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        if not arguments:
            raise ValueError("Missing arguments")
    
        content = None
        
        match name:
            case "extract-mcp-servers-from-url":
                url = arguments.get("url")
                if not url:
                    raise ValueError("Missing url")
    
                content = await call_fetch_tool(url)
                
            case "extract-mcp-servers-from-content":
                content = arguments.get("content")
                
            case "submit-mcp-server":
                url = arguments.get("url")
                avatar_url = arguments.get("avatar_url") or ""
                result = await submit_mcp_server(url, avatar_url)
                content = json.dumps(result)
    
                return [
                    types.TextContent(
                        type="text",
                        text=content,
                    )
                ]
            case _:
                raise ValueError(f"Unknown tool: {name}")
    
        if not content:
            raise ValueError("Missing content")
    
        logger.info(f"Fetched content from {url}: {content}")
    
        mcp_servers = await extract_mcp_servers_from_content(content)
        if not mcp_servers:
            raise ValueError("Extracted no MCP Servers")
    
        logger.info(f"Extracted MCP Servers from {url}: {mcp_servers}")
    
        return [
            types.TextContent(
                type="text",
                text=mcp_servers,
            )
        ]   
  • Input schema definition for 'extract-mcp-servers-from-url' tool: requires a 'url' string property.
    inputSchema={
        "type": "object",
        "properties": {
            "url": {"type": "string"},
        },
        "required": ["url"],
    },
  • Registration of the tool in @server.list_tools(): defines name, description, and input schema.
    return [
        types.Tool(
            name="extract-mcp-servers-from-url",
            description="Extract MCP Servers from a URL",
            inputSchema={
                "type": "object",
                "properties": {
                    "url": {"type": "string"},
                },
                "required": ["url"],
            },
        ),
  • Helper function to extract MCP servers from content using OpenAI LLM in JSON object response format with custom prompt.
    async def extract_mcp_servers_from_content(content: str) -> str | None:
        client = OpenAI(
            api_key=os.getenv("OPENAI_API_KEY"),
            base_url=os.getenv("OPENAI_BASE_URL"),
        )
    
        user_content = extract_mcp_servers_prompt.format(content=content)
    
        logger.info(f"Extract prompt: {user_content}")
    
        chat_completion = client.chat.completions.create(
            messages=[
                {
                    "role": "user",
                    "content": user_content,
                }
            ],
            model=os.getenv("OPENAI_MODEL"),
            response_format={"type": "json_object"},
        )
    
        return chat_completion.choices[0].message.content
  • Helper function to fetch raw content from URL by invoking external 'mcp-server-fetch' via MCP client.
    async def call_fetch_tool(url: str):
        async with stdio_client(server_params) as (read, write):
            async with ClientSession(read, write) as session:
                await session.initialize()
    
                result = await session.call_tool(
                    "fetch",
                    arguments={
                        "url": url,
                        "max_length": 100000,
                        "raw": True
                    }
                )
    
                return result.content[0].text
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states what the tool does but lacks behavioral details: no information on permissions needed, rate limits, error handling, output format, or whether it's read-only/destructive. 'Extract' suggests read-only, but this isn't explicitly confirmed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized for a simple tool and front-loaded with the core action, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on behavior, parameters, and return values, which are essential for a tool with one parameter and potential complexity in URL processing and MCP server extraction.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% with 1 parameter ('url'), and the description doesn't add any parameter semantics beyond the name. It doesn't explain what type of URL is expected (e.g., HTTP, file path), format constraints, or examples, leaving the parameter meaning unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Extract MCP Servers from a URL' clearly states the verb ('extract'), resource ('MCP Servers'), and source ('from a URL'). It distinguishes from sibling 'extract-mcp-servers-from-content' by specifying URL vs. content, but doesn't differentiate from 'submit-mcp-server' which has a different action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool vs. alternatives. The description implies usage for URL-based extraction, but doesn't specify scenarios, prerequisites, or exclusions compared to siblings like 'submit-mcp-server' for submission operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/chatmcp/mcp-server-collector'

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