@danijeun/fanar-mcp-server
v1.1.3
Published
MCP server for Fanar API tools: Islamic RAG, image generation (with resizing), image understanding, thinking mode, and translation.
Maintainers
Readme
Fanar MCP Tools
A Model Context Protocol (MCP) server for Fanar API tools: Islamic RAG, image generation (with resizing), image understanding, thinking mode, and translation. Publishable as an npm package and usable as a CLI tool or MCP server.
Installation
npm install -g @danijeun/fanar-mcp-serverOr use with npx:
npx @danijeun/fanar-mcp-serverDependencies
- sharp is used for image resizing and processing.
Environment Variable
Set your Fanar API key:
export FANAR_API_KEY=your_api_key_hereUsage (CLI)
You can run the MCP server directly:
@danijeun/fanar-mcp-serverOr via npx:
npx @danijeun/fanar-mcp-serverUsage (MCP Client)
Configure your MCP client to use this server. Example config:
{
"mcpServers": {
"fanar_mcp": {
"command": "npx",
"args": ["@danijeun/fanar-mcp-server"],
"env": {
"FANAR_API_KEY": "your api key here"
}
}
}
}Tools
fanar_rag
- Input:
{ messages: [{ role: string, content: string }], model?: string } - Output:
{ content: [{ type: "text", text: string }], references?: any[] }
fanar_image_gen
- Input:
{ prompt: string } - Output:
{ content: [{ type: "image", data: string, mimeType: "image/png" }] }(base64 PNG) - Note: Images are automatically resized for optimal performance. If the long edge is greater than 1568px or the total pixel count exceeds 1.15MP, the image is scaled down (preserving aspect ratio) before being returned.
fanar_image_understanding
- Input:
{ prompt: string, image_b64: string, model?: string } - Output:
{ content: [{ type: "text", text: string }] } - Description: Analyzes and understands the content of an input image (base64-encoded PNG or JPEG) with a prompt/question. Images are automatically resized and compressed to fit API limits (max 1MB base64).
fanar_thinking_mode
- Input:
{ user_input: string, model?: string } - Output:
{ content: [{ type: "text", text: string }] } - Description: Enables extended reasoning with a special thinking mode. The model may use more tokens and a special role to provide deeper, more thoughtful answers. Useful for complex or multi-step queries.
fanar_translate
- Input:
{ text: string, langpair: string, preprocessing?: string } - Output:
{ content: [{ type: "text", text: string }] }
License
None
