aamanlamba Claude commited on
Commit
a58468b
·
1 Parent(s): e0abc68

Fix MCP server 405 error - separate MCP from local lineage extraction

Browse files

- Remove automatic MCP server fallback from extraction functions
- MCP servers are now only used via explicit Test Connection
- Local lineage extraction works independently without MCP
- Fixes "Method Not Allowed" error when extracting sample data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -33
app.py CHANGED
@@ -539,18 +539,10 @@ def load_sample(sample_type: str) -> str:
539
  def extract_lineage_from_text(
540
  metadata_text: str,
541
  source_type: str,
542
- visualization_format: str,
543
- mcp_server: str = "",
544
- mcp_api_key: str = ""
545
  ) -> Tuple[str, str]:
546
- """Extract lineage from provided metadata text."""
547
- # Try MCP server first if configured
548
- if mcp_server:
549
- viz, summary = send_to_mcp(mcp_server, mcp_api_key, metadata_text, source_type, visualization_format)
550
- if viz or (summary and not summary.startswith("Error")):
551
- return viz, summary
552
-
553
- # Local processing
554
  if not metadata_text.strip():
555
  return "", "Please provide metadata content."
556
 
@@ -568,16 +560,9 @@ def extract_lineage_from_bigquery(
568
  project_id: str,
569
  query: str,
570
  api_key: str,
571
- visualization_format: str,
572
- mcp_server: str = "",
573
- mcp_api_key: str = ""
574
  ) -> Tuple[str, str]:
575
- """Extract lineage from BigQuery."""
576
- if mcp_server:
577
- viz, summary = send_to_mcp(mcp_server, mcp_api_key, query, "BigQuery", visualization_format)
578
- if viz or (summary and not summary.startswith("Error")):
579
- return viz, summary
580
-
581
  # Local stub - would integrate with BigQuery API in production
582
  viz = f"""graph TD
583
  subgraph BigQuery Project: {project_id or 'your-project'}
@@ -592,23 +577,16 @@ def extract_lineage_from_bigquery(
592
 
593
  def extract_lineage_from_url(
594
  url: str,
595
- visualization_format: str,
596
- mcp_server: str = "",
597
- mcp_api_key: str = ""
598
  ) -> Tuple[str, str]:
599
- """Extract lineage from URL/API endpoint."""
600
- if mcp_server:
601
- viz, summary = send_to_mcp(mcp_server, mcp_api_key, url, "URL", visualization_format)
602
- if viz or (summary and not summary.startswith("Error")):
603
- return viz, summary
604
-
605
  # Try to fetch the URL
606
  if url:
607
  try:
608
  resp = requests.get(url, timeout=10)
609
  if resp.status_code == 200:
610
  return extract_lineage_from_text(resp.text, "API Response", visualization_format)
611
- except Exception as e:
612
  pass
613
 
614
  viz = "graph TD\n A[API Source] --> B[Data Pipeline] --> C[Output]"
@@ -748,7 +726,7 @@ with gr.Blocks(
748
 
749
  extract_btn.click(
750
  fn=extract_lineage_from_text,
751
- inputs=[metadata_input, source_type, viz_format, mcp_server, mcp_api_key],
752
  outputs=[output_viz, output_summary]
753
  )
754
 
@@ -794,7 +772,7 @@ with gr.Blocks(
794
 
795
  bq_extract_btn.click(
796
  fn=extract_lineage_from_bigquery,
797
- inputs=[bq_project, bq_query, bq_creds, bq_viz_format, mcp_server, mcp_api_key],
798
  outputs=[bq_output_viz, bq_output_summary]
799
  )
800
 
@@ -825,7 +803,7 @@ with gr.Blocks(
825
 
826
  url_extract_btn.click(
827
  fn=extract_lineage_from_url,
828
- inputs=[url_input, url_viz_format, mcp_server, mcp_api_key],
829
  outputs=[url_output_viz, url_output_summary]
830
  )
831
 
 
539
  def extract_lineage_from_text(
540
  metadata_text: str,
541
  source_type: str,
542
+ visualization_format: str
 
 
543
  ) -> Tuple[str, str]:
544
+ """Extract lineage from provided metadata text (local processing only)."""
545
+ # Local processing - MCP servers are used separately via explicit fetch
 
 
 
 
 
 
546
  if not metadata_text.strip():
547
  return "", "Please provide metadata content."
548
 
 
560
  project_id: str,
561
  query: str,
562
  api_key: str,
563
+ visualization_format: str
 
 
564
  ) -> Tuple[str, str]:
565
+ """Extract lineage from BigQuery (local processing)."""
 
 
 
 
 
566
  # Local stub - would integrate with BigQuery API in production
567
  viz = f"""graph TD
568
  subgraph BigQuery Project: {project_id or 'your-project'}
 
577
 
578
  def extract_lineage_from_url(
579
  url: str,
580
+ visualization_format: str
 
 
581
  ) -> Tuple[str, str]:
582
+ """Extract lineage from URL/API endpoint (local processing)."""
 
 
 
 
 
583
  # Try to fetch the URL
584
  if url:
585
  try:
586
  resp = requests.get(url, timeout=10)
587
  if resp.status_code == 200:
588
  return extract_lineage_from_text(resp.text, "API Response", visualization_format)
589
+ except Exception:
590
  pass
591
 
592
  viz = "graph TD\n A[API Source] --> B[Data Pipeline] --> C[Output]"
 
726
 
727
  extract_btn.click(
728
  fn=extract_lineage_from_text,
729
+ inputs=[metadata_input, source_type, viz_format],
730
  outputs=[output_viz, output_summary]
731
  )
732
 
 
772
 
773
  bq_extract_btn.click(
774
  fn=extract_lineage_from_bigquery,
775
+ inputs=[bq_project, bq_query, bq_creds, bq_viz_format],
776
  outputs=[bq_output_viz, bq_output_summary]
777
  )
778
 
 
803
 
804
  url_extract_btn.click(
805
  fn=extract_lineage_from_url,
806
+ inputs=[url_input, url_viz_format],
807
  outputs=[url_output_viz, url_output_summary]
808
  )
809