agent-hanju/char-index-mcp

๐Ÿ’ป Developer Tools
0 Views
0 Installs

๐Ÿ ๐Ÿ  โ˜๏ธ ๐ŸŽ ๐ŸชŸ ๐Ÿง - Precise character-level string indexing for LLMs. Provides tools for finding, extracting, and manipulating text by exact character position to solve position-based operations.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "agent-hanju-char-index-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "agent-hanju-char-index-mcp"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

char-index-mcp (Archived)

This repository is archived. This project has moved to char-index-skill, now available as a Claude Code Skill plugin with continued MCP server support.

Future updates to both the Skill and the MCP server (char-index-mcp) will be published from the new repository.


A Model Context Protocol (MCP) server providing character-level index-based string manipulation. Perfect for test code generation where precise character positioning matters.

smithery badge License: MIT PyPI Python

๐ŸŽฏ Why This Exists

LLMs generate text token-by-token and struggle with exact character counting. When generating test code with specific length requirements or validating string positions, you need precise index-based tools. This MCP server solves that problem.

โœจ Features (12 Tools)

๐Ÿ” Character & Substring Finding (4 tools)

  • find_nth_char - Find nth occurrence of a character
  • find_all_char_indices - Find all indices of a character
  • find_nth_substring - Find nth occurrence of a substring
  • find_all_substring_indices - Find all occurrences of a substring

โœ‚๏ธ Splitting (1 tool)

  • split_at_indices - Split string at multiple positions

โœ๏ธ String Modification (3 tools)

  • insert_at_index - Insert text at specific position
  • delete_range - Delete characters in range
  • replace_range - Replace range with new text

๐Ÿ› ๏ธ Utilities (3 tools)

  • find_regex_matches - Find regex pattern matches with positions
  • extract_between_markers - Extract text between two markers
  • count_chars - Character statistics (total, letters, digits, etc.)

๐Ÿ“ฆ Batch Processing (1 tool)

  • extract_substrings - Extract one or more substrings (unified tool)

๐Ÿš€ Installation

Option 1: Using uvx (Recommended)

No installation required! Just configure and run:

# Test it works
uvx char-index-mcp --help

Option 2: From PyPI

pip install char-index-mcp

Option 3: From Source

git clone https://github.com/agent-hanju/char-index-mcp.git
cd char-index-mcp
pip install -e .

๐Ÿ”ง Configuration

Claude Desktop

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Using uvx (Recommended)

{
  "mcpServers": {
    "char-index": {
      "command": "uvx",
      "args": ["char-index-mcp"]
    }
  }
}

Using pip install

{
  "mcpServers": {
    "char-index": {
      "command": "char-index-mcp"
    }
  }
}

Claude Code

# Using uvx (recommended)
claude mcp add char-index '{"command":"uvx","args":["char-index-mcp"]}'

# Using pip install
claude mcp add char-index '{"command":"char-index-mcp"}'

Cursor

Add to ~/.cursor/mcp.json:

Using uvx (Recommended)

{
  "mcpServers": {
    "char-index": {
      "command": "uvx",
      "args": ["char-index-mcp"]
    }
  }
}

Using pip install

{
  "mcpServers": {
    "char-index": {
      "command": "char-index-mcp"
    }
  }
}

๐Ÿ“– Usage Examples

Finding Characters

# Find 3rd occurrence of 'l'
find_nth_char("hello world", "l", 3)  # Returns: 9

# Find all occurrences of 'l'
find_all_char_indices("hello world", "l")  # Returns: [2, 3, 9]

Working with Substrings

# Find 2nd "hello"
find_nth_substring("hello hello world", "hello", 2)  # Returns: 6

# Find all occurrences
find_all_substring_indices("hello hello world", "hello")  # Returns: [0, 6]

String Manipulation

# Insert comma after "hello"
insert_at_index("hello world", 5, ",")  # Returns: "hello, world"

# Delete " world"
delete_range("hello world", 5, 11)  # Returns: "hello"

# Replace "world" with "Python"
replace_range("hello world", 6, 11, "Python")  # Returns: "hello Python"

Splitting & Extracting

# Split at multiple positions
split_at_indices("hello world", [2, 5, 8])  # Returns: ["he", "llo", " wo", "rld"]

# Extract single character
extract_substrings("hello", [{"start": 1, "end": 2}])
# Returns: [{"start": 1, "end": 2, "substring": "e", "length": 1}]

# Batch extraction
extract_substrings("hello world", [
    {"start": 0, "end": 5},
    {"start": 6, "end": 11}
])
# Returns: [
#   {"start": 0, "end": 5, "substring": "hello", "length": 5},
#   {"start": 6, "end": 11, "substring": "world", "length": 5}
# ]

Pattern Matching

# Find all numbers with their positions
find_regex_matches("test123abc456", r"\d+")
# Returns: [
#   {"start": 4, "end": 7, "match": "123"},
#   {"start": 10, "end": 13, "match": "456"}
# ]

Extracting Text

# Extract content between markers
extract_between_markers("start[content]end", "[", "]", 1)
# Returns: {
#   "content": "content",
#   "content_start": 6,
#   "content_end": 13,
#   "full_start": 5,
#   "full_end": 14
# }

๐Ÿงช Development

# Clone the repository
git clone https://github.com/agent-hanju/char-index-mcp.git
cd char-index-mcp

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=char_index_mcp --cov-report=term-missing

๐ŸŽฏ Use Cases

  1. Test Code Generation: Generate strings with exact character counts
  2. Data Processing: Split/extract data at precise positions
  3. Text Formatting: Insert/delete/replace at specific indices
  4. Pattern Analysis: Find and extract pattern matches with positions
  5. LLM Response Parsing: Extract content between XML tags by position

๐Ÿ“ Example: Test Code Generation

# Ask Claude: "Generate a test string that's exactly 100 characters long"
# Claude can use count_chars() to verify the exact length

# Ask: "Find where the 5th comma is in this CSV line"
# Claude can use find_nth_char(csv_line, ",", 5)

# Ask: "Split this string at characters 10, 25, and 50"
# Claude can use split_at_indices(text, [10, 25, 50])

# Ask: "Extract the text between the 2nd <thinking> and </thinking> tags"
# Claude can use extract_between_markers(text, "<thinking>", "</thinking>", 2)

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details

๐Ÿ”— Related Projects

๐Ÿ“ฎ Contact

For issues, questions, or suggestions, please open an issue on GitHub.


Note: This is the first MCP server specifically designed for index-based string manipulation. All other text MCP servers focus on counting, case conversion, or encoding - not precise character positioning.

Related MCP Servers

Moxie-Docs-MCPโ˜… Featured

MCP & Agent Skills for Automated Documentation, and codebase conventions + context

๐Ÿ’ป Developer Tools2 views
3KniGHtcZ/codebeamer-mcp

๐Ÿ“‡ โ˜๏ธ ๐ŸŽ ๐ŸชŸ ๐Ÿง - Codebeamer ALM integration for managing work items, trackers, and projects. Provides 17 tools for reading and writing items, associations, references, comments, and risk management data via Codebeamer REST API v3.

๐Ÿ’ป Developer Tools1 views
21st-dev/Magic-MCP

Create crafted UI components inspired by the best 21st.dev design engineers.

๐Ÿ’ป Developer Tools0 views
a-25/ios-mcp-code-quality-server

๐Ÿ“‡ ๐Ÿ  ๐ŸŽ - iOS code quality analysis and test automation server. Provides comprehensive Xcode test execution, SwiftLint integration, and detailed failure analysis. Operates in both CLI and MCP server modes for direct developer usage and AI assistant integration.

๐Ÿ’ป Developer Tools0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

Last checked: 7/28/2026, 5:30:35 AM

Unclaimed listing (imported or pending owner verification). Claim it โ†’
โ˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.