Video Metadata MCP Server

Video Metadata MCP Server

Manages sports video metadata with CRUD operations for game information, teams, scores, and statistics. Enables advanced search filtering by game type, teams, league, season, and date ranges through PostgreSQL integration.

Category
访问服务器

README

Video Metadata MCP Server

A Model Context Protocol (MCP) server for managing video metadata with game information, teams, scores, and other sports-related data. This server uses PostgreSQL as the database backend.

Features

  • CRUD Operations: Create, read, update, and delete video metadata records
  • Advanced Search: Filter videos by game type, teams, league, season, tags, and date ranges
  • PostgreSQL Integration: Robust database with JSONB support for flexible data storage
  • MCP Protocol: Compatible with Claude Desktop and other MCP clients
  • Rich Metadata: Support for game statistics, player data, venues, and more

Database Schema

The server manages video metadata with the following fields:

  • id: Unique identifier (auto-generated)
  • title: Video title
  • game_type: Type of game (e.g., "basketball", "football", "soccer")
  • teams: Array of participating team names
  • score: Final score as a string
  • duration_seconds: Video duration in seconds
  • video_url: URL to the video file
  • thumbnail_url: URL to the thumbnail image
  • description: Video description
  • tags: Array of tags for categorization
  • player_stats: JSON object containing player statistics
  • match_date: Date when the match was played
  • venue: Location where the match took place
  • league: League or competition name
  • season: Season identifier
  • created_at / updated_at: Timestamps

Prerequisites

  • Node.js (v18 or higher)
  • PostgreSQL (v12 or higher)
  • npm or yarn

Installation

  1. Clone and setup the project:

    git clone <repository-url>
    cd metadata-mcp
    npm install
    
  2. Configure PostgreSQL:

    • Ensure PostgreSQL is running
    • Create a database named video_metadata (or use your preferred name)
    • Copy .env.example to .env and update the database credentials:
    cp .env.example .env
    
  3. Update environment variables in .env:

    POSTGRES_USER=your_username
    POSTGRES_PASSWORD=your_password
    POSTGRES_HOST=localhost
    POSTGRES_PORT=5432
    POSTGRES_DB=video_metadata
    
  4. Build the project:

    npm run build
    
  5. Initialize the database with sample data:

    npm run setup
    

Usage

Running the MCP Server

npm start

The server will run on stdio and can be connected to by MCP clients.

Available Tools

The server provides the following tools:

1. list_video_metadata

Get all video metadata records.

2. get_video_metadata

Get a specific video metadata record by ID.

  • Parameters: id (number)

3. search_video_metadata

Search video metadata with filters.

  • Parameters:
    • game_type (string, optional)
    • teams (array of strings, optional)
    • league (string, optional)
    • season (string, optional)
    • tags (array of strings, optional)
    • match_date_from (ISO date string, optional)
    • match_date_to (ISO date string, optional)

4. create_video_metadata

Create a new video metadata record.

  • Required Parameters: title, game_type, teams
  • Optional Parameters: All other fields

5. update_video_metadata

Update an existing video metadata record.

  • Required Parameters: id
  • Optional Parameters: Any field to update

6. delete_video_metadata

Delete a video metadata record.

  • Parameters: id (number)

7. get_game_types

Get all unique game types from the database.

8. get_teams

Get all unique teams from the database.

9. get_leagues

Get all unique leagues from the database.

Example Usage with Claude Desktop

Add this to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "video-metadata": {
      "command": "node",
      "args": ["/path/to/metadata-mcp/build/index.js"],
      "env": {
        "POSTGRES_USER": "your_username",
        "POSTGRES_PASSWORD": "your_password",
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_DB": "video_metadata"
      }
    }
  }
}

Sample Data

The setup script includes sample data for:

  • NBA Finals Game 7 (Lakers vs Celtics)
  • Super Bowl LVIII (Chiefs vs 49ers)
  • Champions League Final (Real Madrid vs Liverpool)

Development

Project Structure

src/
├── index.ts        # Main MCP server implementation
├── database.ts     # Database manager and schema
└── setup.ts        # Database initialization script

build/              # Compiled JavaScript files
tsconfig.json       # TypeScript configuration
package.json        # Dependencies and scripts
.env.example        # Environment variables template

Building

npm run build

Adding New Features

  1. Extend the VideoMetadata interface in database.ts
  2. Add corresponding database schema changes in initializeSchema()
  3. Implement new tools in the MCP server (index.ts)
  4. Add validation schemas using Zod

Database Indexes

The following indexes are automatically created for optimal performance:

  • idx_video_metadata_game_type: On game_type field
  • idx_video_metadata_teams: GIN index on teams JSONB array
  • idx_video_metadata_tags: GIN index on tags JSONB array
  • idx_video_metadata_match_date: On match_date field
  • idx_video_metadata_league: On league field

Error Handling

The server includes comprehensive error handling:

  • Database connection errors
  • Invalid parameter validation (using Zod schemas)
  • Resource not found errors
  • Proper MCP error codes and messages

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

License

MIT License - see LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选