Logotipo de 无服务器Nova Sonic聊天应用

无服务器Nova Sonic聊天应用

Organización
aws-samples

Run Nova Sonic on AWS Serverless (with MCP support)

Editoraws-samples
Repositoriosample-serverless-nova-sonic-chat
IdiomaTypeScript
Forks
8
Estrellas
30
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT-0
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    无服务器Nova Sonic聊天应用 ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    30 estrellas y 8 forks en el repositorio enlazado.

Serverless Nova Sonic Chat App

This is a sample implementation for deploying a Nova Sonic application using serverless AWS services.

Architecture

Key Features

  • Implementation of serverless real-time communication between server and client using AppSync Events
  • Reference to past conversation history
  • ToolUse implementation
  • MCP (Model Context Protocol) support - Connect to various external services and tools via MCP servers
  • A conversation session can continue up to 8 hours (yes, not 8 minutes)
  • Chat UI implementation using Next.js + shadcn

Deployment Instructions

1. Prerequisites

First, prepare an environment capable of running AWS CDK. This environment must meet the following conditions:

  • Required software installed:
    • Node.js
      • v20 or higher recommended
      • Check with node -v command
    • AWS CLI v2
      • Check with aws --version command
    • Docker
      • Check with docker --version command
  • AWS CLI configured with appropriate AWS IAM permissions (Administrator equivalent required)
    • Set up IAM role or enter IAM user information with aws configure command
  • Internet connection with ability to communicate with AWS APIs
    • May not work properly in closed network environments

Any environment that meets the above requirements can be used, including local terminals or EC2 instances. Once you've confirmed these conditions, proceed to the next step.

2. Deployment Parameter Configuration

You can configure deployment parameters by editing cdk.ts.

Configurable parameters include:

  • Deployment region (default: inherits IAM session)
  • Nova Sonic model region (default: us-east-1)
  • Email domains allowed to sign up to Cognito (default: all allowed)

See the file for details.

3. Enable Bedrock Foundation Models

From the Amazon Bedrock Management Console in the bedrockRegion you specified in the step#2 (us-east-1 by default), enable Nova Sonic model.

4. CDK Bootstrap

Next, perform CDK Bootstrap.

Run the following commands:

sh
cd cdk
# Install Node dependencies
npm ci
# Initialize CDK for use in your AWS environment
npx cdk bootstrap

npm ci installs Node dependencies. This is only required for the first run.

cdk bootstrap performs initial setup to enable CDK usage in your environment. This is required when using CDK for the first time in a specific AWS account and region. It's not needed for subsequent runs.

If you see ✅ Environment aws://xxxx/us-east-1 bootstrapped, the bootstrap was successful. Proceed to the next step.

5. CDK Deploy

With CDK deployment preparation complete, run the following command to deploy all necessary CDK stacks:

sh
cd cdk
npx cdk deploy

Deployment typically takes about 5 minutes.

Upon successful deployment, stack output will be displayed as follows:

 ✅  NovaSonicWebappDemoStack

✨  Deployment time: 246.22s

Outputs:
NovaSonicWebappDemoStack.AgentHandlerFunctionName87E3B26A = CdkStack-AgentHandlerF75982B4-sr8j8OF2uqDt
...
NovaSonicWebappDemoStack.ServiceApiEndpointC0AA9658 = https://1234567.execute-api.us-east-1.amazonaws.com

Open the ServiceApiEndpoint* URL in your browser. If a login screen appears, deployment was successful.

This completes CDK deployment. Next, we'll explain how to use the application.

Usage

Sign Up / Login

When you open the URL in a browser, a login button will be displayed. Follow the on-screen instructions to create a Cognito user and log in.

[!IMPORTANT] By default, anyone who knows the URL can register as a user. It's recommended to restrict sign-up eligible email domains in 3. Deployment Parameter Configuration.

After logging in, the following screen will be displayed:

new session

Voice Conversation

Press the Start Voice Chat button to begin a conversation. You can configure the system prompt and voice before starting. Once the conversation begins, speak to it saying "Hello" or similar.

Before starting a conversation, you can customize the following:

  • System Prompt: Adjust Nova Sonic's speaking style and behavior
  • Voice: Select Nova Sonic's voice type. Currently only 3 English voices are selectable, but Nova Sonic itself supports French, Spanish, German, and more languages are planned for the future.

Press the Stop Voice Chat button to end the conversation. The conversation will also automatically end in the following cases:

  1. After more than 10 minutes have passed
  2. When left idle without speaking for several minutes

Viewing Conversation Logs

Click on history in the sidebar to view conversation history. Since long-term memory is included in the system prompt at that time, you can also see how memories change over time.

MCP Support

This agent now supports MCP (Model Context Protocol), enabling integration with various external services and tools. This allows the agent to:

  • Access databases, APIs, and other external data sources
  • Extend capabilities through community-developed MCP servers

Important Notes:

  • Supports MCP servers that can be executed via uvx or npx
  • Tools are executed synchronously, so long-running tools may not be suitable
  • Resource Requirements: MCP functionality may require additional memory and storage. If you encounter resource limitations, you can adjust the Lambda function's memory size (default: 256MB) and ephemeral storage size (default: 512MB) in cdk/lib/constructs/agent.ts

An example mcp config is below:

json
{
  "mcpServers": {
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"]
    },
    "DeepWiki": {
      "url": "https://mcp.deepwiki.com/sse",
      "enabled": false
    }
  }
}

Other Notes

  • The app works on mobile devices as well as computers (responsive design).
  • For Nova Sonic details, see agent/README.md

Cost

Assuming 10 minutes/session, the cost per session (USD) is as follows. Note that the dimensions such as token counts per session are examples and will vary depending on your actual use case.

AWS serviceDimensionsCost [USD/session]
Bedrock Nova SonicInput token (speech): 300 tokens/minute0.0102
Bedrock Nova SonicOutput token (speech): 200 tokens/minute0.0272
Bedrock Nova SonicInput token (text): 4000 tokens/session0.00024
Bedrock Nova SonicOutput token (text): 1000 tokens/session0.00024
AppSync EventsRequests: 250 events/session/minute0.0025
AppSync EventsConnection: 10 minutes/session0.00000008
LambdaDuration: 512MB, 10 minutes/session0.004
LambdaRequests: 2 invocations/session0.00000004
API GatewayRequests: 20 requests/session0.00001
DynamoDBRead: 10 RRU/session0.00000125
DynamoDBWrite: 50 WRU/session0.00003125
DynamoDBStorage: 30 kB/session (monthly)0.0000075
TOTAL0.044

Looking only at real-time communication costs (Lambda + AppSync Events), it comes to 0.00045 USD/minute. This is about 1/9th the cost of LiveKit Cloud, showing this is a scalable yet cost-efficient architecture.

Note: Pricing information is based on August 2025 data. Please check the official AWS pricing pages for the most current pricing information.

Resource Cleanup

After completing verification, it's recommended to delete unnecessary resources to prevent additional charges. To delete resources, run the following command:

sh
cd cdk
npx cdk destroy --all

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Acknowledgement

The code is heavily inspired and copied from Generative AI Use Cases (GenU).

Instalación

TypingMind
Requisitos:

Node.js 18+

{
  "mcpServers": {
    "aws-samples-sample-serverless-nova-sonic-chat": {
      "command": "",
      "args": []
    }
  }
}

Usa el MCP de 无服务器Nova Sonic聊天应用 con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado 无服务器Nova Sonic聊天应用, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade 无服务器Nova Sonic聊天应用 como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de 无服务器Nova Sonic聊天应用.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "aws-samples-sample-serverless-nova-sonic-chat": {
      "command": "npx",
      "args": [
        "-y",
        "sample-serverless-nova-sonic-chat"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de 无服务器Nova Sonic聊天应用 y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de 无服务器Nova Sonic聊天应用.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar 无服务器Nova Sonic聊天应用 para ayudarme con esta tarea?
无服务器Nova Sonic聊天应用
Claro. Lo he leído.
Esto he encontrado usando 无服务器Nova Sonic聊天应用.

Preguntas frecuentes

¿Para qué sirve el servidor MCP 无服务器Nova Sonic聊天应用?

无服务器Nova Sonic聊天应用 es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP 无服务器Nova Sonic聊天应用 con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar 无服务器Nova Sonic聊天应用 con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de 无服务器Nova Sonic聊天应用 con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con 无服务器Nova Sonic聊天应用 conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP 无服务器Nova Sonic聊天应用 a TypingMind?

无服务器Nova Sonic聊天应用 funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP 无服务器Nova Sonic聊天应用 en TypingMind?

无服务器Nova Sonic聊天应用 ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP 无服务器Nova Sonic聊天应用?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si 无服务器Nova Sonic聊天应用 requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇