MCP DeepInfra AI Tools Server

MCP DeepInfra AI Tools Server

Provides various AI capabilities through DeepInfra's OpenAI-compatible API including image generation, text processing, embeddings, speech recognition, object detection, and classification tasks. Enables users to access multiple AI models for diverse tasks like generating images from prompts, transcribing audio, analyzing text sentiment, and performing computer vision operations.

Category
访问服务器

README

MCP DeepInfra AI Tools Server

This is a Model Context Protocol (MCP) server that provides various AI capabilities using the DeepInfra OpenAI-compatible API, including image generation, text processing, embeddings, speech recognition, and more.

Project Structure

mcp-deepinfra/
├── src/
│   └── mcp_deepinfra/
│       ├── __init__.py      # Package initialization
│       └── server.py        # Main MCP server implementation
├── tests/
│   ├── conftest.py          # Pytest fixtures and configuration
│   ├── test_server.py      # Server initialization tests
│   └── test_tools.py        # Individual tool tests
├── pyproject.toml           # Project configuration and dependencies
├── uv.lock                  # Lock file for uv package manager
├── run_tests.sh             # Convenience script for running tests
└── README.md               # This file

Setup

  1. Install uv if not already installed:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Clone or download this repository.

  3. Install dependencies:

    uv sync
    
  4. Set up your DeepInfra API key: Create a .env file in the project root:

    DEEPINFRA_API_KEY=your_api_key_here
    

Configuration

You can configure which tools are enabled and set default models for each tool using environment variables in your .env file:

  • ENABLED_TOOLS: Comma-separated list of tools to enable. Use "all" to enable all tools (default: "all"). Example: ENABLED_TOOLS=generate_image,text_generation,embeddings

  • MODEL_GENERATE_IMAGE: Default model for image generation (default: "Bria/Bria-3.2")

  • MODEL_TEXT_GENERATION: Default model for text generation (default: "meta-llama/Llama-2-7b-chat-hf")

  • MODEL_EMBEDDINGS: Default model for embeddings (default: "sentence-transformers/all-MiniLM-L6-v2")

  • MODEL_SPEECH_RECOGNITION: Default model for speech recognition (default: "openai/whisper-large-v3")

  • MODEL_ZERO_SHOT_IMAGE_CLASSIFICATION: Default model for zero-shot image classification (default: "openai/gpt-4o-mini")

  • MODEL_OBJECT_DETECTION: Default model for object detection (default: "openai/gpt-4o-mini")

  • MODEL_IMAGE_CLASSIFICATION: Default model for image classification (default: "openai/gpt-4o-mini")

  • MODEL_TEXT_CLASSIFICATION: Default model for text classification (default: "microsoft/DialoGPT-medium")

  • MODEL_TOKEN_CLASSIFICATION: Default model for token classification (default: "microsoft/DialoGPT-medium")

  • MODEL_FILL_MASK: Default model for fill mask (default: "microsoft/DialoGPT-medium")

The tools always use the models specified via environment variables. Model selection is configured at startup time through the environment variables listed above.

Running the Server

To run the server locally:

uv run mcp_deepinfra

Or directly with Python:

python -m mcp_deepinfra.server

Using with MCP Clients

Configure your MCP client (e.g., Claude Desktop) to use this server.

For Claude Desktop, add to your claude_desktop_config.json:

{
  "mcpServers": {
    "deepinfra": {
      "command": "uv",
      "args": ["run", "mcp_deepinfra"],
      "env": {
        "DEEPINFRA_API_KEY": "your_api_key_here"
      }
    }
  }
}

Tools Provided

This server provides the following MCP tools:

  • generate_image: Generate an image from a text prompt. Returns the URL of the generated image.
  • text_generation: Generate text completion from a prompt.
  • embeddings: Generate embeddings for a list of input texts.
  • speech_recognition: Transcribe audio from a URL to text using Whisper model.
  • zero_shot_image_classification: Classify an image into provided candidate labels using vision model.
  • object_detection: Detect and describe objects in an image using multimodal model.
  • image_classification: Classify and describe contents of an image using multimodal model.
  • text_classification: Analyze text for sentiment and category.
  • token_classification: Perform named entity recognition (NER) on text.
  • fill_mask: Fill masked tokens in text with appropriate words.

Testing

To test the server locally, run the pytest test suite:

# Install test dependencies
uv sync --extra test

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run specific test file
pytest tests/test_tools.py

# Use the convenience script
./run_tests.sh

The tests include:

  • Server initialization and tool listing
  • Individual tool functionality tests via JSON-RPC protocol
  • All tests run synchronously without async/await complexity

Running with uvx

uvx is designed for running published Python packages from PyPI or GitHub. For local development, use the uv run command as described above.

If you publish this package to PyPI (e.g., as mcp-deepinfra), you can run it with:

uvx mcp-deepinfra

And configure your MCP client to use:

{
  "mcpServers": {
    "deepinfra": {
      "command": "uvx",
      "args": ["mcp-deepinfra"],
      "env": {
        "DEEPINFRA_API_KEY": "your_api_key_here"
      }
    }
  }
}

For local development, stick with the uv run approach.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选