VayuChat MCP

VayuChat MCP

A FastMCP server for natural language data analysis that allows users to load CSV files, execute Python code with pandas and numpy, and generate matplotlib visualizations. It provides a suite of tools for data exploration, statistical summaries, and querying datasets through MCP-compatible clients.

Category
访问服务器

README

VayuChat MCP

Natural language data analysis for air quality data using MCP (Model Context Protocol).

Features

Pre-loaded Datasets

  • air_quality: Hourly PM2.5, PM10, NO2, SO2, CO, O3 readings for Delhi & Bangalore
  • funding: Government air quality funding by city/year (2020-2024)
  • city_info: City metadata - population, vehicles, industries, green cover

Analysis Tools (No Code Required!)

Function Description
list_tables Show available tables
show_table Display table data
describe_table Detailed statistics
query_table Filter with pandas query
compare_weekday_weekend Weekday vs weekend analysis
compare_cities Compare metrics across cities
analyze_correlation Correlation analysis
analyze_funding Funding breakdown
get_city_profile Comprehensive city profile

Visualization Tools

Function Description
plot_comparison Bar/box charts
plot_time_series Time series charts
plot_weekday_weekend Weekday vs weekend bars
plot_funding_trend Funding over years
plot_hourly_pattern Hourly patterns

Installation

# Using uv
uv pip install -e .

# Or with pip
pip install -e .

Usage

As MCP Server (with Claude Code)

Add to your Claude Code MCP configuration:

{
  "mcpServers": {
    "vayuchat": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/vayuchat-mcp", "vayuchat-mcp"]
    }
  }
}

As Gradio App (HF Spaces)

# Run locally
python app.py

# Or with gradio
gradio app.py

Then open http://localhost:7860

Deploy to Hugging Face Spaces

  1. Create a new Space on HF (Gradio SDK)
  2. Upload these files:
    • app.py
    • requirements.txt
    • src/ folder
    • data/ folder

Or connect your GitHub repo directly to HF Spaces.

Example Queries

# Data exploration
"What tables are available?"
"Show me the funding table"
"Describe the air quality data"

# Analysis
"Compare weekday vs weekend PM2.5"
"Compare cities by PM10 levels"
"Get Delhi city profile"
"Show correlation with PM2.5"

# Funding
"Show funding for Delhi"
"What's the funding trend?"

# Visualizations
"Plot weekday vs weekend PM2.5"
"Show hourly pattern for NO2"
"Plot funding trend chart"

Architecture

NLQ (User Question)
       ↓
  Gradio Chat UI
       ↓
  Query Router (keyword-based / LLM)
       ↓
  MCP Tool Call
       ↓
  Response (Markdown + Base64 Plot)
       ↓
  Rendered in UI

Why Predefined Functions vs LLM-Generated Code?

This project uses predefined MCP functions instead of letting the LLM generate arbitrary pandas/matplotlib code. Here's why:

Comparison Table

Aspect Predefined Functions (This Approach) LLM-Generated Code Function-Calling LLM
Reliability ✅ Deterministic, always works ❌ May hallucinate syntax ⚠️ Better but can miss params
Speed ✅ Instant (no code generation) ❌ Slow (generate → parse → execute) ⚠️ Moderate
Cost ✅ Minimal tokens ❌ Long prompts with schema ⚠️ Moderate
Security ✅ No arbitrary code execution ❌ Code injection risk ✅ Safe
Consistency ✅ Same visualization style ❌ Random styling each time ✅ Consistent
Model Size ✅ Works with small/cheap models ❌ Needs capable coder model ⚠️ Needs fine-tuned model
Flexibility ❌ Limited to predefined queries ✅ Infinite flexibility ⚠️ Limited to defined functions
Error Handling ✅ Graceful, predictable ❌ May crash, retry loops ✅ Structured errors

When to Use Each Approach

Use Predefined Functions (this approach) when:

  • You have a known, bounded set of analysis patterns
  • Users are non-technical (need consistent UX)
  • Cost/latency matters (production deployment)
  • You want guaranteed correct outputs
  • Using smaller/cheaper models (Haiku, GPT-3.5)

Use LLM-Generated Code when:

  • Exploratory data analysis with unknown patterns
  • Power users who can debug code
  • One-off analyses
  • Prototype/research phase

Use Function-Calling LLM when:

  • You have predefined functions BUT need better intent parsing
  • Using OpenAI/Claude with native function calling
  • Queries are ambiguous and need sophisticated NLU

The Hybrid Approach (Best of Both)

User Query
     ↓
┌─────────────────────────────────────┐
│  LLM with Function Calling          │  ← Parses intent, extracts params
│  (Claude, GPT-4, etc.)              │
└─────────────────────────────────────┘
     ↓
┌─────────────────────────────────────┐
│  MCP Predefined Functions           │  ← Executes reliably
│  (compare_cities, plot_trend, etc.) │
└─────────────────────────────────────┘
     ↓
  Structured Response + Plot

This gives you:

  • LLM's NLU capabilities for parsing complex queries
  • Predefined functions' reliability for execution
  • No code hallucination risk
  • Consistent outputs every time

Example: Same Query, Different Approaches

Query: "Compare PM2.5 on weekdays vs weekends for Delhi and Bangalore"

LLM-Generated Code (risky):

# LLM might generate:
df['is_weekend'] = df['day'].isin(['Sat', 'Sun'])  # Wrong column name!
df.groupby(['city', 'is_weekend'])['pm25'].mean()  # Wrong column name!
# ... errors, retries, inconsistent output

Predefined Function (reliable):

# MCP calls:
compare_weekday_weekend(value_column="PM2.5", group_by="city")
# Always works, consistent format, proper column names

Cost Comparison (Approximate)

Approach Tokens per Query Cost (GPT-4) Latency
Predefined + Keyword Router ~100 $0.001 <100ms
Predefined + LLM Router ~500 $0.005 ~500ms
LLM-Generated Code ~2000+ $0.02+ 2-5s

For 1000 queries/day:

  • Predefined: ~$1-5/day
  • LLM Code Gen: ~$20+/day

Data Sources

  • Air quality data: Simulated based on real patterns from Indian cities
  • Funding data: Mock data representing typical government allocations
  • City info: Approximate real statistics

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选