Skip to content

Termina/moonverse-api

Repository files navigation

moonverse.ts

MoonBit documentation and source code search powered by Gemini's Interactions API and MCP (Model Context Protocol).

Overview

This is a TypeScript command-line tool that implements an MCP Server. It reads text files from the store/ directory (documentation) and source/ directory (MoonBit core repository), uses Gemini's Interactions API to provide AI-powered search and question answering.

Features

  • 🚀 MCP Server implementation for integration with Claude Desktop and other MCP clients
  • 📚 Automatic document ingestion from store/ directory
  • 💻 Source code analysis from source/ directory (MoonBit core repository)
  • 🔍 AI-powered semantic search using Gemini's Interactions API
  • 💬 Dual query modes: documentation and source code
  • 📝 Support for text, markdown, JSON, and MoonBit source files

Prerequisites

  • Node.js 18.0.0 or higher
  • A Google AI (Gemini) API key
  • MoonBit core repository (optional, for source code queries)

Installation

  1. Clone the repository:
git clone <repository-url>
cd moonverse.ts
  1. Install dependencies:
yarn install
  1. Build the project:
yarn build

Configuration

Set your Gemini API key as an environment variable:

export GEMINI_API_KEY='your-api-key-here'

You can get a Gemini API key from Google AI Studio.

Usage

As an MCP Server

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "moonverse": {
      "command": "node",
      "args": ["/path/to/moonverse.ts/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Running Directly

# Development mode with tsx
yarn dev

# Production mode
yarn start

Document Store

Place your documentation files in the store/ directory. Supported file types:

  • .txt - Plain text files
  • .md - Markdown files

The project includes sample MoonBit documentation:

  • llms.txt - General MoonBit language information
  • Agents.mbt.md - MoonBit agent documentation
  • ide.md - IDE integration information

Source Code Repository

Place the MoonBit core repository in the source/ directory for source code queries. Supported file types:

  • .mbt - MoonBit source files
  • .md - Markdown documentation
  • .json - JSON configuration files
  • .txt - Plain text files

This enables querying about:

  • Latest API features
  • Implementation details
  • Pre-release functionality
  • Internal code structure

MCP Tools

The server provides the following tools:

query_moonbit_docs

Query the MoonBit documentation using AI-powered semantic search.

Parameters:

  • query (string): The question to ask about the MoonBit documentation

Example:

Use the query_moonbit_docs tool to ask: "What are the key features of MoonBit?"

query_moonbit_source

Query the MoonBit core source code repository to understand latest API features and implementations.

Parameters:

  • query (string): The question to ask about MoonBit source code or latest features

Example:

Use the query_moonbit_source tool to ask: "How is the type inference system implemented?"

API References

This project uses:

Development

# Build the project
yarn build

# Run in development mode
yarn dev

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

MoonBit docs search store based on Gemini

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published