Skip to main content
Glama
nanyang12138

AI Research MCP Server

by nanyang12138

get_trending_repos

Retrieve trending AI/ML repositories from GitHub to track emerging projects and research developments, with options to filter by time period, programming language, and result count.

Instructions

Get trending AI/ML repositories on GitHub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoTime period for trendingweekly
languageNoFilter by programming language
max_resultsNoMaximum number of results

Implementation Reference

  • Primary handler for the get_trending_repos tool. Handles caching, invokes the GitHub client method, formats results, and returns markdown.
    async def _get_trending_repos(
        self,
        period: str = "weekly",
        language: Optional[str] = None,
        max_results: int = 25,
    ) -> str:
        """Get trending repositories."""
        cache_key = f"github_trending_{period}_{language}"
        cached = self.cache.get(cache_key, 3600)  # 1 hour cache
        if cached:
            repos = cached
        else:
            repos = await asyncio.to_thread(
                self.github.get_trending_repositories,
                period=period,
                language=language,
                max_results=max_results,
            )
            self.cache.set(cache_key, repos)
        
        return self._format_repos(repos)
  • Registers the get_trending_repos tool in list_tools(), including name, description, and input schema.
    Tool(
        name="get_trending_repos",
        description="Get trending AI/ML repositories on GitHub",
        inputSchema={
            "type": "object",
            "properties": {
                "period": {
                    "type": "string",
                    "enum": ["daily", "weekly", "monthly"],
                    "description": "Time period for trending",
                    "default": "weekly",
                },
                "language": {
                    "type": "string",
                    "description": "Filter by programming language",
                },
                "max_results": {
                    "type": "integer",
                    "description": "Maximum number of results",
                    "default": 25,
                },
            },
        },
    ),
  • Helper method in GithubClient that implements the core logic for fetching trending repositories by approximating via search with recent pushes, AI topics, and star sorting.
    def get_trending_repositories(
        self,
        period: str = "daily",
        language: Optional[str] = None,
        max_results: int = 25,
    ) -> List[Dict]:
        """Get trending repositories.
        
        Note: GitHub API doesn't have official trending endpoint, so we approximate
        by searching for recently created/updated repos with high stars.
        
        Args:
            period: 'daily', 'weekly', or 'monthly'
            language: Programming language filter
            max_results: Maximum number of results
            
        Returns:
            List of repository dictionaries
        """
        # Map period to days
        period_days = {
            "daily": 1,
            "weekly": 7,
            "monthly": 30,
        }
        days = period_days.get(period, 7)
        
        # Search for recently starred repos with AI topics
        return self.search_repositories(
            topics=self.AI_TOPICS[:5],  # Use top 5 most common topics
            min_stars=100,
            language=language,
            pushed_since=f"{days}d",
            sort_by="stars",
            max_results=max_results,
        )

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/nanyang12138/AI-Research-MCP'

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