Movie Search MCP Server
# ๐ฌ Movie Search MCP Server
A complete MCP (Model Context Protocol) server for searching and obtaining detailed movie information using OMDb (IMDB) and TMDb APIs.
## ๐ Features
- โ
Search movies by title and year
- โ
Detailed movie information (synopsis, director, actors, etc.)
- โ
Genre-based recommendations
- โ
Popular/trending movies
- โ
Support for multiple APIs (OMDb + TMDb)
- โ
English responses
- โ
Robust error handling
## ๐ Requirements
- Node.js 18+
- TypeScript
- API keys (see configuration)
## ๐ ๏ธ Installation
1. **Clone or create the project:**
```bash
git clone <repo> # or create a new folder
cd movie-mcp
```
2. **Install dependencies:**
```bash
npm install
```
3. **Build the project:**
```bash
npm run build
```
## ๐ API Configuration
### OMDb API (Free)
1. Go to: https://www.omdbapi.com/apikey.aspx
2. Register to get your free API key
3. Add the environment variable: `OMDB_API_KEY=your_api_key`
### TMDb API (Free)
1. Go to: https://www.themoviedb.org/settings/api
2. Register and request an API key
3. Add the environment variable: `TMDB_API_KEY=your_api_key`
### Environment Variables
Create a `.env` file in the project root:
```bash
OMDB_API_KEY=your_omdb_api_key
TMDB_API_KEY=your_tmdb_api_key
```
## ๐ฏ Available Tools
### 1. `search_movies`
Search movies by title and optionally by year.
**Parameters:**
- `title` (string, required): Movie title
- `year` (string, optional): Movie year
**Example:**
```
Search movies with title "Batman" from year "2008"
```
### 2. `get_movie_details`
Get complete information for a specific movie.
**Parameters:**
- `id` (string, required): Movie ID (IMDB ID or TMDb ID)
- `source` (string, optional): 'omdb' or 'tmdb' (default: 'omdb')
**Example:**
```
Get details for movie with ID "tt0468569" using source "omdb"
```
### 3. `recommend_movies`
Get movie recommendations by genre.
**Parameters:**
- `genre` (string, optional): Specific genre
**Available genres:**
- action, adventure, animation, comedy, crime
- documentary, drama, family, fantasy, history
- horror, music, mystery, romance, science fiction
- thriller, war, western
**Example:**
```
Recommend me "action" movies
```
### 4. `popular_movies`
Get the most popular movies of the week.
**Parameters:** None
**Example:**
```
What are the popular movies?
```
### 5. `movie_help`
Show help information about all available tools.
## ๐ง Cursor Configuration
To use this MCP server in Cursor, add the following configuration to your `.cursor/mcp.json` file:
```json
{
"mcpServers": {
"movie-search": {
"command": "node",
"args": ["/full/path/to/your/project/dist/index.js"],
"env": {
"OMDB_API_KEY": "your_omdb_api_key",
"TMDB_API_KEY": "your_tmdb_api_key"
}
}
}
}
```
## ๐ฎ Usage in Cursor
Once configured, you can use the tools directly in Cursor:
```
// Search movies
"Search movies of Batman from 2008"
// Get details
"Give me details of movie tt0468569"
// Recommendations
"Recommend me action movies"
// Popular movies
"What are the popular movies this week?"
// Help
"Show me the movie server help"
```
## ๐งช Testing
To test the server locally:
```bash
# Build
npm run build
# Run the server
npm start
# Or in development mode
npm run dev
```
## ๐ Available Scripts
- `npm run build`: Compile TypeScript to JavaScript
- `npm run dev`: Build in watch mode
- `npm start`: Run the compiled server
- `npm test`: Run the server (start alias)
## ๐ Project Structure
```
movie-mcp/
โโโ src/
โ โโโ index.ts # Main MCP server
โ โโโ movie-apis.ts # API functions
โ โโโ types.ts # TypeScript types
โโโ dist/ # Compiled JavaScript
โโโ package.json
โโโ tsconfig.json
โโโ README.md
```
## ๐ Technical Features
- **MCP Protocol**: Implements the Model Context Protocol standard
- **Multiple APIs**: Combines OMDb and TMDb for better results
- **Validation**: Uses Zod for parameter validation
- **TypeScript**: Fully typed code
- **Error handling**: Informative responses in case of error
- **Internationalization**: English responses
## ๐ค Contributing
1. Fork the project
2. Create a feature branch (`git checkout -b feature/new-feature`)
3. Commit your changes (`git commit -am 'Add new feature'`)
4. Push to the branch (`git push origin feature/new-feature`)
5. Open a Pull Request
## ๐ License
MIT License - see the LICENSE file for more details.
## ๐ Troubleshooting
### Error: "Module not found"
- Make sure to run `npm install`
- Verify that Node.js is installed (version 18+)
### Error: "API key invalid"
- Verify that environment variables are configured correctly
- Confirm that API keys are valid
### Error: "No results found"
- Check your internet connection
- Confirm that movie names are spelled correctly
### Server not responding
- Verify that the file is compiled (`npm run build`)
- Check the configuration in `.cursor/mcp.json`
- Confirm that the path to the file is correct
TDQS
Scored across 5 tools
The tools have distinct names suggesting different purposes (details, help, popular, recommend, search), but without descriptions, there's potential ambiguity. For example, 'popular_movies' and 'recommend_movies' might overlap in functionality if recommendations are based on popularity, and 'movie_help' is vague and could be confused with other tools. The naming helps, but descriptions would be needed to fully disambiguate.
The naming follows a consistent pattern with snake_case and a mix of verb_noun (e.g., 'get_movie_details', 'search_movies') and noun_verb (e.g., 'movie_help', 'popular_movies', 'recommend_movies'). There are minor deviations in word order, but overall it's readable and mostly predictable, with no chaotic mixing of styles.
With 5 tools, this is well-scoped for a movie search server. It covers key operations like searching, getting details, finding popular movies, and recommendations, which aligns with typical movie-related functionalities. The count is appropriate, not too thin or heavy for the apparent domain.
The tool set covers basic search and discovery functions (search, details, popular, recommend), but there are notable gaps. For a movie domain, missing operations might include user-specific actions (e.g., rate_movie, add_to_watchlist), filtering or sorting options, or genre-based searches. The surface is functional but incomplete for a full movie experience, likely causing some agent limitations.