PC

ps-copilot-sandbox/copilot-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

1 stars 12 forks 质量 53 趋势 5

This is a small MCP (Model Context Protocol) demo server used during the GitHub Copilot Agents and MCP training sessions. It used by a demo explained in the copilot-agent-and-mcp repository.

概览

This is a small MCP (Model Context Protocol) demo server used during the GitHub Copilot Agents and MCP training sessions. It used by a demo explained in the copilot-agent-and-mcp repository. Book Database MCP Server exposes a simple set of tools that let an MCP-capable agent or client query a curated book database. Key features: - Retrieve a book's basic information (ISBN, title, author) by title. - Retrieve detailed book information (summary, date, author) by ISBN. - Batch queries: request multiple books by a list of titles or ISBNs. - Uses small JSON files as the backing dataset (easy to read and modify for demos). - Runtime: Node.js (TypeScript source in src/). - Protocol: Model Context Protocol (MCP) using @modelcontextprotocol/sdk. - Transport: Standard I/O transport (StdioServerTransport) — this server communicates over stdio. - Validation: Input schemas are validated with zod for each tool. - Data: src/data/books.json (basic list) and src/data/books-details.

README

以下为原文 README 节选,完整内容请查看原文。

Book Database MCP Server

[!NOTE] This is a small MCP (Model Context Protocol) demo server used during the GitHub Copilot Agents and MCP training sessions. It used by a demo explained in the copilot-agent-and-mcp repository.

Functional

Book Database MCP Server exposes a simple set of tools that let an MCP-capable agent or client query a curated book database. Key features:

  • Retrieve a book’s basic information (ISBN, title, author) by title.
  • Retrieve detailed book information (summary, date, author) by ISBN.
  • Batch queries: request multiple books by a list of titles or ISBNs.
  • Uses small JSON files as the backing dataset (easy to read and modify for demos).

Technical

  • Runtime: Node.js (TypeScript source in src/).
  • Protocol: Model Context Protocol (MCP) using @modelcontextprotocol/sdk.
  • Transport: Standard I/O transport (StdioServerTransport) — this server communicates over stdio.
  • Validation: Input schemas are validated with zod for each tool.
  • Data: src/data/books.json (basic list) and src/data/books-details.json (summaries and dates).
  • Tools implemented in src/index.ts:
    • get-book-by-isbn — takes isbn: string (10 chars)
    • get-book-by-title — takes title: string
    • get-books-by-titles — takes titles: string[]
    • get-books-by-isbn-list — takes isbnList: string[] (10-char items)

Setup

Prerequisites: Node.js (18+ recommended) and npm.

  1. Clone the repository and enter the demo folder:
git clone 
cd 
  1. Install dependencies:
npm install
  1. Build the TypeScript sources:
npm run build

The build produces build/index.js and the build folder is listed in package.json files.

Run

Start the MCP server (it runs on stdio and writes a startup log to stderr):

node build/index.js

When running successfully you should see an informational message on stderr similar to:

Book database MCP Server running on stdio

You don’t need to start the server manually during the demo as it will be started by the MCP server configuration in the webapp demo repository.

Usage examples

The server exposes the tool names listed above. Example calls (conceptual):

  • Get details by ISBN:

    • Tool: get-book-by-isbn
    • Input: { "isbn": "0451524935" } # returns details for “1984”
  • Get basic info by title:

    • Tool: get-book-by-title
    • Input: { "title": "The Hobbit" }
  • Batch lookup by titles:

    • Tool: get-books-by-titles
    • Input: { "titles": ["1984", "Brave New World"] }

Data

The datasets are small JSON files in src/data/ so you can easily tweak entries during a workshop:

  • src/data/books.json — array of simple book objects (ISBN, title, author)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →