In this document, we will look at the basics of MCP.
- Create Project
mkdir demo-mcp-server && cd demo-mcp-server| const script = document.createElement('script'); | |
| script.src = 'https://web-broadcast.live-video.net/1.30.0/amazon-ivs-web-broadcast.js'; | |
| script.onload = async () => { | |
| const token = prompt('Enter your IVS Real-Time participant token:'); | |
| if (!token) { | |
| console.error('No token provided'); | |
| return; | |
| } | |
| const canvas = document.getElementById('gameCanvas'); |
lets create an html file to broadcast to an amazon ivs low-latency channel using the latest version amazon ivs web broadcast sdk. check the documentation for low-latency streaming with the web broadcast sdk and use my existing channel called demo-channel. to retrieve the channel's stream key from the application, create a function that uses this endpoint: https://[redacted]. use tools at your disposal to find the ingest endpoint for this channel. save the file to /path/to/ivs-web-broadcast-demo.html
⠧ Thinking...
🔨 Calling MCP Server tool 'ivs-knowledgebase-retrieve'...
🔎 Sending MCP Server's 'ivs-knowledgebase-retrieve' response to Bedrock...
⠧ Thinking...
🔨 Calling MCP Server tool 'ivs-knowledgebase-retrieve'...
🔎 Sending MCP Server's 'ivs-knowledgebase-retrieve' response to Bedrock...
⠧ Thinking...
🔨 Calling MCP Server tool 'fetch-url'...
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Amazon IVS Broadcaster</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; |
| using UnityEngine; | |
| using Momento.Sdk; | |
| using Momento.Sdk.Auth; | |
| using Momento.Sdk.Config; | |
| using Momento.Sdk.Exceptions; | |
| using Momento.Sdk.Responses; | |
| using System.Threading.Tasks; | |
| using System; | |
| using System.Threading; | |
| using System.Collections; |
Ivy is a virtual assitant that joins your Amazon IVS (get it? Ivy? IVS?) real-time stage, listens for chat messages that are prefixed with "Hey Ivy", and responds!
| import 'dotenv/config'; | |
| import { spawn } from 'node:child_process'; | |
| import { mkdirSync, readFileSync } from 'node:fs'; | |
| import { inspect } from 'node:util'; | |
| import Watcher from 'watcher'; | |
| import { IvsClient, GetStreamCommand } from "@aws-sdk/client-ivs"; | |
| import { SQSClient, ReceiveMessageCommand, DeleteMessageCommand } from "@aws-sdk/client-sqs"; | |
| // create AWS SDK clients | |
| const ivsClient = new IvsClient(); |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using Unity.WebRTC; | |
| using UnityEngine.Networking; | |
| using UnityEngine.UI; | |
| [RequireComponent(typeof(AudioListener))] | |
| public class TwitchPublish : MonoBehaviour | |
| { |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Threading.Tasks; | |
| using UnityEngine; | |
| using Unity.WebRTC; | |
| using UnityEngine.Networking; | |
| using Unity.RenderStreaming; | |
| using UnityEngine.UI; | |
| using NativeWebSocket; |