mcp-open-library

by 8enSmith
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Referenced in the repository URL for cloning the project.

  • Used for package management and running scripts.

  • Used for code formatting in the development workflow.

MCPオープンライブラリ

AI アシスタントが書籍や著者の情報を検索できるようにする Open Library API 用のモデル コンテキスト プロトコル (MCP) サーバー。

概要

このプロジェクトは、AIアシスタントがOpen Libraryと連携するためのツールを提供するMCPサーバーを実装します。タイトルによる書籍情報の検索、著者名による著者検索、Open Libraryキーを使用した著者詳細情報の取得、Open Library ID(OLID)を使用した著者写真のURLの取得が可能です。サーバーは書籍と著者情報の構造化データを返します。

特徴

  • タイトルによる書籍検索: タイトルで書籍を検索し、詳細情報を取得します
  • 著者名による検索: 著者名で著者を検索し、関連する詳細情報を取得します。
  • 構造化レスポンスフォーマット: 書籍と著者の情報を一貫したJSON構造で返します
  • エラー処理: 適切な検証とエラー報告
  • テスト: Vitestによる包括的なテストカバレッジ

インストール

# Clone the repository git clone https://github.com/your-username/mcp-open-library.git cd mcp-open-library # Install dependencies npm install # Build the project npm run build

使用法

サーバーの実行

MCP Inspector を使用してサーバーをテストできます。

npm run inspector

MCP Inspectorにアクセスし、ツールをテストします。

MCPクライアントでの使用

このサーバーはモデルコンテキストプロトコル(MCP)を実装しており、MCP対応のAIアシスタントやクライアント(例: Claude Desktop)から利用できます。サーバーは以下のツールを公開しています。

  • get_book_by_title : タイトルで書籍情報を検索する
  • get_authors_by_name : 著者情報を名前で検索する
  • get_author_info : Open Library Author Keyを使用して特定の著者の詳細情報を取得します。
  • get_author_photo : Open Library Author ID (OLID) を使用して著者の写真の URL を取得します。

get_book_by_title入力例:

{ "title": "The Hobbit" }

get_book_by_title出力例:

[ { "title": "The Hobbit", "authors": [ "J. R. R. Tolkien" ], "first_publish_year": 1937, "open_library_work_key": "/works/OL45883W", "edition_count": 120, "cover_url": "https://covers.openlibrary.org/b/id/10581294-M.jpg" } ]

get_authors_by_name入力例:

{ "name": "J.R.R. Tolkien" }

get_authors_by_name出力例:

[ { "key": "OL26320A", "name": "J. R. R. Tolkien", "alternate_names": [ "John Ronald Reuel Tolkien" ], "birth_date": "3 January 1892", "top_work": "The Hobbit", "work_count": 648 } ]

get_author_info入力例:

{ "author_key": "OL26320A" }

get_author_info出力例:

{ "name": "J. R. R. Tolkien", "personal_name": "John Ronald Reuel Tolkien", "birth_date": "3 January 1892", "death_date": "2 September 1973", "bio": "John Ronald Reuel Tolkien (1892-1973) was a major scholar of the English language, specializing in Old and Middle English. He served as the Rawlinson and Bosworth Professor of Anglo-Saxon and later the Merton Professor of English Language and Literature at Oxford University.", "alternate_names": ["John Ronald Reuel Tolkien"], "photos": [6791763], "key": "/authors/OL26320A", "remote_ids": { "viaf": "95218067", "wikidata": "Q892" }, "revision": 43, "last_modified": { "type": "/type/datetime", "value": "2023-02-12T05:50:22.881" } }

get_author_photo入力例:

{ "olid": "OL26320A" }

get_author_photo出力例:

https://covers.openlibrary.org/a/olid/OL26320A-L.jpg

Claude Desktop で使用されているこのツールの例は、こちらでご覧いただけます。

ドッカー

このMCPサーバーはDockerを使ってテストできます。まずは以下を実行してください。

docker build -t mcp-open-library . docker run -p 8080:8080 mcp-open-library

その後、インスペクタを使用してDocker内で実行されているサーバーをテストできます。

pnpm run inspector http://localhost:8080

発達

プロジェクト構造

  • src/index.ts - メインサーバーの実装
  • src/types.ts - TypeScript 型定義
  • src/index.test.ts - テストスイート

利用可能なスクリプト

  • npm run build - TypeScriptコードをビルドする
  • npm run watch - 変更を監視して再構築する
  • npm test - テストスイートを実行する
  • npm run format - Prettier でコードをフォーマットする
  • npm run inspector - サーバーに対してMCPインスペクターを実行します

テストの実行

npm test

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

謝辞

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

AI アシスタントが書籍情報を検索できるようにする Open Library API 用の Model Context Protocol (MCP) サーバー。

  1. Overview
    1. Features
      1. Installation
        1. Usage
          1. Running the Server
          2. Using with an MCP Client
          3. Docker
        2. Development
          1. Project Structure
          2. Available Scripts
          3. Running Tests
        3. Contributing
          1. Acknowledgments
            ID: qhkblspta2