MCP-Books-Service

MCP-Books-Service

3.3

This project demonstrates the implementation of Model Context Protocol (MCP) in a blog application system.

The MCP Blog Project is designed to showcase the integration of Model Context Protocol (MCP) within a blog application. It consists of three main components: a TypeScript-based MCP server, a mock service for book data using Express.js, and a Python-based MCP client. The MCP server facilitates communication between the client and the mock service, ensuring seamless data operations. The mock service provides endpoints for book-related operations, while the MCP client integrates with language models to handle queries. This setup allows for a structured and efficient interaction between language models and data services, making it a robust solution for applications requiring such integrations.

Features

  • TypeScript-based MCP server for type safety and efficient communication.
  • Express.js mock service for simulating book data operations.
  • Python MCP client with LLM integration using langchain_ollama.
  • Interactive CLI interface for user queries.
  • Stdio transport layer for server communication.

Usage with Different Platforms

Books MCP Server Setup

bash
cd books-mcp-server
npm install
npm run build

Books Mock Service Setup

bash
cd books-mock-service
npm install
npm run dev

MCP Client Setup

bash
cd mcp-client
# Create and activate virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
# Install dependencies (requirements.txt needed)
pip install langchain-ollama mcp-use

Start the mock service

bash
cd books-mock-service
npm run dev

Run the client

bash
cd mcp-client
python client.py