Socket
Book a DemoInstallSign in
Socket

fish-audio-mcp-server

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fish-audio-mcp-server

MCP server for Fish Audio Text-to-Speech integration

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

Fish Audio MCP Server

npm version License: MIT

Fish Audio MCP Server

An MCP (Model Context Protocol) server that provides seamless integration between Fish Audio's Text-to-Speech API and LLMs like Claude, enabling natural language-driven speech synthesis.

Features

  • 🎙️ High-Quality TTS: Leverage Fish Audio's state-of-the-art TTS models
  • 🌊 Streaming Support: Real-time audio streaming for low-latency applications
  • 🎨 Multiple Voices: Support for custom voice models via reference IDs
  • 🔧 Flexible Configuration: Environment variable-based configuration
  • 📦 Multiple Audio Formats: Support for MP3, WAV, PCM, and Opus
  • 🚀 Easy Integration: Simple setup with Claude Desktop or any MCP client

Quick Start

Installation

You can run this MCP server directly using npx:

npx fish-audio-mcp-server

Or install it globally:

npm install -g fish-audio-mcp-server

Configuration

  • Get your Fish Audio API key from Fish Audio

  • Set up environment variables:

export FISH_API_KEY=your_fish_audio_api_key_here
  • Add to your Claude Desktop configuration:
{
  "mcpServers": {
    "fish-audio": {
      "command": "npx",
      "args": ["fish-audio-mcp-server"],
      "env": {
        "FISH_API_KEY": "your_fish_audio_api_key_here",
        "FISH_MODEL_ID": "s1",
        "FISH_REFERENCE_ID": "your_voice_reference_id_here",
        "FISH_OUTPUT_FORMAT": "mp3",
        "FISH_STREAMING": "false",
        "FISH_MP3_BITRATE": "128"
      }
    }
  }
}

Environment Variables

VariableDescriptionDefaultRequired
FISH_API_KEYYour Fish Audio API key-
FISH_MODEL_IDTTS model to use (s1, speech-1.5, speech-1.6)s1
FISH_REFERENCE_IDDefault voice reference ID-
FISH_OUTPUT_FORMATDefault audio format (mp3, wav, pcm, opus)mp3
FISH_STREAMINGEnable streaming by defaultfalse
FISH_MP3_BITRATEMP3 bitrate (64, 128, 192)128
AUDIO_OUTPUT_DIRDirectory for audio file output~/.fish-audio-mcp/audio_output

Usage

Once configured, the Fish Audio MCP server provides the fish_audio_tts tool to LLMs.

Tool: fish_audio_tts

Generates speech from text using Fish Audio's TTS API.

Parameters

  • text (required): Text to convert to speech (max 10,000 characters)
  • reference_id (optional): Voice model reference ID
  • streaming (optional): Enable streaming mode
  • format (optional): Output format (mp3, wav, pcm, opus)
  • mp3_bitrate (optional): MP3 bitrate (64, 128, 192)
  • normalize (optional): Enable text normalization (default: true)
  • latency (optional): Latency mode (normal, balanced)
  • output_path (optional): Custom output file path

Examples

Basic Text-to-Speech

User: "Generate speech saying 'Hello, world! Welcome to Fish Audio TTS.'"

Claude: I'll generate speech for that text using Fish Audio TTS.

[Uses fish_audio_tts tool with text parameter]

Result: Audio file saved to ./audio_output/tts_2025-01-03T10-30-00.mp3

Using Custom Voice

User: "Generate speech with voice model xyz123 saying 'This is a custom voice test'"

Claude: I'll generate speech using the specified voice model.

[Uses fish_audio_tts tool with text and reference_id parameters]

Result: Audio generated with custom voice model xyz123

Streaming Mode

User: "Generate a long speech in streaming mode about the benefits of AI"

Claude: I'll generate the speech in streaming mode for faster response.

[Uses fish_audio_tts tool with streaming: true]

Result: Streaming audio saved to ./audio_output/tts_2025-01-03T10-35-00.mp3

Development

Local Development

  • Clone the repository:
git clone https://github.com/da-okazaki/mcp-fish-audio-server.git
cd mcp-fish-audio-server
  • Install dependencies:
npm install
  • Create .env file:
cp .env.example .env
# Edit .env with your API key
  • Build the project:
npm run build
  • Run in development mode:
npm run dev

Testing

Run the test suite:

npm test

Project Structure

mcp-fish-audio-server/
├── src/
│   ├── index.ts          # MCP server entry point
│   ├── tools/
│   │   └── tts.ts        # TTS tool implementation
│   ├── services/
│   │   └── fishAudio.ts  # Fish Audio API client
│   ├── types/
│   │   └── index.ts      # TypeScript definitions
│   └── utils/
│       └── config.ts     # Configuration management
├── tests/                # Test files
├── audio_output/         # Default audio output directory
├── package.json
├── tsconfig.json
└── README.md

API Documentation

Fish Audio Service

The service provides two main methods:

  • generateSpeech: Standard TTS generation

    • Returns audio buffer
    • Suitable for short texts
    • Lower memory usage
  • generateSpeechStream: Streaming TTS generation

    • Returns audio stream
    • Suitable for long texts
    • Real-time processing

Error Handling

The server handles various error scenarios:

  • INVALID_API_KEY: Invalid or missing API key
  • NETWORK_ERROR: Connection issues with Fish Audio API
  • INVALID_PARAMS: Invalid request parameters
  • QUOTA_EXCEEDED: API rate limit exceeded
  • SERVER_ERROR: Fish Audio server errors

Troubleshooting

Common Issues

  • "FISH_API_KEY environment variable is required"

    • Ensure you've set the FISH_API_KEY environment variable
    • Check that the API key is valid
  • "Network error: Unable to reach Fish Audio API"

    • Check your internet connection
    • Verify Fish Audio API is accessible
    • Check for proxy/firewall issues
  • "Text length exceeds maximum limit"

    • Split long texts into smaller chunks
    • Maximum supported length is 10,000 characters
  • Audio files not appearing

    • Check the AUDIO_OUTPUT_DIR path exists
    • Ensure write permissions for the directory

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/AmazingFeature)
  • Commit your changes (git commit -m 'Add some AmazingFeature')
  • Push to the branch (git push origin feature/AmazingFeature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Fish Audio for providing the excellent TTS API
  • Anthropic for creating the Model Context Protocol
  • The MCP community for inspiration and examples

Support

For issues, questions, or contributions, please visit the GitHub repository.

Changelog

v0.1.1 (2025-01-03)

  • Fixed directory creation error when running via npx
  • Changed default audio output to user's home directory

v0.1.0 (2025-01-03)

  • Initial release
  • Basic TTS functionality
  • Streaming support
  • Environment variable configuration
  • Multiple audio format support

Keywords

mcp

FAQs

Package last updated on 03 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.