Bridge your LLM to real-time structured financial data using the Model Context Protocol (MCP).
The Financial Data MCP Server is a production-ready middleware that connects AI assistants (Claude Desktop, Cursor, or any MCP-compatible client) to a structured PostgreSQL financial database.
Instead of relying on hallucinated financial numbers, your AI can now query a real database to retrieve:
- 📊 Company profiles
- 📈 Financial statements
- 📉 Historical stock data
- 🔍 Multi-company comparisons
This ensures AI-generated financial analysis is accurate, structured, and reliable.
Large Language Models are powerful — but they:
- ❌ Cannot access live databases by default
- ❌ May hallucinate financial data
- ❌ Lack structured validation
This MCP server solves that by:
- ✅ Exposing strongly-typed tools
- ✅ Validating inputs using Zod
- ✅ Querying real PostgreSQL data
- ✅ Returning structured JSON responses
AI + Real Data = Trustworthy Insights
User → AI Assistant (Claude / Cursor)
│
▼
Model Context Protocol
│
▼
Financial MCP Server (Node.js)
│
▼
Supabase PostgreSQL Database
User asks:
Compare Apple and Microsoft revenue over the last 4 quarters.
AI calls MCP tool:
{
"symbols": ["AAPL", "MSFT"],
"metric": "revenue"
}Server queries database → Returns structured JSON → AI generates accurate analysis.
- Company name
- CEO
- Sector & industry
- Market capitalization
- Quarterly revenue
- Annual revenue
- Net income
- EPS
- EBITDA
- Profit margins
- OHLC (Open, High, Low, Close)
- Volume
- Date filtering
- Custom time ranges
- Side-by-side metric comparison
- Clean structured responses
- Optimized for AI analysis
| Layer | Technology |
|---|---|
| Runtime | Node.js (v18+) |
| Language | TypeScript |
| Protocol | Model Context Protocol (MCP) |
| Database | Supabase (PostgreSQL) |
| Validation | Zod |
| Transport | Stdio |
mcp-financial-server/
├── src/
│ ├── config/ # Environment configuration
│ ├── db/ # Supabase client setup
│ ├── tools/ # Tool definitions & SQL queries
│ ├── index.ts # MCP server entry point
│ └── seed.ts # Database seeding script
│
├── database/
│ └── schema.sql # SQL schema
│
├── dist/ # Compiled JavaScript
├── .env # Environment variables (DO NOT COMMIT)
├── package.json
├── tsconfig.json
└── README.md
- Node.js v18+
- npm or yarn
- Supabase account (Free tier works)
git clone https://github.com/yourusername/mcp-financial-server.git
cd mcp-financial-servernpm installCreate a .env file:
touch .envAdd your credentials:
SUPABASE_URL="your_supabase_project_url"
SUPABASE_SERVICE_KEY="your_service_role_key".env to version control.
- Open Supabase dashboard
- Create a new project
- Go to SQL Editor
- Run
database/schema.sql
npm run seednpm run buildnpm startThe server will run over stdio transport and be ready for MCP-compatible clients.
Add this configuration:
{
"mcpServers": {
"financial-data": {
"command": "node",
"args": ["dist/index.js"]
}
}
}Restart Claude Desktop after updating configuration.
- Store service role key securely
- Never expose
.envpublicly - Restrict database access in production
- Validate all inputs using Zod schemas
- AI-powered stock analysis assistant
- Automated financial research
- Investor comparison tools
- Portfolio performance dashboards
- Startup valuation research
Built using TypeScript, Supabase, and the Model Context Protocol (MCP).
If this project helped you, consider giving it a ⭐ on GitHub.