ChatGPT Book MCP Connector

ChatGPT Book MCP Connector

Enables ChatGPT to search for books via Algolia or mock data, returning rich book details.

Category
访问服务器

README

ChatGPT Book MCP Connector

A clean and simple monorepo containing a TypeScript Model Context Protocol (MCP) server and a local React testing UI.

This connector exposes a search_product tool that allows ChatGPT to search for books. ChatGPT connects to the server using Server-Sent Events (SSE) via the /mcp endpoint. When a search runs, the backend queries Algolia (or uses high-quality local mock data as a fallback), returning rich details for books (image, name, edition, author, purchase/details link, and format options). The React UI allows developers to preview how the book cards and grids will render inside ChatGPT, inspect raw JSON tool outputs, and test search functionality.

Folder Structure

chatgpt-book-mcp/
├── package.json               # Root monorepo configuration (npm workspaces)
├── README.md                  # This documentation file
├── mcp-server/                # Express-based SSE MCP Backend (TypeScript)
│   ├── package.json
│   ├── tsconfig.json
│   ├── src/
│   │   ├── index.ts           # SSE server & API gateway
│   │   ├── algolia.ts         # Algolia Integration & mock search fallback
│   │   └── types.ts           # Shareable book interfaces
│   └── scripts/
│       └── test-tool.ts       # CLI tool for testing the search tool
└── react-ui/                  # React Front-end Dashboard (TypeScript/Vite)
    ├── package.json
    ├── tsconfig.json
    ├── vite.config.ts
    ├── index.html
    └── src/
        ├── main.tsx
        ├── App.tsx            # Interactive developer sandbox dashboard
        ├── index.css          # Sleek modern styling (Vanilla CSS)
        ├── components/        # Beautiful responsive React widgets
        │   ├── SearchBar.tsx
        │   ├── ProductCard.tsx
        │   ├── ProductGrid.tsx
        │   └── RawJsonView.tsx
        └── services/
            └── mcpClient.ts   # Client helper to fetch search results

Quick Start

1. Prerequisites

Ensure you have Node.js (v18 or higher) and npm installed.

2. Install Dependencies

Run the following command in the root of the monorepo:

npm install

3. Set Up Environment Variables

Inside the mcp-server directory, create a .env file (you can copy .env.example as a template):

cp mcp-server/.env.example mcp-server/.env

By default, if no credentials are provided in .env, the server will gracefully fallback to returning high-fidelity Mock Book Data so that you can run and test everything out-of-the-box. To connect your live books database, configure the Algolia credentials:

PORT=3000
ALGOLIA_APP_ID=your_algolia_app_id
ALGOLIA_API_KEY=your_algolia_search_only_api_key
ALGOLIA_INDEX_NAME=your_book_index_name

4. Run Development Servers

Start both the Backend SSE Server (port 3000) and Frontend React Testbed (port 5173) concurrently:

npm run dev

Testing the Setup

Method 1: Local React Sandbox Dashboard (Recommended)

Open your browser and navigate to:

http://localhost:5173
  • Use the sleek search bar to query books like "Harry Potter", "Clean Code", "JavaScript", or "Design".
  • Toggle the JSON Inspect panel to view the exact structure sent back by the backend tool.
  • Interact with the responsive Book Grid and view the custom Book Cards with cover art, author names, editions, available formats (e.g. Hardcover, Paperback, E-book), and product links.

Method 2: Command Line Tester (MCP CLI Tool)

You can directly run a query against the MCP server tool from the command line:

npm run test-tool -- "Clean Code"

This runs mcp-server/scripts/test-tool.ts using tsx, sending the query to the tool handler and outputting the formatted JSON-RPC result in your terminal.


Integrating with ChatGPT

To register this connector as a custom application in ChatGPT:

  1. Deploy the mcp-server to a publicly accessible HTTPS endpoint (or use a local tunnel like ngrok or localtunnel during development: ngrok http 3000).
  2. In ChatGPT, go to Explore GPTs -> Create a GPT -> Configure -> Actions -> Add Action (or the corresponding Custom MCP Settings).
  3. Provide the SSE endpoint URL. ChatGPT will initiate connection to:
    https://<your-deployed-domain>/mcp
    
  4. Once connected, ChatGPT can invoke the search_product tool automatically when users ask questions like "Find books about Javascript" or "Show me editions of Harry Potter".
  5. The JSON-RPC response returned by the server will then be formatted by ChatGPT. You can styling-guide ChatGPT using standard system instructions to list details or output the widget values.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选