MCP Waifu Chat Server

MCP Waifu Chat Server

mcp-waifu-chat•bywaifuai

A FastMCP-based Model Context Protocol server for a conversational AI waifu character with user management, dialog history, and chat tools.

License: Not specified•Runtime: Awaiting documentation review•Category: ai agents-models

WHAT IT DOES

  • •Provides MCP tools for creating, checking, deleting, and counting users.
  • •Stores and serves dialog history per user as JSON or string resources.
  • •Offers a chat tool that generates responses through the OpenRouter API.
  • •Persists data in a SQLite database configurable via environment variables.

BEST FOR

  • •Building conversational character interactions backed by an LLM provider.
  • •Maintaining per-user conversation history that MCP clients can retrieve.

ABOUT MCP-WAIFU-CHAT

MCP Waifu Chat Server is cataloged as an MCP server attributed to waifuai. A FastMCP-based Model Context Protocol server for a conversational AI waifu character with user management, dialog history, and chat tools. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP Waifu Chat Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Which LLM provider does the chat tool use?

The chat tool generates responses via the OpenRouter API.

How is conversation data persisted?

Dialogs and users are stored in a SQLite database whose file path is configurable.

上游原版 README

在 GitHub 查看同一版本原文

README.md · e972ed3e3b93 · 采集于 2026-11-13 10:35:44 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP Waifu Chat Server

This project implements a basic MCP (Model Context Protocol) server for a conversational AI "waifu" character. It uses the mcp library for Python to handle the protocol details and FastMCP for easy server setup.

Features

  • User management (create, check existence, delete, count)
  • Dialog history storage (get, set, reset)
  • Basic chat functionality (using OpenRouter API)
  • Modular design for easy extension
  • Configuration via environment variables and API key file
  • SQLite database for persistence
  • Comprehensive unit tests

Requirements

  • Python 3.10+
  • uv
  • An OpenRouter API Key

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd mcp-waifu-chat
    
  2. Install uv (if not installed) With curl:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    

Or with powershell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Create the virtual environment and ensure tooling inside:

    python -m uv venv .venv
    .venv/Scripts/python.exe -m ensurepip
    .venv/Scripts/python.exe -m pip install uv
    
  2. Install dependencies:

    .venv/Scripts/python.exe -m uv pip install -e .[test]
    

Configuration

The server uses a combination of a file for the API key and environment variables (or a .env file) for other configurations.

API Key:

OpenRouter (default):

  • Preferred via environment variable: OPENROUTER_API_KEY
  • Fallback: single-line key file ~/.api-openrouter
  • Model resolution precedence:
    1. OPENROUTER_MODEL_NAME
    2. ~/.model-openrouter
    3. openrouter/free

You can obtain a key from OpenRouter.

Other Configuration (.env file or environment variables): An example .env.example file is provided for other settings:

DATABASE_FILE=dialogs.db
DEFAULT_RESPONSE="I'm sorry, I'm having trouble connecting to the AI model."
DEFAULT_GENRE="Fantasy"
FLASK_PORT=5000
OPENROUTER_MODEL_NAME=openrouter/free
  • DATABASE_FILE: Path to the SQLite database file (default: dialogs.db).
  • DEFAULT_RESPONSE: The default response to send when the AI model is unavailable (default: "The AI model is currently unavailable. Please try again later.").
  • DEFAULT_GENRE: The default conversation genre (default: "Romance").
  • FLASK_PORT: The port the server will listen on (default: 5000).
  • OPENROUTER_MODEL_NAME: The specific OpenRouter model to use (default: openrouter/free).

Copy .env.example to .env and customize the values as needed (except for the API key, which is read from ~/.api-openrouter).

Running the Server

Ensure your ~/.api-openrouter file is set up correctly. Then, to run the server, use:

uv run mcp-waifu-chat

This runs the mcp_waifu_chat/api.py file (since that's where the FastMCP instance is defined) and starts up the server.

Running Tests

To run the unit tests:

uv run pytest

This will execute all tests in the tests/ directory using pytest. The tests include database tests and API endpoint tests.

API Endpoints

The server provides the following MCP-compliant endpoints (using FastMCP's automatic routing):

Server Status

  • /v1/server/status (GET): Checks the server status. Returns {"status": "ok"}. This is a standard MCP endpoint.

User Management Tools

These are implemented as MCP tools.

  • create_user (user_id: str): Creates a new user.
  • check_user (user_id: str): Checks if a user exists. Returns {"user_id": str, "exists": bool}.
  • delete_user (user_id: str): Deletes a user.
  • user_count: returns the number of users in the database for the current user.

Dialog Management Tools

  • reset_dialog (user_id: str)

Resources

  • /v1/user/dialog/json/{user_id}: Dynamic resource to return dialogs as JSON.
  • /v1/user/dialog/str/{user_id}: Dynamic resource to return dialogs as a string

Chat Tool

  • chat (message: str, user_id: str): Sends a chat message and gets a response generated by OpenRouter.

LLM Integration (OpenRouter)

The dispatcher in mcp_waifu_chat/ai.py selects the provider and generates responses.

Provider: openrouter

Model resolution precedence:

  • OpenRouter model name: OPENROUTER_MODEL_NAME env; else ~/.model-openrouter; else openrouter/free.

Credentials:

  • OpenRouter: OPENROUTER_API_KEY env; else ~/.api-openrouter.

Call pattern:

The path includes defensive parsing and error handling, returning config.default_response when unavailable.

Deploying to Production

For a production deployment, you should:

  1. Use a production-ready WSGI/ASGI server: Gunicorn is recommended and included in the pyproject.toml. Example command:

    gunicorn --workers 4 --bind 0.0.0.0:8000 mcp_waifu_chat.api:app -k uvicorn.workers.UvicornWorker
    

    This runs the app object (our FastMCP instance) from mcp_waifu_chat/api.py using 4 Uvicorn workers managed by Gunicorn, listening on port 8000. Adjust the number of workers and the port as needed.

  2. Use a robust database: Consider PostgreSQL or MySQL instead of SQLite for higher concurrency and scalability.

  3. Implement proper logging: Configure logging to write to files, a centralized logging service, or a monitoring system.

  4. Secure your server: Use HTTPS, implement authentication/authorization, and follow security best practices for web applications.

  5. Consider a reverse proxy: Use a reverse proxy like Nginx or Apache to handle TLS termination, load balancing, and static file serving.

  6. Containerize Use Docker to simplify deployment.

Project Structure Explanation

  • mcp_waifu_chat/ (Main Package):
    • __init__.py: Makes the directory a Python package.
    • api.py: The core FastMCP application, tool/resource definitions, and request handling logic.
    • config.py: Handles loading and validating configuration settings.
    • db.py: All database interaction logic (creating tables, querying, updating).
    • models.py: Pydantic models for request/response data validation and serialization.
    • utils.py: Helper functions, like dialog_to_json and json_to_dialog.
    • ai.py: This module is responsible for interacting with the OpenRouter API.
  • tests/ (Test Suite):
    • conftest.py: pytest configuration, including fixtures for the test database and test client.
    • test_db.py: Unit tests for the db.py module.
    • test_api.py: Unit tests for the API endpoints in api.py.
  • run.py:: Simple file to run the server (Note: uv run mcp-waifu-chat is preferred).

This structure promotes modularity, testability, and maintainability. Each module has a specific responsibility, making it easier to understand, modify, and extend the codebase.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP Waifu Chat Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-waifu-chat)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related ai agents-models MCP Servers

Alternative and complementary servers in the same category

View all in ai agents-models →
Knowledge Graph Memory
@modelcontextprotocol/server-memory•Model Context Protocol

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

create_entitiescreate_relationsadd_observations+6 more
92K
AI & Multi-Agent
Sequential Thinking
@modelcontextprotocol/server-sequential-thinking•Model Context Protocol

Organize problem solving into revisable, branching thought steps through an MCP tool.

sequential_thinking
92K
AI & Multi-Agent

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.

146
AI & Multi-Agent