extract-mcp-servers-from-content
Identify and extract MCP server details from provided content to streamline server data collection and analysis.
Instructions
Extract MCP Servers from given content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | content containing mcp servers |
Implementation Reference
- src/mcp_server_collector/extract.py:8-29 (handler)Core implementation of the tool: extracts MCP servers from provided content using OpenAI LLM with JSON response format.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
- src/mcp_server_collector/server.py:32-45 (registration)Tool registration in list_tools(), including name, description, and input schema.types.Tool( name="extract-mcp-servers-from-content", description="Extract MCP Servers from given content", inputSchema={ "type": "object", "properties": { "content": { "type": "string", "description": "content containing mcp servers", }, }, "required": ["content"], }, ),
- src/mcp_server_collector/server.py:83-85 (handler)Dispatch case in the main @server.call_tool() handler that retrieves content argument for this tool.case "extract-mcp-servers-from-content": content = arguments.get("content")
- Invocation of the extraction function and validation within the tool handler.mcp_servers = await extract_mcp_servers_from_content(content) if not mcp_servers:
- Prompt template formatted and used in the OpenAI call for extraction.extract_mcp_servers_prompt = """Please extract all MCP Servers from the following content and return a JSON array. Each item should contain: - name: extracted from the repository name in the URL - title: a human readable title - description: a brief description of the server - url: the full GitHub repository URL - author_name: extracted from the GitHub username in the URL Example response format: [ {{ "name": "mcp-server-example", "title": "MCP Server Example", "description": "A sample MCP server implementation", "url": "https://github.com/username/mcp-server-example", "author_name": "username" }} ] Content to analyze: {content} """