Skip to main content
Glama
test_mcp_debug.pyโ€ข2.27 kB
#!/usr/bin/env python3 """ Test script for debugging Financial MCPs Run this to test individual functions """ import asyncio import json import sys from pathlib import Path # Add the source to path sys.path.append(str(Path(__file__).parent / "SEC_SCRAPER_MCP" / "src")) sys.path.append(str(Path(__file__).parent / "shared")) from main import SECScraper async def test_sec_scraper(): """Test SEC scraper functions""" print("๐Ÿงช Testing SEC Scraper Functions") print("=" * 50) scraper = SECScraper() await scraper.setup() ticker = "AAPL" # Test 1: Search filings print(f"\n1. Testing search_company_filings for {ticker}...") try: filings = await scraper.search_company_filings(ticker, "10-K") if filings and not any('error' in f for f in filings): print(f"โœ… Found {len(filings)} filings") print(f" Latest: {filings[0]['filing_date'] if filings else 'None'}") else: print(f"โŒ Error: {filings}") except Exception as e: print(f"โŒ Exception: {e}") # Test 2: Get current price print(f"\n2. Testing get_current_price for {ticker}...") try: price_data = await scraper.get_current_price(ticker) if 'error' not in price_data: print(f"โœ… Current price: ${price_data.get('price', 'N/A')}") else: print(f"โŒ Error: {price_data['error']}") except Exception as e: print(f"โŒ Exception: {e}") # Test 3: Parse XBRL print(f"\n3. Testing parse_xbrl_data for {ticker}...") try: xbrl_data = await scraper.parse_xbrl_data(ticker) if 'error' not in xbrl_data: print(f"โœ… XBRL data parsed") if 'key_metrics' in xbrl_data: print(f" Metrics found: {len(xbrl_data['key_metrics'])}") else: print(f"โŒ Error: {xbrl_data['error']}") except Exception as e: print(f"โŒ Exception: {e}") await scraper.cleanup() async def test_with_debug(): """Test with debug output""" import logging logging.basicConfig(level=logging.DEBUG) await test_sec_scraper() if __name__ == "__main__": # Run normal test by default asyncio.run(test_sec_scraper())

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/LuisRincon23/SEC-MCP'

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