GenioMCPServer

nexus6-haiku/GenioMCPServer

3.2

If you are the rightful owner of GenioMCPServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Genio MCP Server is a Model Context Protocol server designed for the Genio IDE on Haiku, providing seamless integration with Claude Code through the BMessage scripting API.

Genio MCP Server

MCP (Model Context Protocol) server for Genio IDE on Haiku. Provides Claude Code with direct access to Genio's editor through the BMessage scripting API.

Features

Editor State & Navigation:

  • get_editor_state - Current file, cursor, selection, modified state, visible lines, scroll position
  • navigate_to - Open file at specific line:column

Editor Content:

  • read_editor_buffer - Read current editor content
  • write_editor_buffer - Replace entire buffer

Text Editing:

  • insert_at_cursor - Insert or replace selection
  • append_to_file - Append to end of file
  • undo / redo - Undo/redo operations

Quick Start

Prerequisites

# On Haiku
pkgman install nim          # Nim >= 2.0.0

Build & Install

# Build server (auto-installs dependencies)
nimble build

# Run tests (requires Genio running)
nimble test

# Add to Claude Code
claude mcp add --transport stdio genio -- $PWD/genio_mcp_server

Or configure manually in ~/.config/claude-code/config.json:

{
  "mcpServers": {
    "genio": {
      "command": "/path/to/genio_mcp_server",
      "transport": "stdio"
    }
  }
}

Configuration

Build settings are in:

  • genio_mcp_server.nimble - Package metadata, dependencies, backend selection
  • nim.cfg - Compiler flags (C++ backend required, links -lbe)

Architecture

The server has two layers:

  1. MCP Layer (src/genio_mcp_server.nim) - JSON-RPC over stdio using nimcp
  2. Genio Interface (src/genio_interface.nim) - Self-contained Haiku API FFI bindings

Communication with Genio uses Haiku's BMessage protocol:

var msg = newBMessage(MSG_GET_PROPERTY)
msg.addSpecifier("CaretPosition")
msg.addSpecifier("SelectedEditor")
let reply = genio.sendMessage(msg)

Development

Adding Tools

Add tools in src/genio_mcp_server.nim:

mcpTool:
  proc my_tool(arg: string): string =
    ## Tool description
    {.cast(gcsafe).}:
      let result = genio.someOperation(arg)
      if result.isSome: return result.get()
      else: raise newException(IOError, "Failed")

Testing

nimble test

18 tests covering connection, navigation, editor state, text operations, and undo/redo.

Troubleshooting

Server won't connect:

  • Ensure Genio is running
  • Run ./genio_mcp_server - should see "Connected to Genio IDE"

Build errors:

  • nimcp not found - Run nimble install nimcp
  • BApplication undefined - Install Haiku dev headers: pkgman install haiku_devel

License

MIT