char-index-mcp
char-index-mcp (보관됨)
이 저장소는 보관되었습니다. 이 프로젝트는 char-index-skill로 이전되었으며, 현재 지속적인 MCP 서버 지원과 함께 Claude Code Skill 플러그인으로 제공됩니다.
Skill 및 MCP 서버(
char-index-mcp)에 대한 향후 업데이트는 새 저장소에서 게시될 예정입니다.
문자 단위 인덱스 기반 문자열 조작을 제공하는 MCP(Model Context Protocol) 서버입니다. 정확한 문자 위치가 중요한 테스트 코드 생성에 적합합니다.
🎯 존재 이유
LLM은 토큰 단위로 텍스트를 생성하므로 정확한 문자 수를 세는 데 어려움을 겪습니다. 특정 길이 요구 사항이 있는 테스트 코드를 생성하거나 문자열 위치를 검증할 때, 정확한 인덱스 기반 도구가 필요합니다. 이 MCP 서버가 그 문제를 해결합니다.
Related MCP server: MCP Character Tools
✨ 기능 (12개 도구)
🔍 문자 및 하위 문자열 찾기 (4개 도구)
find_nth_char- 문자의 n번째 발생 위치 찾기find_all_char_indices- 문자의 모든 인덱스 찾기find_nth_substring- 하위 문자열의 n번째 발생 위치 찾기find_all_substring_indices- 하위 문자열의 모든 발생 위치 찾기
✂️ 분할 (1개 도구)
split_at_indices- 여러 위치에서 문자열 분할
✏️ 문자열 수정 (3개 도구)
insert_at_index- 특정 위치에 텍스트 삽입delete_range- 범위 내 문자 삭제replace_range- 범위를 새 텍스트로 교체
🛠️ 유틸리티 (3개 도구)
find_regex_matches- 위치와 함께 정규식 패턴 일치 항목 찾기extract_between_markers- 두 마커 사이의 텍스트 추출count_chars- 문자 통계 (총계, 문자, 숫자 등)
📦 일괄 처리 (1개 도구)
extract_substrings- 하나 이상의 하위 문자열 추출 (통합 도구)
🚀 설치
옵션 1: uvx 사용 (권장)
설치가 필요 없습니다! 구성하고 실행하기만 하면 됩니다:
# Test it works
uvx char-index-mcp --help옵션 2: PyPI에서 설치
pip install char-index-mcp옵션 3: 소스에서 설치
git clone https://github.com/agent-hanju/char-index-mcp.git
cd char-index-mcp
pip install -e .🔧 구성
Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
uvx 사용 (권장)
{
"mcpServers": {
"char-index": {
"command": "uvx",
"args": ["char-index-mcp"]
}
}
}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
~/.cursor/mcp.json에 추가:
uvx 사용 (권장)
{
"mcpServers": {
"char-index": {
"command": "uvx",
"args": ["char-index-mcp"]
}
}
}pip install 사용
{
"mcpServers": {
"char-index": {
"command": "char-index-mcp"
}
}
}📖 사용 예시
문자 찾기
# 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]하위 문자열 작업
# 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]문자열 조작
# 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"분할 및 추출
# 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}
# ]패턴 매칭
# 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"}
# ]텍스트 추출
# 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
# }🧪 개발
# 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🎯 사용 사례
테스트 코드 생성: 정확한 문자 수로 문자열 생성
데이터 처리: 정확한 위치에서 데이터 분할/추출
텍스트 서식 지정: 특정 인덱스에서 삽입/삭제/교체
패턴 분석: 위치와 함께 패턴 일치 항목 찾기 및 추출
LLM 응답 파싱: 위치별로 XML 태그 사이의 콘텐츠 추출
📝 예시: 테스트 코드 생성
# 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)🤝 기여
기여를 환영합니다! 다음 단계를 따라주세요:
저장소 포크
기능 브랜치 생성
새로운 기능에 대한 테스트 추가
풀 리퀘스트 제출
📄 라이선스
MIT 라이선스 - 자세한 내용은 LICENSE 파일을 참조하세요
🔗 관련 프로젝트
mcp-character-counter - 문자 계산 및 분석
mcp-wordcounter - 파일에 대한 단어 및 문자 계산
text-master-mcp - 포괄적인 텍스트 처리 툴킷
📮 연락처
문제, 질문 또는 제안 사항이 있으면 GitHub에 이슈를 열어주세요.
참고: 이 서버는 인덱스 기반 문자열 조작을 위해 특별히 설계된 최초의 MCP 서버입니다. 다른 텍스트 MCP 서버들은 정밀한 문자 위치 지정이 아닌, 계산, 대소문자 변환 또는 인코딩에 중점을 둡니다.
Available Tools
12 toolscount_charsB
Count character statistics. Returns dict with total, without_spaces, letters, digits, spaces, special.
Inputs: text (required).
delete_rangeC
Delete characters in range [start, end).
Inputs: text (required), start (required), end (required). Returns: result
extract_between_markersC
Extract content between markers with positions. Returns dict with content and position info.
Inputs: text (required), start_marker (required), end_marker (required), occurrence.
extract_substringsB
Extract substrings by index ranges. Supports negative indices and omitting end. Returns list of {start, end, substring, length} dicts.
Inputs: text (required), ranges (required). Returns: result
find_all_char_indicesA
Find all indices where a character appears. Returns empty list if not found.
Inputs: text (required), char (required). Returns: result
find_all_substring_indicesB
Find all starting indices where a substring appears (includes overlaps).
Inputs: text (required), substring (required). Returns: result
find_nth_charA
Find index of nth occurrence of a character. Returns -1 if not found.
Inputs: text (required), char (required), n. Returns: result
find_nth_substringA
Find starting index of nth occurrence of a substring. Returns -1 if not found.
Inputs: text (required), substring (required), n. Returns: result
find_regex_matchesB
Find all regex matches with positions. Returns list of {start, end, match} dicts.
Inputs: text (required), pattern (required). Returns: result
insert_at_indexC
Insert text at index position without replacing. Supports negative indices.
Inputs: text (required), index (required), insertion (required). Returns: result
replace_rangeB
Replace characters in range [start, end) with new text.
Inputs: text (required), start (required), end (required), replacement (required). Returns: result
split_at_indicesB
Split text at exact index positions. Indices auto-sorted and deduplicated.
Inputs: text (required), indices (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose with no overlap: character counting, deletion, extraction, finding indices, regex matching, insertion, replacement, and splitting. The descriptions precisely differentiate operations like find_all_char_indices vs find_nth_char, and extract_between_markers vs extract_substrings.
All tools follow a consistent snake_case verb_noun pattern (e.g., count_chars, delete_range, extract_between_markers). The naming is predictable and readable throughout, with verbs like count, delete, extract, find, insert, replace, and split consistently applied.
12 tools are well-scoped for a character/index manipulation server, covering essential operations without bloat. Each tool earns its place by addressing specific needs like character statistics, range operations, substring extraction, and pattern matching.
The toolset provides complete coverage for text manipulation tasks: counting, insertion, deletion, replacement, extraction, finding indices (both character and substring), regex matching, and splitting. There are no obvious gaps; agents can perform a full lifecycle of operations on text data.
Maintenance
Related MCP Connectors
Exact text tools for AI agents: unified diff, patch apply, regex testing, grapheme counting.
Exact character/word counting, reversal, palindrome checks, indexing, sorting; Unicode-safe.
300+ deterministic data utilities for AI agents: validate, normalize, parse, match, redact.
Token counting, RAG chunking, truncation, HTML to Markdown and JSON repair
Related MCP Servers
- AlicenseAqualityNot gradedmaintenanceEnables agents to quickly find and edit code in a codebase with surgical precision. Find symbols, edit them everywhere with tools for reading code blocks, searching/replacing text, and making precise line-based modifications.311 npm-
- AlicenseAqualityDmaintenanceProvides 14+ character-level text analysis tools that give LLMs the ability to accurately count letters, analyze individual characters, and work with text at the character level—overcoming tokenization limitations.143MIT
- AlicenseBqualityBmaintenanceEnables LLMs to efficiently read, write, and refactor code using precise AST-based operations, reducing token usage and context window waste.25238 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables precise code extraction from 30+ languages using tree-sitter parsing, allowing AI assistants to retrieve functions, classes, and code snippets with accurate line numbers.19 PyPI8MIT