Skip to main content
Glama

MCP ChatGPT Multi-Server Suite

by bobhuff0
START_HERE.mdβ€’9.45 kB
# πŸš€ MCP ChatGPT App - START HERE ## πŸ“‹ What You Have A fully functional **TypeScript ChatGPT App** using the **Model Context Protocol (MCP) SDK** with: βœ… **Express server** exposing MCP tools via REST API βœ… **topMovers tool** that fetches real-time stock data from Alpha Vantage βœ… **Beautiful ChatGPT app frontend** with dark mode, responsive tables, and animations βœ… **Auto-load functionality** using `window.openai.callTool('topMovers', { limit })` βœ… **ngrok integration** for easy external access βœ… **Complete documentation** and helper scripts --- ## 🎯 Quick Start (3 Steps) ### Step 1: Get API Key ```bash # Visit: https://www.alphavantage.co/support/#api-key # Then set it: export ALPHA_VANTAGE_API_KEY=your_key_here ``` ### Step 2: Start Server ```bash ./start.sh ``` ### Step 3: Open Browser ``` http://localhost:3000 ``` **That's it!** πŸŽ‰ --- ## πŸ“ Project Structure ``` MCPAddIn/ β”œβ”€β”€ πŸ“„ START_HERE.md ← You are here! β”œβ”€β”€ πŸ“„ QUICKSTART.md ← 3-step quick start β”œβ”€β”€ πŸ“„ SETUP_COMPLETE.md ← Detailed setup guide β”œβ”€β”€ πŸ“„ ARCHITECTURE.md ← Technical architecture β”œβ”€β”€ πŸ“„ README.md ← Full documentation β”‚ β”œβ”€β”€ πŸ”§ Configuration β”‚ β”œβ”€β”€ package.json ← Dependencies β”‚ β”œβ”€β”€ tsconfig.json ← TypeScript config β”‚ β”œβ”€β”€ env.example ← Environment variables example β”‚ └── requirements.txt ← Package list β”‚ β”œβ”€β”€ πŸ’» Source Code β”‚ β”œβ”€β”€ src/ β”‚ β”‚ └── server.ts ← MCP server + Express + topMovers tool β”‚ └── public/ β”‚ └── index.html ← ChatGPT app frontend β”‚ β”œβ”€β”€ πŸ› οΈ Scripts β”‚ β”œβ”€β”€ start.sh ← Start the server β”‚ β”œβ”€β”€ ngrok.sh ← Expose via ngrok β”‚ └── test-setup.sh ← Verify setup β”‚ └── πŸ“¦ Build Output └── dist/ └── server.js ← Compiled JavaScript ``` --- ## 🎨 What the App Does ### Frontend (index.html) 1. **Auto-loads** on page open 2. **Calls** `window.openai.callTool('topMovers', { limit: 10 })` 3. **Displays** three responsive tables: - πŸš€ **Top Gainers** (stocks with biggest gains) - πŸ“‰ **Top Losers** (stocks with biggest losses) - πŸ”₯ **Most Actively Traded** (highest volume stocks) 4. **Features**: - Dark mode with gradient hero - Color-coded changes (green/red) - Smooth animations (Anime.js) - Responsive design (mobile-friendly) - Adjustable result limits - Manual refresh button ### Backend (server.ts) 1. **Serves** the ChatGPT app frontend 2. **Exposes MCP tool**: `topMovers(limit)` 3. **Fetches data** from Alpha Vantage API 4. **Formats results** and returns JSON 5. **Handles errors** gracefully --- ## πŸ§ͺ Test Your Setup Run the verification script: ```bash ./test-setup.sh ``` This checks: - βœ… Node.js & npm installed - βœ… TypeScript installed - βœ… Dependencies installed - βœ… Build compiled - βœ… API key set - βœ… ngrok available - βœ… Scripts executable --- ## 🌐 Using ngrok **Terminal 1** (Keep running): ```bash ./start.sh ``` **Terminal 2**: ```bash ./ngrok.sh ``` You'll get a public URL like: ``` https://abc123.ngrok.io ``` Share this URL or use it for ChatGPT integration! --- ## πŸ“Š Example API Call ### Using the Tool ```javascript // In ChatGPT app context const data = await window.openai.callTool('topMovers', { limit: 10 }); console.log(data); // { // metadata: "Top Gainers, Losers, and Most Actively Traded...", // last_updated: "2024-01-01T12:00:00", // top_gainers: [...], // top_losers: [...], // most_actively_traded: [...] // } ``` ### Direct HTTP Call ```bash curl -X POST http://localhost:3000/mcp/tools/call \ -H "Content-Type: application/json" \ -d '{ "name": "topMovers", "arguments": { "limit": 5 } }' ``` --- ## 🎯 What Each File Does | File | Purpose | |------|---------| | **START_HERE.md** | This overview guide | | **QUICKSTART.md** | 3-step quick start instructions | | **SETUP_COMPLETE.md** | Detailed setup and feature list | | **ARCHITECTURE.md** | Technical architecture and data flow | | **README.md** | Complete documentation | | **src/server.ts** | MCP server implementation | | **public/index.html** | ChatGPT app frontend | | **start.sh** | Startup script with colored output | | **ngrok.sh** | ngrok tunnel helper | | **test-setup.sh** | Setup verification | --- ## πŸ”‘ Important Environment Variables ```bash # Required export ALPHA_VANTAGE_API_KEY=your_key_here # Optional export PORT=3000 # Default: 3000 ``` **Make it permanent** (add to `~/.zshrc`): ```bash echo 'export ALPHA_VANTAGE_API_KEY=your_key' >> ~/.zshrc source ~/.zshrc ``` --- ## πŸŽ“ Key Technologies ### Backend - **TypeScript** - Type-safe JavaScript - **Express.js** - Web server - **@modelcontextprotocol/sdk** - MCP implementation - **Axios** - HTTP client - **Alpha Vantage API** - Stock market data ### Frontend - **HTML5** - Structure - **Tailwind CSS** - Styling - **DaisyUI** - UI components - **Anime.js** - Animations - **Vanilla JS** - Logic --- ## πŸ“± Screenshot Preview When you open `http://localhost:3000`, you'll see: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ πŸ“ˆ Top Movers Dashboard β”‚ β”‚ Real-time stock market gainers, losers... β”‚ β”‚ [Results: 10] [πŸ”„ Refresh] β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ πŸš€ Top Gainers β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚ β”‚ β”‚Tick β”‚ Price β”‚ Change β”‚ Change% β”‚ Volume β”‚β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚ β”‚ β”‚AAPL β”‚$150.25 β”‚ +$5.75 β”‚ +3.98% β”‚82,451,920β”‚β”‚ β”‚ β”‚TSLA β”‚$245.80 β”‚+$12.30 β”‚ +5.27% β”‚95,234,510β”‚β”‚ β”‚ β”‚... β”‚ ... β”‚ ... β”‚ ... β”‚ ... β”‚β”‚ β”‚ β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ [Similar tables for Top Losers and Most Active] ``` --- ## πŸ†˜ Troubleshooting ### "API key not set" ```bash export ALPHA_VANTAGE_API_KEY=your_key ./start.sh ``` ### Port 3000 in use ```bash PORT=3001 ./start.sh ``` ### Dependencies missing ```bash npm install npm run build ``` ### ngrok not found ```bash brew install ngrok ``` --- ## πŸš€ Development Commands ```bash # Install dependencies npm install # Build TypeScript npm run build # Dev mode (auto-reload) npm run dev # Production mode npm start # Watch mode (auto-rebuild) npm run watch # Verify setup ./test-setup.sh ``` --- ## πŸ“š Documentation Guide **New user?** Read in this order: 1. βœ… **START_HERE.md** (you are here) 2. **QUICKSTART.md** - Get running in 3 steps 3. **SETUP_COMPLETE.md** - Learn all features 4. **README.md** - Full reference **Developer?** Read these: 1. **ARCHITECTURE.md** - System design 2. **src/server.ts** - Backend code 3. **public/index.html** - Frontend code --- ## πŸŽ‰ You're Ready! Everything is set up and ready to go! ### Next Actions: 1. **Get API key** from Alpha Vantage (free) 2. **Export it**: `export ALPHA_VANTAGE_API_KEY=your_key` 3. **Start server**: `./start.sh` 4. **Open browser**: `http://localhost:3000` 5. **See live stock data!** πŸ“ˆ ### Optional: - Run `./ngrok.sh` for public access - Read `ARCHITECTURE.md` to understand the system - Customize `public/index.html` to change the UI - Add more tools to `src/server.ts` --- ## πŸ’‘ Pro Tips 1. **Permanent API Key**: Add to `~/.zshrc` so you don't have to export it every time 2. **Rate Limits**: Free tier has 5 req/min, 500/day - add caching if needed 3. **Customize UI**: Edit `public/index.html` - it uses DaisyUI + Tailwind 4. **Add Tools**: Extend `src/server.ts` with more MCP tools 5. **Deploy**: Use Heroku, Vercel, or AWS for production --- ## πŸ”— Useful Links - **Alpha Vantage API**: https://www.alphavantage.co/documentation/ - **MCP Documentation**: https://modelcontextprotocol.io/ - **DaisyUI Components**: https://daisyui.com/ - **Anime.js**: https://animejs.com/ --- ## ✨ Features at a Glance βœ… TypeScript for type safety βœ… Express.js REST API βœ… MCP SDK integration βœ… Alpha Vantage stock data βœ… Auto-load on page open βœ… Responsive dark mode UI βœ… Smooth animations βœ… Color-coded changes βœ… Adjustable result limits βœ… Manual refresh βœ… ngrok ready βœ… Error handling βœ… Helper scripts βœ… Complete documentation --- **Happy Trading! πŸ“ˆπŸ“Š** Questions? Check the README.md or ARCHITECTURE.md!

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bobhuff0/MCPAddIn'

If you have feedback or need assistance with the MCP directory API, please join our Discord server