sql-stock-mcp-server

aryanb12393/sql-stock-mcp-server

3.1

If you are the rightful owner of sql-stock-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A secure MCP server providing access to Google stock price data with parameterized queries.

Tools
3
Resources
0
Prompts
0

SQL Stock MCP Server

A secure MCP server that provides access to Google stock price data using parameterized queries.

What It Does

  • Get recent stock prices for last N days
  • Visualize price trends with charts
  • Find biggest day-to-day price changes

Security Features

🔒 Claude never writes SQL queries

Instead of letting Claude write SQL (which could be dangerous), Claude only provides simple parameters like integers. The server builds all SQL queries internally using parameterized statements.

Example:

  • Claude calls: getRecentStockPrices(days=30)
  • Server executes: SELECT ... LIMIT ? with parameter (30,)
  • Result: Zero SQL injection risk

Setup

1. Install Dependencies

pip install -r requirements.txt

2. Seed the Database (Optional)

python3 seed_data.py

This creates stock_data.db with sample Google stock price data.

3. Configure Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "sql-stock": {
      "command": "python3",
      "args": ["/path/to/sql-stock-mcp/server.py"],
      "cwd": "/path/to/sql-stock-mcp"
    }
  }
}

4. Restart Claude Desktop

Usage Examples

Get recent prices:

"Show me Google's stock price for the last 7 days"

Visualize trends:

"Create a chart of Google stock prices for the last 30 days"

Find big changes:

"What were the 5 biggest day-to-day price changes?"

Tools Available

  • getRecentStockPrices(days) - Get last N days of data (1-365)
  • visualizeRecentPrices(days) - Generate a price chart
  • getTopPriceChanges(limit) - Find biggest price swings

Database Schema

Table: google_share_price

ColumnTypeDescription
idINTEGERPrimary key
dateDATETrading date
priceREALClosing price
created_atTIMESTAMPRecord creation time

Note: The author column exists but is blocked from queries for security demonstration.