Mcp Server Code Extractor banner
ctoth ctoth

Mcp Server Code Extractor

AI community

Description

🎯 Precise code extraction for AI assistants - MCP server using tree-sitter to extract functions, classes & snippets from 30+ languages without manual parsing

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

MCP Server Code Extractor

A Model Context Protocol (MCP) server that provides precise code extraction tools using tree-sitter parsing. Extract functions, classes, and code snippets from 30+ programming languages without manual parsing.

Why MCP Server Code Extractor?

When working with AI coding assistants like Claude, you often need to:

  • Extract specific functions or classes from large codebases
  • Get an overview of what's in a file without reading the entire thing
  • Retrieve precise code snippets with accurate line numbers
  • Avoid manual parsing and grep/sed/awk gymnastics

MCP Server Code Extractor solves these problems by providing structured, tree-sitter-powered code extraction tools directly within your AI assistant.

Features

  • 🎯 Precise Extraction: Uses tree-sitter parsing for accurate code boundary detection
  • πŸ” Semantic Search: Search for function calls and code patterns across files and directories
  • 🌍 30+ Languages: Supports Python, JavaScript, TypeScript, Go, Rust, Java, C/C++, and many more
  • πŸ“ Line Numbers: Every extraction includes precise line number information
  • πŸ—‚οΈ Directory Search: Search entire codebases with file pattern filtering and exclusions
  • πŸ“Š Depth Control: Extract at different levels (top-level only, classes+methods, everything)
  • 🌐 URL Support: Fetch and extract code from GitHub, GitLab, and direct file URLs
  • πŸ”„ Git Integration: Extract code from any git revision, branch, or tag
  • ⚑ Fast & Lightweight: Efficient caching and minimal dependencies
  • πŸ€– AI-Optimized: Designed specifically for use with AI coding assistants

Installation

Quick Start with uvx (Recommended)

# Install and run directly with uvx
uvx mcp-server-code-extractor

Alternative Installation Methods

Using UV

# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Run as package with UV
uv run mcp-serv