数据库访问MCP服务端

CHIM MCP Server 是一个为 AI 代理提供 CHIM/HerikaServer 与 StobeServer 运行时数据只读访问的 MCP 服务端,适用于安全查询事件日志、NPC 信息、记忆、任务和数据库内容等场景。

  • by Dwemer-Dynamics
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Dwemer-Dynamics/CHIM-MCP

使用说明

CHIM MCP Server

An MCP (Model Context Protocol) server that provides AI agents with read-only access to CHIM/HerikaServer and StobeServer runtime data.

Features

  • MCP SSE Endpoint: Standard MCP protocol over Server-Sent Events
  • Chat Agent API: OpenRouter-powered AI assistant with database tool access
  • HerikaServer + StobeServer Integration: Runtime file inspection across both services
  • Read-Only Database Access: Safe querying of eventlog, NPCs, memories, oghma, diaries, and arbitrary SQL on dwemer or stobe

Installation

npm install
npm run build

Configuration

All configuration is stored in the PostgreSQL conf_opts table and managed through the HerikaServer UI:

  • MCP/enabled - Whether the server should start
  • MCP/port - Port (default: 3100)
  • MCP/model - OpenRouter model identifier
  • MCP/temperature - Model temperature (0-2)
  • MCP/api_badge_id - References core_api_badge.id for API key
  • MCP/system_prompt - Optional custom system prompt
  • MCP/max_tool_rounds - Max tool-call iterations

Note: custom MCP/system_prompt values are automatically supplemented with StobeServer context unless they already mention StobeServer.

Environment variables in .env:

  • DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD - Primary DB connection (defaults to dwemer)
  • STOBE_DB_NAME - Optional Stobe DB name for run_query cross-database diagnostics (default: stobe)
  • HERIKA_SERVER_PATH - Optional HerikaServer path override
  • STOBE_SERVER_PATH - Optional StobeServer path override

Running

Development

npm run dev

Production

npm start

As DwemerDistro Service

The service is automatically started by DwemerDistro's start_env script.

Available Tools

  • query_eventlog - Search dialogue/event history
  • get_npc - Get full NPC profile
  • list_npcs - List all NPCs
  • search_oghma - Search knowledge base
  • get_memories - Query NPC memories
  • get_memory_summaries - Get compressed memory summaries
  • get_diaries - Fetch diary entries
  • get_speech_log - Query speech/dialogue log
  • get_config - Read config values
  • list_connectors - List LLM/TTS/STT/ITT connectors
  • list_profiles - List CHIM profiles
  • get_quests - Query quest log
  • run_query - Execute arbitrary read-only SQL (database: dwemer|stobe)

Note: named tools are CHIM/dwemer schema-focused. Use run_query with database: stobe for StobeServer tables.

On migrated servers, get_npc also returns plugin_extended_data as a JSON object keyed by plugin namespace. Nested JSON objects, arrays, and scalar values retain their types. Older servers omit the field. This is read-only access; list_npcs continues returning basic profile summaries.

License

GNU GPLv3 only. See LICENSE and LICENSING.md.