You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a simple example of using MCP Server to invoke the task chain of the iFlytek SparkAgent Platform.
Usage
Local debugging
Start the server using either stdio (default) or SSE transport:
# Using stdio transport (default)
uv run ifly-spark-agent-mcp
# Using SSE transport on custom port
uv run ifly-spark-agent-mcp --transport sse --port 8000
By default, the server exposes a tool named "upload_file" that accepts one required argument:
file: The path of the uploaded file
MCP Client Example
Using the MCP client, you can use the tool like this using the STDIO transport:
importasynciofrommcp.client.sessionimportClientSessionfrommcp.client.stdioimportStdioServerParameters, stdio_clientasyncdefmain():
asyncwithstdio_client(
StdioServerParameters(command="uv", args=["run", "ifly-spark-agent-mcp"])
) as (read, write):
asyncwithClientSession(read, write) assession:
awaitsession.initialize()
# List available toolstools=awaitsession.list_tools()
print(tools)
# Call the upload_file toolresult=awaitsession.call_tool("upload_file", {"file": "/path/to/file"})
print(result)
asyncio.run(main())
Usage with MCP client
Use on Claude
To add a persistent client, add the following to your claude_desktop_config.json or mcp.json file: