char-index-mcp
char-index-mcp (보관됨)
이 저장소는 보관되었습니다. 이 프로젝트는 char-index-skill로 이전되었으며, 현재 지속적인 MCP 서버 지원과 함께 Claude Code Skill 플러그인으로 제공됩니다.
Skill 및 MCP 서버(
char-index-mcp)에 대한 향후 업데이트는 새 저장소에서 게시될 예정입니다.
문자 단위 인덱스 기반 문자열 조작을 제공하는 MCP(Model Context Protocol) 서버입니다. 정확한 문자 위치가 중요한 테스트 코드 생성에 적합합니다.
🎯 존재 이유
LLM은 토큰 단위로 텍스트를 생성하므로 정확한 문자 수를 세는 데 어려움을 겪습니다. 특정 길이 요구 사항이 있는 테스트 코드를 생성하거나 문자열 위치를 검증할 때, 정확한 인덱스 기반 도구가 필요합니다. 이 MCP 서버가 그 문제를 해결합니다.
✨ 기능 (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 서버들은 정밀한 문자 위치 지정이 아닌, 계산, 대소문자 변환 또는 인코딩에 중점을 둡니다.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/agent-hanju/char-index-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server