Skip to content

Latest commit

 

History

History
87 lines (57 loc) · 2.09 KB

File metadata and controls

87 lines (57 loc) · 2.09 KB

Build and Run Guide

This guide provides detailed instructions on how to build, configure, and run the Multi-Source Media MCP Server (M3S).

1. Prerequisites

  • Go: Version 1.25.1 or higher.

2. Building the Server

To build the server, navigate to the project's root directory and run the following command:

m3s-server

This will create an executable file named mmts-server in the project root.


3. Configuration

The server is configured using a YAML file (configs/config.yaml by default) that supports environment variable substitution.

3.1 Configuration File

The config.yaml file defines the server's configuration. You can use the ${VAR:default} syntax to substitute values from environment variables at runtime.

Example config.yaml:

mode: ${MODE:streamhttp}
addr: ${LISTEN_ADDR:0.0.0.0:18061}

# API Keys & Endpoints
pexelsAPIKey: ${PEXELS_API_KEY}
unsplashAPIKey: ${UNSPLASH_API_KEY}
siliconAPIKey: ${SILICON_API_KEY}
siliconBaseURL: ${SILICON_BASE_URL}
siliconModel: ${SILICON_MODEL}

3.2 Environment Variables and .env

To provide values for the placeholders in config.yaml, you can either set environment variables directly or create a .env file in the project root.

Example .env file:

# .env

# Server Configuration
MODE=streamhttp
LISTEN_ADDR=127.0.0.1:9000

# API Keys & Endpoints
PEXELS_API_KEY=your-pexels-api-key
UNSPLASH_API_KEY=your-unsplash-api-key
SILICON_API_KEY=your-silicon-api-key
SILICON_BASE_URL=https://api.siliconflow.cn/v1
SILICON_MODEL=your-model-name
OPENAI_API_KEY=your-openai-api-key
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=dall-e-3

The server will automatically load the .env file and substitute the variables into the configuration when it starts.


4. Running the Server

4.1 Default Mode (StreamHTTP)

To run the server with the default configuration (configs/config.yaml):

./mmts-server

4.2 Custom Configuration File

To use a different configuration file, use the --config command-line flag:

./mmts-server --config=path/to/your/config.yaml