mcp-text-mirror
Minimal MCP server in Go that reverses UTF-8 text (grapheme-safe) via stdio.
Links
README
From the repo.
MCP text-mirror
A tiny MCP (Model Context Protocol) service written in Go. It mirrors (reverses) UTF-8 text while preserving grapheme clusters.
This repository implements a minimal MCP server and a single mirror tool to help me/us learn MCP basics and to build something that at minimum works with VS Code's Copilot (via stdio transport).
[!TIP]
Article about this project in Japanese: 「【Golang】最もシンプルな MCP Server を Go で堅牢に実装してみる」@ Qiita
Features
- MCP tool that reverses UTF‑8 text
- Unicode grapheme cluster–safe (handles emoji, combining marks, ZWJ sequences)
stdiotransport only (HTTP/SSE transports not implemented)
Prerequisites
- Requires Go 1.25 or newer (see go.mod).
- Go 1.25 is already released as of 2025-08.
golangci-lint(optional;make testruns lint)make(optional; for build and test automation)- MCP client that supports
stdiotransport
Quick Start
This app aims to work with VS Code's Copilot extension via MCP. Any MCP-compatible client that supports stdio transport, Claude Desktop for example, should also work.
Build & Test
-
Build:
make build # or go build -o text-mirror . -
Tests & lint:
make test # or golangci-lint run --fix go test -cover -race ./...
Using with VS Code (Copilot)
MCP support in VS Code is generally available as of version 1.102 and later.
-
Build the
text-mirroras executable binary (as above) and copy its absolute path.- e.g.,
/home/user/go/bin/text-mirror
- e.g.,
-
Register as an MCP server in VS Code's MCP config file.
-
Open VS Code's command palette (
F1orCtrl+Shift+P) and search for:MCP: Open User Configuration
-
Edit the generated
mcp.jsonas follows (bare minimal example):{ "servers": { "text-mirror": { "command": "/full/path/to/text-mirror", "env": { "MCP_TEXT_MIRROR_DEBUG_LOG": "/full/path/to/text-mirror.log" } } } }- If
mcp.jsonalready has other servers, just add thetext-mirrorentry underservers. commandis required.- Replace
/full/path/to/text-mirrorwith the actual path to the built binary.
- Replace
- If
typeis omitted, VS Code assumes"stdio"by default for local servers. So no need to specify it here. envis optional.- If
MCP_TEXT_MIRROR_DEBUG_LOGis present, it enables debug logging to the specified log file. - Replace
/full/path/to/text-mirror.logwith the desired log file path.
- If
- For more details about the configuration format, see the VS Code MCP documentation.
- If
-
-
Restart VS Code
- The
text-mirrorMCP server should appear in the VS Code extension list (as an Installed MCP server pane). - Click the configuration icon next to
text-mirrorand check what can be done.- You may but don't have to start the server manually here; VS Code will start it automatically when needed.
- For more details, see the VS Code MCP documentation.
- The
-
Call the
mirrortool via Copilot Chat.-
In Copilot Chat, select an "Agent" model that is MCP-capable.
- If a model supports MCP tools, the “tools” icon appears.
-
The
mirrortool should now be available. You can ask Copilot to use it:Reverse this text using text-mirror: 🙂🙃🙂👩💻👨💻123
or
Use the mirror tool to reverse "こんにちは"
-
How It Works
If the MCP server is locally running, MCP clients like VS Code MCP/Claude Desktop communicate with it in a very Unix-like way.
- The MCP clients start the
text-mirrorbinary as a subprocess (spawns the MCP server). - The MCP server listens for tool calls over stdio.
- MCP clients send instruction data (JSON-RPC) to the server’s stdin.
- The server processes the request, reverses the text, and sends the result back via stdout.
- The MCP client receives the response and displays it to the user.
Development notes
- Tests with edge cases and 100% test coverage
- Linting via
golangci-lint - Tests include table-driven cases for combining marks, ZWJ sequences, flags, and long strings to exercise tricky Unicode behavior.
.editorconfigis included to keep consistent formatting (tabs for Go files, spaces for other files, LF endings, UTF‑8 charset).
Contributing
This project is primarily a learning resource, but contributions are welcome (fixes, tests, documentation).
License
- MIT License. See LICENSE for details.
Collected info
- ★ 0 stars
- Language: Go
- Source updated: 4/16/2026
Config for your environment
Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.
Tool
OS
Config file: ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server": {
"url": "{MCP_ENDPOINT_URL}"
}
}
}Paste into mcpServers in the config file. Restart Cursor after saving.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.