Sponsored by Deepsite.site

TAM-MCP-Server

Created By
gvaibhav6 months ago
A comprehensive **Model Context Protocol (MCP)** server for market sizing analysis, TAM/SAM calculations, and industry research. Built with TypeScript, Express.js, and following the MCP 2024-11-05 specification.
Content

Market Sizing MCP Server

GitHub stars GitHub forks GitHub issues GitHub license TypeScript Node.js MCP

A comprehensive Model Context Protocol (MCP) server for market sizing analysis, TAM/SAM calculations, and industry research. Built with TypeScript, Express.js, and following the MCP 2024-11-05 specification.

🚀 Features

Core Capabilities

  • 10 Specialized Market Analysis Tools for comprehensive market research
  • HTTP Streamable Transport with Server-Sent Events for real-time updates
  • Advanced Caching System with configurable TTL and performance optimization
  • Comprehensive Logging with structured Winston logging and business metrics
  • Prometheus Metrics for monitoring and observability
  • Enterprise Security with rate limiting, CORS, and input validation
  • Session Management for stateful interactions

Market Analysis Tools

  1. 🔍 Industry Search - Find and explore industry sectors and categories
  2. 📊 Industry Data - Get detailed industry statistics and metrics
  3. 📈 Market Size - Calculate current market size with multiple methodologies
  4. 🎯 TAM Calculator - Total Addressable Market analysis and calculations
  5. 🎪 SAM Calculator - Serviceable Addressable Market segmentation
  6. 🧩 Market Segments - Detailed market segmentation analysis
  7. 📊 Market Forecasting - Future market projections and trend analysis
  8. ⚖️ Market Comparison - Compare multiple markets and industries
  9. ✅ Data Validation - Validate and verify market data accuracy
  10. 💡 Market Opportunities - Identify growth opportunities and market gaps

🛠 Installation

Prerequisites

  • Node.js 18+
  • npm or yarn
  • TypeScript 5+

Quick Start

# Clone the repository
git clone https://github.com/gvaibhav/TAM-MCP-Server.git
cd TAM-MCP-Server

# Install dependencies
npm install

# Copy environment configuration
cp .env.example .env

# Edit configuration (add your API keys)
nano .env

# Start development server
npm run dev

# Or build and run production
npm run build
npm start

Docker Installation

# Build Docker image
docker build -t tam-mcp-server .

# Run with Docker Compose
docker-compose up -d

# Or run standalone
docker run -p 3000:3000 -e NODE_ENV=production tam-mcp-server

📋 Configuration

Environment Variables

VariableDescriptionDefaultRequired
PORTServer port3000No
HOSTServer host0.0.0.0No
NODE_ENVEnvironmentdevelopmentNo
CORS_ORIGINCORS origin*No
RATE_LIMIT_MAXRate limit per window100No
CACHE_TTLCache TTL (seconds)300No
SESSION_SECRETSession secret key-Yes
MARKET_DATA_API_KEYMarket data provider API key-Recommended
LOG_LEVELLogging levelinfoNo

API Keys Configuration

The server supports multiple market data providers:

  • IBISWorld - Industry reports and analysis
  • Statista - Market statistics and data
  • Grand View Research - Market research reports
  • Bloomberg - Financial and market data
  • PitchBook - Private market data

Add your API keys to the .env file to enable real data integration.

🚦 API Endpoints

MCP Protocol Endpoints

  • GET /mcp/discovery - Server capabilities and tool discovery
  • POST /mcp/session - Create and manage MCP sessions
  • POST /mcp/tools/{tool_name} - Execute specific market analysis tools
  • GET /mcp/events - Server-Sent Events stream for real-time updates
  • GET /mcp/health - Health check and server status
  • GET /mcp/metrics - Prometheus metrics endpoint

Tool Execution Examples

# Search for industries
curl -X POST http://localhost:3000/mcp/tools/industry_search \
  -H "Content-Type: application/json" \
  -d '{"query": "artificial intelligence", "filters": {"region": "global"}}'

# Calculate TAM
curl -X POST http://localhost:3000/mcp/tools/calculate_tam \
  -H "Content-Type: application/json" \
  -d '{"industry": "SaaS", "geography": "North America", "timeframe": "2024"}'

# Get market forecast
curl -X POST http://localhost:3000/mcp/tools/forecast_market \
  -H "Content-Type: application/json" \
  -d '{"industry": "Cloud Computing", "years": 5, "methodology": "compound_growth"}'

🏗 Architecture

Project Structure

src/
├── index.ts              # Main entry point
├── server.ts             # Express server setup
├── types/
│   └── schemas.ts        # Zod schemas and TypeScript types
├── tools/
│   └── mcpTools.ts       # MCP tool implementations
├── services/
│   ├── dataService.ts    # Data operations and API integrations
│   └── cacheService.ts   # Caching service with NodeCache
└── utils/
    └── logger.ts         # Winston logging utility

Technology Stack

  • Runtime: Node.js 18+ with ES modules
  • Framework: Express.js with TypeScript
  • Validation: Zod for runtime type safety
  • Caching: NodeCache with TTL support
  • Logging: Winston with structured logging
  • Metrics: Prometheus client for monitoring
  • Security: Helmet, CORS, rate limiting
  • Transport: HTTP with Server-Sent Events

🧪 Testing

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run specific test suite
npm test -- --grep "MCPTools"

# Run integration tests
npm run test:integration

Test Structure

  • Unit Tests - Individual component testing
  • Integration Tests - API endpoint testing
  • Performance Tests - Load and stress testing
  • Security Tests - Vulnerability scanning

📊 Monitoring & Observability

Prometheus Metrics

The server exposes comprehensive metrics at /mcp/metrics:

  • Request Metrics - Request count, duration, status codes
  • Tool Metrics - Tool execution time and success rates
  • Cache Metrics - Hit/miss ratios and performance
  • Business Metrics - Market analysis usage patterns
  • System Metrics - Memory, CPU, and resource usage

Logging

Structured JSON logging with multiple levels:

// Business metrics logging
logger.business('market_analysis_completed', {
  tool: 'calculate_tam',
  industry: 'SaaS',
  result_size: 1234567890,
  execution_time: 1250
});

// Performance profiling
logger.profile('api_request', requestId);
// ... operation ...
logger.profile('api_request', requestId); // Logs duration

🔒 Security

Security Features

  • Rate Limiting - Configurable per-IP request limits
  • Input Validation - Zod schema validation for all inputs
  • CORS Protection - Configurable cross-origin policies
  • Security Headers - Helmet.js security headers
  • Session Management - Secure session handling
  • API Key Management - Secure API key storage and rotation

Production Security Checklist

  • Change default SESSION_SECRET
  • Configure specific CORS_ORIGIN
  • Set up HTTPS/TLS certificates
  • Configure firewall rules
  • Enable security monitoring
  • Set up log aggregation
  • Configure backup and recovery

🚀 Deployment

Docker Deployment

# docker-compose.yml
version: '3.8'
services:
  market-sizing-mcp:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - SESSION_SECRET=your-secure-secret
    volumes:
      - ./logs:/app/logs
    restart: unless-stopped

Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: market-sizing-mcp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: market-sizing-mcp
  template:
    metadata:
      labels:
        app: market-sizing-mcp
    spec:
      containers:
      - name: market-sizing-mcp
        image: market-sizing-mcp:latest
        ports:
        - containerPort: 3000
        env:
        - name: NODE_ENV
          value: "production"

Cloud Deployment

  • AWS: ECS, Lambda, or EC2 with Application Load Balancer
  • Google Cloud: Cloud Run, GKE, or Compute Engine
  • Azure: Container Instances, AKS, or App Service
  • Heroku: Direct deployment with buildpack

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes with tests
  4. Run linting: npm run lint:fix
  5. Run tests: npm test
  6. Commit with conventional commits: git commit -m "feat: add amazing feature"
  7. Push and create a Pull Request

Code Standards

  • TypeScript with strict mode enabled
  • ESLint for code linting
  • Prettier for code formatting
  • Conventional Commits for commit messages
  • 100% test coverage for new features

📝 Changelog

See CHANGELOG.md for version history and release notes.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

🙏 Acknowledgments

  • Model Context Protocol specification by Anthropic
  • Market Research Community for methodology guidance
  • Open Source Contributors who made this project possible

Created by Gvaibhav with ❤️ for the market research and business intelligence community

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Serper MCP ServerA Serper MCP Server
ChatWiseThe second fastest AI chatbot™
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
DeepChatYour AI Partner on Desktop
Amap Maps高德地图官方 MCP Server