TikTok Video Discovery MCP server

Automates TikTok video discovery through hashtag searches and trending content retrieval with anti-detection measures for content analysis and social media research.
Back to servers
Provider
yap
Release date
Mar 31, 2025
Language
Python
Stats
28 stars

TikTok MCP Service is a Model Context Protocol service that allows you to search for TikTok videos by hashtags and extract metadata. The service includes anti-detection measures and robust error handling to ensure reliable access to TikTok content.

Configuration

The service uses environment variables for configuration. Create a .env file with:

ms_token=your_tiktok_ms_token  # Optional but recommended to avoid bot detection
TIKTOK_PROXY=your_proxy_url    # Optional proxy configuration

Installation and Setup

To install and run the TikTok MCP Service:

# Install dependencies
poetry install

# Install browser automation dependencies
poetry run python -m playwright install

# Start the service
poetry run python -m tiktok_mcp_service.main

Claude Desktop Integration

To integrate the service with Claude Desktop:

# Navigate to the project directory
cd /path/to/tiktok-mcp-service

# Install the service in Claude Desktop with Poetry in editable mode
poetry run mcp install tiktok_mcp_service/main.py --with-editable . -f .env

# Optional: Install with a custom name
poetry run mcp install tiktok_mcp_service/main.py --name "TikTok Video Search" --with-editable . -f .env

API Endpoints

Health Check

The health check endpoint allows you to verify the service is running properly:

GET /health

Example response:

{
  "status": "running",
  "api_initialized": true,
  "service": {
    "name": "TikTok MCP Service",
    "version": "0.1.0",
    "description": "A Model Context Protocol service for searching TikTok videos"
  }
}

Search Videos

To search for videos with specific hashtags:

POST /search

Request body:

{
  "search_terms": ["python", "coding"],
  "count": 30
}

The count parameter is optional and defaults to 30 videos.

The response includes video URLs, descriptions, and engagement statistics (views, likes, shares, comments).

Resource Management

To clean up resources and API sessions:

POST /cleanup

Error Handling

The service includes error handling for various scenarios:

  • API initialization failures
  • Bot detection issues
  • Network errors
  • Rate limiting
  • Invalid search terms

If you encounter errors, check your ms_token and proxy configuration to ensure they're valid and active.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later