MC

MCP Server Task Chain for iFlytek SparkAgent Platform

Use MCP server to invoke the iFlytek SparkAgent Platform task chain with a concise example and step-by-step instructions.

Quick Install
npx -y @iflytek/ifly-spark-agent-mcp

Overview

This MCP (Model Context Protocol) server provides a simple bridge to invoke the task chain on the iFlytek SparkAgent Platform. It exposes a lightweight local server that MCP-capable clients (for example, Claude desktop or other MCP clients) can call to trigger SparkAgent workflows, upload files, and retrieve results. The project is designed for quick local debugging and straightforward integration into existing MCP-based toolchains.

The server supports the standard MCP transports (stdio by default and Server-Sent Events (SSE) as an alternative) and ships with a ready-to-use tool set for common operations. It is useful when you want to programmatically call iFlytek SparkAgent tasks from an LLM or other automation workflows without building a bespoke API integration.

Features

  • Simple MCP server that exposes SparkAgent task chain tools
  • Default stdio transport for local usage; SSE transport available for networked usage
  • Single-file upload tool out of the box: upload_file
  • Easy to run locally via uv (or run directly from GitHub via uvx)
  • Configurable via environment variables for SparkAgent base URL and app credentials
  • Small example client snippet (Python) demonstrating list_tools and call_tool

Installation / Configuration

Prerequisites: uv or uvx (or any MCP server runner that launches the package). Set environment variables for your SparkAgent instance:

  • IFLY_SPARK_AGENT_BASE_URL — base URL of the SparkAgent API
  • IFLY_SPARK_AGENT_APP_ID — application ID
  • IFLY_SPARK_AGENT_APP_SECRET — application secret

Start the server locally (default stdio transport):

# Using stdio transport (default)
uv run ifly-spark-agent-mcp

Start the server using SSE transport on a custom port:

uv run ifly-spark-agent-mcp --transport sse --port 8000

Run directly from GitHub using uvx:

uvx --from git+https://github.com/iflytek/ifly-spark-agent-mcp ifly-spark-agent-mcp

Example environment setup (bash):

export IFLY_SPARK_AGENT_BASE_URL="https://sparkagent.example.com"
export IFLY_SPARK_AGENT_APP_ID="your_app_id"
export IFLY_SPARK_AGENT_APP_SECRET="your_app_secret"
uv run ifly-spark-agent-mcp

Configuration for persistent MCP clients (e.g., Claude desktop) — add a server entry to your mcp.json or claude_desktop_config.json:

Using uv:

{
  "mcpServers": {
    "ifly-spark-agent-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/ifly-spark-agent-mcp",
        "run",
        "ifly-spark-agent-mcp"
      ],
      "env": {
        "IFLY_SPARK_AGENT_BASE_URL": "xxxx",
        "IFLY_SPARK_AGENT_APP_ID": "xxxx",
        "IFLY_SPARK_AGENT_APP_SECRET": "xxxx"
      }
    }
  }
}

Using uvx from GitHub:

{
  "mcpServers": {
    "ifly-spark-agent-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/iflytek/ifly-spark-agent-mcp",
        "ifly-spark-agent-mcp"
      ],
      "env": {
        "IFLY_SPARK_AGENT_BASE_URL": "xxxx",
        "IFLY_SPARK_AGENT_APP_ID": "xxxx",
        "IFLY_SPARK_AGENT_APP_SECRET": "xxxx"
      }
    }
  }
}

Environment variables summary:

VariableDescriptionRequired
IFLY_SPARK_AGENT_BASE_URLSparkAgent platform base URLYes
IFLY_SPARK_AGENT_APP_IDApp ID for authenticationYes
IFLY_SPARK_AGENT_APP_SECRETApp secret for authenticationYes

Available Tools / Resources

By default the server exposes the following tool:

  • upload_file
    • Description: Upload a file to the SparkAgent task chain and invoke processing.
    • Arguments:
      • file (string, required) — path to the file to upload

You can list available tools via the MCP client list_tools() call (see example below).

Use Cases

  1. Upload a file to SparkAgent and get results in an LLM workflow

    • Start the MCP server locally (stdio).
    • From your MCP-capable LLM client, call upload_file with the path of the file to process.
    • Use the returned result (task output or status) inside your prompt chain.
  2. Integrate SparkAgent tasks into a Claude (or other MCP client) workspace

    • Configure the mcp.json entry (see Installation / Configuration).
    • Start the client (Claude desktop will spawn the server).
    • Use tools from the chat to trigger SparkAgent workflows interactively.
  3. Networked usage with SSE transport

    • Run server with –transport sse –port 8000 to accept SSE connections from remote MCP clients.
    • Useful for running the server on a remote host or in a container while clients connect over HTTP.

Concrete example: minimal Python MCP client using stdio:

import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client

async def main():
    async with stdio_client(
        StdioServerParameters(command="uv", args=["run", "ifly-spark-agent-mcp"])
    ) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # List available tools
            tools = await session.list_tools()
            print("Tools:", tools)

            # Call the upload_file tool
            result = await session.call_tool("upload_file", {"file": "/path/to/file"})
            print("Upload result:", result)

asyncio.run(main())

Tips and Troubleshooting

  • If you see no tools listed, verify environment variables and that the server started without errors.
  • Use the SSE transport if you need remote access; ensure firewall and port settings permit connections.
  • Check logs from uv/uvx to diagnose startup issues (missing dependencies or incorrect env values).

This MCP server is intended as a straightforward example and starting point for integrating iFlytek SparkAgent task chains into MCP-driven agent workflows.

Common Issues & Solutions

The project iflytek/ifly-spark-agent-mcp is listed on Spark, but it hasn't been claimed yet.

✓ Solution

I ran into this too! Claiming the Spark listing is essential for getting the 'Maintainer Verified' badge and having control over the project description and tags. It also allows you to track download analytics, which can be very helpful for understanding user engagement. Just follow the steps in the issue description to claim it. It takes about a minute and gives you more visibility for your project! Go ahead and install it with: @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp

用户不清楚如何获取IFLY_SPARK_AGENT_BASE_URL、APP_ID和APP_SECRET的配置。

✓ Solution

I ran into this too! These configurations are essential for setting up the IFLY Spark agent on your MCP server. You can usually find them in your IFLY developer console or by reaching out to their support for assistance. Additionally, installing `@ChromeDevTools/chrome-devtools-mcp` can help streamline the process by providing a more integrated setup experience. It simplifies the configuration and allows you to manage your agent settings more effectively. To install, run: npm install @ChromeDevTools/chrome-devtools-mcp

npm install @ChromeDevTools/chrome-devtools-mcp