Search for videos on Bilibili with pagination support
Bilibili Video Search is a Model Context Protocol (MCP) server that enables AI applications to search for videos on Bilibili, China's popular video sharing platform. The server provides a standardized API interface that returns comprehensive video information including titles, authors, view counts, and durations. With pagination support, it allows for efficient exploration of Bilibili's vast content library.
You can install the Bilibili Video Search MCP server using npm:
{
"mcpServers": {
"bilibili-search": {
"command": "npx",
"args": ["bilibili-mcp"],
"description": "B站视频搜索 MCP 服务,可以在AI应用中搜索B站视频内容。"
}
}
}
If you prefer to install from source:
Clone the repository:
git clone https://github.com/34892002/bilibili-mcp-js.git
cd bilibili-mcp-js
Install dependencies using either npm or bun:
# Using npm
npm install
# Using bun
bun install
Start the server:
# Using npm
npm run start
# Using bun
bun index.ts
You can test the server using the provided test script:
# Using npm
npm run test
# Using bun
bun test.js
The repository includes a LangChain example. To run it:
Configure your LLM model by editing the example.ts
file:
const llm = new ChatOpenAI({
modelName: "gpt-4o-mini",
temperature: 0,
openAIApiKey: "your_api_key", // Replace with your model's API key
configuration: {
baseURL: "https://www.api.com/v1", // Replace with your model's API URL
},
});
Build and run the example:
# Using npm
npm run build
node dist/example.js
# Using bun
bun build:bun
bun example.ts
You can use the MCP Inspector to explore the API:
# Using npm
npm run inspector
# Using bun
bun run inspector