bookstore-mcp-server
An MCP server that exposes tools for querying a bookstore inventory, allowing AI agents to search and retrieve book information via the Model Context Protocol.
README
Simple MCP Server for an Online Bookstore with Custom AI Agent - POC
👁️ Overview
This project is a proof-of-concept implementation of a Model Context Protocol (MCP) server and a custom AI-powered bookstore agent. It demonstrates how an LLM can call structured tools exposed by an MCP server (e.g., search books) and how a separate agent process can communicate with that server to provide conversational responses.
The repo contains:
-
An MCP server
- Built using
@modelcontextprotocol/sdk - Exposes a sample of bookstore-related tools (e.g., fetching books)
- Includes a seeding script to populate mock bookstore data
- Built using
-
A custom bookstore AI Agent
- Connects to the MCP server as a client via a dedicated MCP client service:
- Uses
@modelcontextprotocol/sdkwith an STDIO-based process transport to talk to the MCP server. - Discovers available MCP tools at runtime and invokes them dynamically
- Uses
- Uses OpenAI to answer user queries
- Decides when to call MCP tools to fetch inventory data
- Can respond normally or stream responses token-by-token
- Connects to the MCP server as a client via a dedicated MCP client service:
-
A lightweight Express API provides endpoints for:
- non-streaming LLM answers
- streaming LLM answers (chunked over HTTP)
- Demonstrates how a backend service can expose the agent to external clients
🛠️ Tech Stack
- Model Context Protocol (MCP) – structured tool calling using
@modelcontextprotocol/sdk - OpenAI API – LLM responses + streaming output
- Express 5 – simple HTTP layer
- TypeScript – typed agent + server
- Zod – schema validation
- Firebase Firestore - for bookstore database
GitHub Branches
-
main– Production branch. This branch represents the stable and production-ready version of the code. It is used for deployments to the live environment. -
dev– Development branch. This is the default branch for ongoing development work. It is where new features and bug fixes are implemented and tested before being merged into the main branch. It is used for deployments to the staging environment.
Development
Scripts
npm run dev:server– Run the MCP server in development mode with hot-reloadingnpm run dev:agent– Run the Bookstore Agent in development mode with hot-reloadingnpm run build– Compile the TypeScript code to JavaScriptnpm run start:server– Start the MCP server in production modenpm run start:agent– Start the Bookstore Agent in production modenpm run seed:bookstore– Seed the Firestore database with mock bookstore data
Testing the MCP server locally using Claude Client
-
Download Claud Desktop
-
Locate the config file
From Claud App -> Settings > Developer -> Edit config
The path is probably:
code "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
- Prepare the config file
# check the absolute path to the server
❯ pwd
Ensure Claude will run the correct version of Node:
which node
# should output smt like
> /Users/mistergreen/.nvm/versions/node/v22.17.0/bin/node
Use this path as command in the server config below (instead of using simply node)
Option A – Use the built JS file
If you run npm run build and want Claude to call the compiled JS:
{
"mcpServers": {
"demo-server": {
"command": "/Users/mistergreen/.nvm/versions/node/v22.17.0/bin/node",
"args": ["<ABSOLUTE-PATH>/dist/mcp-server/index.js"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Option B – Run TypeScript directly (good for dev)
If you don’t want to build every time, Claude can launch your server through tsx:
{
"mcpServers": {
"demo-server": {
"command": "/Users/mistergreen/.nvm/versions/node/v22.17.0/bin/node",
"args": ["<ABSOLUTE-PATH>/node_modules/tsx/dist/cli.js", "<ABSOLUTE-PATH>/src/mcp-server/index.ts"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
- Test
-
Save the config.json.
-
Quit and restart Claude Desktop.
-
Testing tools: Start a new chat and try:
- Use the add tool with a=2 and b=3
- Claud should discover the add tool.
- Debug
- From Claud App -> Settings > Developer -> Logs
Testing the agent API
- Start the MCP server
npm run dev:server
- Start the agent API
npm run dev:agent
- Send requests to the agent API
E.g. using curl:
curl -X POST http://localhost:5000/ask \
-H "Content-Type: application/json" \
-d '{"question": "Can you recommend me a sci-fi book?"}'
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。