Spaces:
Runtime error
Runtime error
File size: 4,896 Bytes
cca012f e5cb314 cca012f e5cb314 cca012f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | import click
import sys
import subprocess
import os
from rich.console import Console
from rich.panel import Panel
console = Console()
@click.group()
def cli():
"""TechRadar MCP — Universal Tech Hiring Intelligence & MCP Ecosystem across India & Remote."""
pass
@cli.command()
@click.option("--live/--no-live", default=True, help="Fetch real-time live internet jobs from RemoteOK, Jobicy, WWR")
def seed(live):
"""Seed SQLite database & Vector Engine with curated + live internet job postings."""
console.print(f"[bold green]🌱 Seeding TechRadar Database (Live Scraping: {live})...[/bold green]")
from tech_radar.scrapers.seeder import seed_database
seed_database(fetch_live=live)
@cli.command()
def scrape_live():
"""Trigger real-time live internet job scraping pipeline."""
console.print("[bold cyan]🌐 Executing Live Internet Job Scraper Pipeline...[/bold cyan]")
from tech_radar.scrapers.live_scraper import LiveInternetScraper
from tech_radar.db.database import DatabaseManager
from tech_radar.db.vector_store import SemanticVectorStore
scraper = LiveInternetScraper()
live_jobs = scraper.fetch_all_live_jobs()
db = DatabaseManager()
for job in live_jobs:
db.save_job_posting(job)
vector_store = SemanticVectorStore()
all_jobs = db.get_all_jobs()
vector_store.index_jobs(all_jobs)
console.print(f"[bold green]✅ Ingested {len(live_jobs)} live jobs! Total jobs in database: {len(all_jobs)}[/bold green]")
@cli.command()
@click.option("--transport", default="stdio", type=click.Choice(["stdio", "sse"]), help="MCP transport protocol")
def serve(transport):
"""Start the FastMCP Protocol Server for Claude Desktop or Cursor IDE."""
console.print(Panel.fit(
f"[bold magenta]⚡ Starting TechRadar FastMCP Server ({transport} mode)...[/bold magenta]\n"
"[dim]Exposing tools: search_tech_jobs, analyze_skill_gap, generate_tailored_resume_patch, get_market_insights, generate_interview_prep_kit[/dim]",
title="TechRadar MCP"
))
from tech_radar.mcp.server import mcp
if transport == "stdio":
mcp.run(transport="stdio")
else:
mcp.run(transport="sse")
@cli.command()
@click.option("--port", default=8000, help="Port to run 3D Web App frontend on")
def web(port):
"""Launch the 3D Cyber-Glassmorphic Web App frontend."""
console.print(f"[bold cyan]🌐 Launching 3D Cyber-Glassmorphic TechRadar Web App on http://localhost:{port}...[/bold cyan]")
import uvicorn
uvicorn.run("tech_radar.ui.static_server:app", host="0.0.0.0", port=port, reload=True)
@cli.command()
@click.option("--port", default=8501, help="Port to run Streamlit dashboard on")
def ui(port):
"""Launch the Interactive Streamlit Dashboard."""
console.print(f"[bold cyan]🚀 Launching TechRadar Streamlit Dashboard on http://localhost:{port}...[/bold cyan]")
app_path = os.path.join(os.path.dirname(__file__), "ui", "app.py")
subprocess.run([sys.executable, "-m", "streamlit", "run", app_path, "--server.port", str(port)])
@cli.command()
def test_mcp():
"""Run automated end-to-end verification of all FastMCP tools."""
console.print("[bold yellow]🧪 Running Automated FastMCP Server Verification...[/bold yellow]")
from tech_radar.mcp.tools import (
tool_search_tech_jobs,
tool_analyze_skill_gap,
tool_generate_resume_patch,
tool_get_market_insights,
tool_generate_interview_prep_kit
)
console.print("\n1. Testing 'search_tech_jobs' (Backend in Bengaluru)...")
res1 = tool_search_tech_jobs(domain="Backend Engineering", city="Bengaluru", query="Go")
console.print(f" Success! Retreived response size: {len(res1)} bytes")
console.print("\n2. Testing 'get_market_insights' (Cloud in Hyderabad)...")
res2 = tool_get_market_insights(domain="Cloud & DevOps", city="Hyderabad")
console.print(f" Success! Retreived response size: {len(res2)} bytes")
console.print("\n3. Testing 'analyze_skill_gap' (BLR-BACKEND-101)...")
res3 = tool_analyze_skill_gap(resume_text="Go & Docker developer", target_job_id="BLR-BACKEND-101")
console.print(f" Success! Retreived response size: {len(res3)} bytes")
console.print("\n4. Testing 'generate_tailored_resume_patch' (PUNE-FULLSTACK-202)...")
res4 = tool_generate_resume_patch(resume_text="Python React dev", target_job_id="PUNE-FULLSTACK-202")
console.print(f" Success! Retreived response size: {len(res4)} bytes")
console.print("\n5. Testing 'generate_interview_prep_kit' (BLR-FRONTEND-201)...")
res5 = tool_generate_interview_prep_kit(target_job_id="BLR-FRONTEND-201")
console.print(f" Success! Retreived response size: {len(res5)} bytes")
console.print("\n[bold green]✅ All 5 FastMCP Tools verified successfully![/bold green]")
if __name__ == "__main__":
cli()
|