Sourcerer MCP enables AI agents to perform semantic code search and navigation, reducing token usage by jumping directly to relevant functions, classes, and code chunks. Benefits developers and operations teams by improving efficiency in code analysis and navigation tasks. Connects to Claude agents via Model Context Protocol.
git clone https://github.com/st3v3nmw/sourcerer-mcp.gitSourcerer MCP enables AI agents to perform semantic code search and navigation, reducing token usage by jumping directly to relevant functions, classes, and code chunks. Benefits developers and operations teams by improving efficiency in code analysis and navigation tasks. Connects to Claude agents via Model Context Protocol.
[{"step":"Install and configure sourcerer-mcp in your development environment. Ensure it has access to your project's codebase by setting the correct [PROJECT_ROOT] path in the MCP server configuration.","tip":"Use `mcp-server-sourcerer --init` to generate a default configuration file, then update the `source_directories` array to include your project's root and any relevant submodules."},{"step":"Define your search parameters by specifying the [FUNCTION_NAME] or [CLASS_NAME] you want to analyze. For broader searches, use [REGEX_PATTERN] to match multiple related functions.","tip":"Combine multiple placeholders for complex queries, e.g., `[FUNCTION_NAME]_test` to find test cases for a specific function. Use sourcerer-mcp's `--context-lines` flag to adjust the amount of surrounding code returned."},{"step":"Execute the search using your preferred interface (Claude, terminal, or IDE plugin). For large codebases, consider narrowing the search scope to specific directories or file types.","tip":"Use `--include` and `--exclude` flags to filter results by file extensions (e.g., `--include '*.py'` or `--exclude '**/tests/**'). For multi-project analysis, chain searches using the `--project` flag."},{"step":"Review the structured output and categorize the results by [CONTEXT_TYPE] or other relevant criteria. Use the extracted snippets to inform refactoring, debugging, or documentation tasks.","tip":"Export the results to a file using `--output json` for further processing. Use the `file_path` and `line_number` fields to quickly navigate to specific code locations in your IDE."},{"step":"Iterate by refining your search parameters based on the initial results. For example, search for related functions or classes mentioned in the context snippets to build a comprehensive understanding of the codebase.","tip":"Use sourcerer-mcp's `--related` flag to automatically find functions called by or calling your target function, helping you map dependencies and usage patterns."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/st3v3nmw/sourcerer-mcpCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use sourcerer-mcp to analyze the [PROJECT_NAME] codebase and identify all instances where [FUNCTION_NAME] is called or referenced. For each instance, extract the surrounding 5 lines of context and categorize them by [CONTEXT_TYPE: e.g., 'error handling', 'performance optimization', 'legacy code']. Return the results as a structured JSON report with file paths, line numbers, and categorized snippets.
```json
{
"search_results": {
"project_name": "E-Commerce Platform",
"function_name": "calculate_discount",
"total_instances": 12,
"by_context_type": {
"error_handling": [
{
"file_path": "/src/services/discount_service.py",
"line_number": 45,
"context": [
"try:",
" discount = calculate_discount(user, cart)",
" if discount < 0:",
" raise ValueError('Invalid discount calculated')",
"except ValueError as e:"
]
}
],
"performance_optimization": [
{
"file_path": "/src/utils/pricing_utils.py",
"line_number": 89,
"context": [
"def apply_bulk_discounts(items):",
" discounts = [calculate_discount(item) for item in items]",
" return sum(discounts)",
" # Note: Parallel processing could improve performance here"
]
}
]
}
}
}
```
**Summary:** The `calculate_discount` function is referenced 12 times across the codebase, with 3 instances in error handling contexts and 2 in performance optimization contexts. The most complex usage is in `/src/services/discount_service.py` where it interacts with user data validation. The performance-critical path in `/src/utils/pricing_utils.py` suggests potential for parallel processing optimization.Cloud ETL platform for non-technical data integration
IronCalc is a spreadsheet engine and ecosystem
Get more done every day with Microsoft Teams – powered by AI
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan