ไธญๆ | English
This is a Model Context Protocol (MCP) server that wraps the Knowfun.io OpenAPI, allowing AI assistants (like Claude) to directly invoke Knowfun's content generation capabilities.
Through this MCP server, AI assistants can:
- โ Create content generation tasks (courses, posters, games, films)
- โ Query task status and detailed results
- โ Get task lists (with pagination and filtering)
- โ Query credit balance and usage details
- โ Get API configuration schema (all available generation options)
# Clone or navigate to project directory
cd knowfun-mcp
# Install dependencies
npm install
# Compile TypeScript
npm run build- Copy environment variable template:
cp .env.example .env- Edit
.envfile and fill in your Knowfun API Key:
KNOWFUN_API_KEY=kf_your_api_key_here
KNOWFUN_API_BASE_URL=https://api.knowfun.io๐ก How to get API Key?
- Login to knowfun.io
- Go to
/api-platformpage- Create or view your API Key
- Test connection (optional but recommended):
npm testIf configured correctly, it will show:
- โ API Key valid
- โ Network connection normal
- โ Current credit balance
Edit Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"knowfun": {
"command": "node",
"args": ["/Users/jamson/code/knowfun-mcp/dist/index.js"],
"env": {
"KNOWFUN_API_KEY": "kf_your_api_key_here",
"KNOWFUN_API_BASE_URL": "https://api.knowfun.io"
}
}
}
}Restart Claude Desktop to use Knowfun tools.
Create or edit ~/.config/claude/settings.json:
{
"mcpServers": {
"knowfun": {
"command": "node",
"args": ["/Users/jamson/code/knowfun-mcp/dist/index.js"],
"env": {
"KNOWFUN_API_KEY": "kf_your_api_key_here",
"KNOWFUN_API_BASE_URL": "https://api.knowfun.io"
}
}
}
}Then use Claude Code CLI as normal.
Create .cursor/mcp_config.json in your project:
{
"mcpServers": {
"knowfun": {
"command": "node",
"args": ["/Users/jamson/code/knowfun-mcp/dist/index.js"],
"env": {
"KNOWFUN_API_KEY": "kf_your_api_key_here",
"KNOWFUN_API_BASE_URL": "https://api.knowfun.io"
}
}
}
}Or configure in Cursor settings (Settings โ Features โ MCP).
Create content generation task (API: POST /api/openapi/v1/tasks)
Parameters:
requestId(string, required): Custom request ID (1-64 characters)taskType(string, required): Task type -course,poster,game,filmmaterial(object, required): Input materialtext(string): Text contenturl(string): Document or webpage URLtype(string): Material type (text, url, pdf, doc, etc.)
config(object): Generation config (optional, callget_schemafirst to see available options)callbackUrl(string): Callback URL on completion (optional)language(string): Language setting (optional)
Example:
{
"requestId": "req-20260301-001",
"taskType": "course",
"material": {
"text": "Introduction to AI: AI is a branch of computer science...",
"type": "text"
},
"config": {
"course": {
"contentLanguage": "en",
"explainLanguage": "en",
"aspectRatio": "landscape"
}
}
}Query task status by taskId (API: GET /api/openapi/v1/tasks/:taskId)
Parameters:
taskId(string, required): Task ID
Query task status by requestId (API: GET /api/openapi/v1/tasks/by-request/:requestId)
Parameters:
requestId(string, required): Request ID
Get detailed task information (API: GET /api/openapi/v1/tasks/:taskId/detail)
Parameters:
taskId(string, required): Task IDverbose(boolean): Return detailed debug info (default false)
Get task list (API: GET /api/openapi/v1/tasks)
Parameters:
page(number): Page number (default 1)limit(number): Items per page (default 20)status(string): Status filter (pending, processing, success, failed)taskType(string): Type filter (course, poster, game, film)
Query current API Key credit balance (API: GET /api/openapi/v1/credits/balance)
Returns:
available: Available creditsearned: Total earned creditsused: Used creditslocked: Locked credits
Get credit pricing for each task type (API: GET /api/openapi/v1/credits/pricing)
Get API configuration schema (API: GET /api/openapi/v1/schema)
Includes all available content styles, templates, languages, etc.
Query credit usage details (API: GET /api/openapi/usage)
Parameters:
startDate(string): Start date (YYYY-MM-DD)endDate(string): End date (YYYY-MM-DD)
Generate multimedia course content (video, PPT, etc.)
Main config:
contentStyle: Content style (concise, detailed, etc.)contentLanguage: Content languageexplainLanguage: Narration languagevoiceType: Voice typeaspectRatio: Aspect ratio (landscape, portrait)
Generate knowledge infographic posters
Main config:
usage: Layout type (infographic, businessReports, etc.)style: Art style (handDrawn, photorealistic, etc.)aspectRatio: Aspect ratio (1:1, 4:3, 16:9, etc.)
Generate interactive game content
Main config:
gameType: Game type (story, interactive, mission, etc.)aspectRatio: Aspect ratio
Generate short videos or micro-films
Main config:
filmStyle: Film style (story, documentary, tutorial, etc.)aspectRatio: Aspect ratio (16:9, 9:16, 1:1)
# Watch file changes and auto-compile
npm run watch
# Run in development mode
npm run dev- MCP SDK: @modelcontextprotocol/sdk
- HTTP Client: axios
- Language: TypeScript
- Runtime: Node.js
- ๐ QUICKSTART.md - Quick Start Guide
- ๐ QUICKSTART.zh.md - ๅฟซ้ๅ ฅ้จๆๅ
- ๐ README.md - Complete Documentation (English)
- ๐ README.zh.md - ๅฎๆด้กน็ฎๆๆกฃ๏ผไธญๆ๏ผ
- ๐ USAGE_EXAMPLES.md - Usage Examples
- ๐ USAGE_EXAMPLES.zh.md - ไฝฟ็จ็คบไพ
- โ๏ธ CONFIGURATION.md - Configuration Guide (Bilingual)
- ๐ PROJECT_STRUCTURE.md - Project Structure
- ๐ CHANGELOG.md - Version History
- ๐ค CONTRIBUTING.md - How to Contribute
- ๐ CODE_OF_CONDUCT.md - Code of Conduct
- ๐ SECURITY.md - Security Policy
MIT
For issues or suggestions, please contact the Knowfun team or submit an Issue.