Skip to main content
Glama
cornelcroi

French Tax MCP Server

by cornelcroi

get_tax_deadlines

Retrieve French tax deadlines from official government sources to help plan and meet filing requirements.

Instructions

Get tax deadlines from service-public.fr

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearNo
ctxNo

Implementation Reference

  • MCP tool registration decorator for 'get_tax_deadlines'.
    @mcp.tool(
        name="get_tax_deadlines",
        description="Get tax deadlines from service-public.fr",
    )
  • The MCP tool handler wrapper that delegates to the service_public_scraper.get_tax_deadlines function.
    async def get_tax_deadlines_wrapper(
        year: Optional[int] = None,
        ctx: Optional[Context] = None,
    ) -> Optional[Dict]:
        """Get tax deadlines from service-public.fr.
    
        Args:
            year: The tax year to retrieve deadlines for (defaults to current year)
            ctx: MCP context for logging
    
        Returns:
            Dict: Dictionary containing tax deadlines
        """
        try:
            if ctx:
                await ctx.info(f"Getting tax deadlines for year {year or 'current'}")
    
            from french_tax_mcp.scrapers.service_public_scraper import get_tax_deadlines
            result = await get_tax_deadlines(year)
            return result
        except Exception as e:
            if ctx:
                await ctx.error(f"Failed to get tax deadlines: {e}")
            return {
                "status": "error",
                "message": f"Error getting tax deadlines: {str(e)}",
            }
  • Core scraping logic for tax deadlines in ServicePublicScraper class method.
    async def get_tax_deadlines(self, year: Optional[int] = None) -> Dict:
        """Scrape tax deadlines from service-public.fr.
    
        Args:
            year: The tax year to retrieve deadlines for. Defaults to current year.
    
        Returns:
            Dictionary containing tax deadlines
        """
        # Set default year to current year if not specified
        current_year = datetime.now().year
        tax_year = year or current_year
    
        logger.info(f"Scraping tax deadlines for year {tax_year}")
    
        try:
            # Get the page
            response = await self.get_page(DEADLINES_URL)
    
            # Parse HTML
            soup = self.parse_html(response.text)
    
            # Extract deadlines
            deadlines = self._extract_deadlines(soup, tax_year)
    
            return self.format_result(
                status="success",
                data={
                    "year": tax_year,
                    "deadlines": deadlines,
                },
                message=f"Successfully retrieved tax deadlines for {tax_year}",
                source_url=f"{BASE_URL}{DEADLINES_URL}",
            )
    
        except Exception as e:
            logger.error(f"Error scraping tax deadlines: {e}")
            return self.format_result(
                status="error",
                message=f"Failed to retrieve tax deadlines: {str(e)}",
                data={"year": tax_year},
                error=e,
            )
  • Standalone convenience function that invokes the singleton scraper's get_tax_deadlines method.
    async def get_tax_deadlines(year: Optional[int] = None) -> Dict:
        """Scrape tax deadlines from service-public.fr.
    
        Args:
            year: The tax year to retrieve deadlines for. Defaults to current year.
    
        Returns:
            Dictionary containing tax deadlines
        """
        return await service_public_scraper.get_tax_deadlines(year)

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/cornelcroi/french-tax-mcp'

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