SM

stijn-meijers/dracor-mcp

开发工具

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

6 stars 3 forks 质量 64 趋势 14MIT

A Model Context Protocol (MCP) server for interacting with the Drama Corpora Project (DraCor) API. This MCP server enables you to seamlessly analyze dramatic texts and their character networks...

概览

A Model Context Protocol (MCP) server for interacting with the Drama Corpora Project (DraCor) API. This MCP server enables you to seamlessly analyze dramatic texts and their character networks through Claude or other LLMs. This project implements an MCP server using the official Model Context Protocol Python SDK that provides access to the DraCor API v1. It allows Claude and other LLMs to interact with dramatic text corpora, analyze character networks, retrieve play information, and generate insights about dramatic works across different languages and periods. The project includes two implementations: 1. dracor_mcp_fastmcp.

README

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

DraCor MCP Server

A Model Context Protocol (MCP) server for interacting with the Drama Corpora Project (DraCor) API. This MCP server enables you to seamlessly analyze dramatic texts and their character networks through Claude or other LLMs.

Overview

This project implements an MCP server using the official Model Context Protocol Python SDK that provides access to the DraCor API v1. It allows Claude and other LLMs to interact with dramatic text corpora, analyze character networks, retrieve play information, and generate insights about dramatic works across different languages and periods.

The project includes two implementations:

  1. dracor_mcp_fastmcp.py - Streamlined implementation using the FastMCP decorator-based API with v1 API

Features

  • Access to DraCor API v1 through a unified interface
  • No authentication required (DraCor API is publicly accessible)
  • Structured data models for DraCor entities
  • Support for operations:
    • Corpora and play information retrieval
    • Character network analysis
    • Metrics and statistics for plays
    • Character information and spoken text
    • Comparative play analysis
    • Search functionality
    • Character relationship data
    • Network data in multiple formats (CSV, GEXF, GraphML)
    • Gender analysis across plays
    • Full text retrieval in plain text and TEI XML formats
    • Complete play text analysis

Setup

Prerequisites

  • Python 3.10 or higher
  • UV package manager (recommended) or pip

Installation with UV

  1. Install UV:
pip install uv
  1. Create a virtual environment and install dependencies:
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .
  1. Install the MCP server in Claude Desktop:

For standard implementation (v0 API):

mcp install dracor_mcp_server.py

Or for FastMCP implementation with v1 API (recommended):

mcp install dracor_mcp_fastmcp.py

Development Mode

For testing and development:

mcp dev dracor_mcp_server.py

Or for FastMCP implementation with v1 API (recommended):

mcp dev dracor_mcp_fastmcp.py

This will launch the MCP Inspector where you can test your tools and resources interactively.

Claude Configuration

You can also directly configure Claude to use the DraCor MCP server by adding the following to your Claude configuration file:

{
  "mcpServers": {
    "DraCor API v1": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "requests",
        "--with",
        "pydantic",
        "--with",
        "python-multipart",
        "mcp",
        "run",
        "/path/to/dracor-mcp/dracor_mcp_fastmcp.py"
      ],
      "env": {
        "DRACOR_API_BASE_URL": "https://dracor.org/api/v1"
      }
    }
  }
}
在 GitHub 查看完整 README

安装

docker run dracor-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "DraCor API v1": { "command": "uv", "args": [ "run", "--with", "mcp[cli]", "--with", "requests", "--with", "pydantic", "--with", "python-multipart", "mcp", "run", "/path/to/dracor-mcp/dracor_mcp_fastmcp.py" ], "env": { "DRACOR_API_BASE_URL": "https://dracor.org/api/v1" } } } }