# jaipandya/producthunt-mcp-server architecture

> Architecture diagram of the GitHub repository jaipandya/producthunt-mcp-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaipandya/producthunt-mcp-server
- Repository: https://github.com/jaipandya/producthunt-mcp-server

## Overview

##### Project type and purpose
- This is an open-source MCP (Model Context Protocol) server implemented in Python.
- It acts as a plug-and-play adapter: accepts MCP requests from any LLM/agent client (e.g., Claude Desktop, Cursor) and translates them into calls against the Product Hunt REST API.
- Its core use case is to expose Product Hunt data (posts, comments, topics, users, etc.) over the MCP interface.

##### File structure
- Top level
- Dockerfile, .dockerignore – containerization
- pyproject.toml – build & dependencies
- src/product_hunt_mcp – main Python package
- tests – unit tests
- src/product_hunt_mcp subpackages
- cli.py – command-line entry point that launches the MCP server
- api/ – HTTP client logic and GraphQL/REST query definitions
- schemas/ – Pydantic or attrs definitions for response validation
- tools/ – individual “get_posts”, “get_user”, etc. MCP tool handlers
- utils/ – shared helpers (rate limiting, token management, common functions)

##### README for additional insights
- Uses FastMCP under the hood for speed & compatibility
- Exposes ~15 MCP tools (get_post_details, search_topics, check_server_status…)
- Requires PRODUCT_HUNT_TOKEN environment variable for authentication
- Offers Docker support and a simple CLI (“product-hunt-mcp”) that stays running to accept piped MCP messages

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Client
    MCPClient(["MCP Client"]):::external

    %% Internal Components
    CLI(["CLI/Launcher\n(product-hunt-mcp)"]):::internal
    FastMCP(["FastMCP Server Core"]):::internal

    subgraph "Tool Handlers (tools)"
        COL(["collections"]):::tools
        COMT(["comments"]):::tools
        PST(["posts"]):::tools
        TOP(["topics"]):::tools
        USR(["users"]):::tools
        SSV(["server-status"]):::tools
    end

    subgraph "Domain Logic"
        subgraph "API Client Layer"
            CLIENT(["client.py"]):::api
            QUERIES(["queries.py"]):::api
        end
        SCHEMA(["validation.py"]):::schema
        subgraph "Utils"
            COMMON(["common.py"]):::util
            RL(["rate_limit.py"]):::util
            TOKEN(["token.py"]):::util
            UVAL(["validation.py"]):::util
        end
    end

    EXTAPI(["Product Hunt REST API"]):::external

    subgraph "Deployment & Config"
        DOCKERFILE(["Dockerfile"]):::deploy
        IGNORE([".dockerignore"]):::deploy
        PYPROJECT(["pyproject.toml"]):::deploy
        README(["README.md\n(PRODUCT_HUNT_TOKEN)"]):::deploy
    end

    %% Flows
    MCPClient -->|"stdin/stdout"| CLI
    CLI -->|"init registers tools"| FastMCP
    FastMCP -->|"routes requests"| COL
    FastMCP --> COMT
    FastMCP --> PST
    FastMCP --> TOP
    FastMCP --> USR
    FastMCP --> SSV

    COL -->|"calls"| CLIENT
    COMT --> CLIENT
    PST --> CLIENT
    TOP --> CLIENT
    USR --> CLIENT
    SSV --> CLIENT

    CLIENT -->|"HTTP calls"| EXTAPI
    EXTAPI -->|"response"| CLIENT
    CLIENT --> SCHEMA
    CLIENT --> COMMON
    COMMON --> RL
    COMMON --> TOKEN
    COMMON --> UVAL
    SCHEMA --> COMMON

    CLIENT --> FastMCP
    COMMON --> FastMCP

    %% Click Events
    click CLI "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/cli.py"
    click COL "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/collections.py"
    click COMT "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/comments.py"
    click PST "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/posts.py"
    click TOP "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/topics.py"
    click USR "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/users.py"
    click SSV "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/tools/server.py"
    click CLIENT "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/api/client.py"
    click QUERIES "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/api/queries.py"
    click SCHEMA "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/schemas/validation.py"
    click COMMON "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/utils/common.py"
    click RL "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/utils/rate_limit.py"
    click TOKEN "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/utils/token.py"
    click UVAL "https://github.com/jaipandya/producthunt-mcp-server/blob/main/src/product_hunt_mcp/utils/validation.py"
    click DOCKERFILE "https://github.com/jaipandya/producthunt-mcp-server/tree/main/Dockerfile"
    click IGNORE "https://github.com/jaipandya/producthunt-mcp-server/blob/main/.dockerignore"
    click PYPROJECT "https://github.com/jaipandya/producthunt-mcp-server/blob/main/pyproject.toml"
    click README "https://github.com/jaipandya/producthunt-mcp-server/blob/main/README.md"

    %% Styles
    classDef external fill:#f9f,stroke:#333
    classDef internal fill:#afa,stroke:#333
    classDef tools fill:#aef,stroke:#333
    classDef api fill:#fae,stroke:#333
    classDef schema fill:#ffb,stroke:#333
    classDef util fill:#aaf,stroke:#333
    classDef deploy fill:#ff9,stroke:#333
```
