Sponsored by Deepsite.site

Code Context Provider MCP

Created By
AB4988 months ago
MCP server that provides code context and analysis for AI assistants. Extracts directory structure and code symbols using WebAssembly Tree-sitter parsers with Zero Native Dependencies.
Content

Code Context Provider MCP

MCP server that provides code context and analysis for AI assistants. Extracts directory structure and code symbols using WebAssembly Tree-sitter parsers with Zero Native Dependencies.

Discord License: MIT npm

Features

  • Generate directory tree structure
  • Analyze JavaScript/TypeScript and Python files
  • Extract code symbols (functions, variables, classes, imports, exports)
  • Compatible with the MCP protocol for seamless integration with AI assistants

Quick Usage (MCP Setup)

Installing via Smithery

To install Code Context Provider for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @AB498/code-context-provider-mcp --client claude

Windows

{
  "mcpServers": {
    "code-context-provider-mcp": {
      "command": "cmd.exe",
      "args": [
        "/c",
        "npx",
        "-y",
        "code-context-provider-mcp@latest"
      ]
    }
  }
}

MacOS/Linux

{
  "mcpServers": {
    "code-context-provider-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "code-context-provider-mcp@latest"
      ]
    }
  }
}

OR install globally with npm:

npm install -g code-context-provider-mcp

Then use it by running:

code-context-provider-mcp # if you're not using @latest, you may want to clear the cache for latest version using `Remove-Item -Path "$env:LOCALAPPDATA\npm-cache\_npx" -Recurse -Force` for windows and `rm -rf ~/.npm/_npx` for linux/macos

Available Tools

get_code_context

Analyzes a directory and returns its structure along with code symbols (optional).

Parameters:

  • absolutePath (string, required): Absolute path to the directory to analyze
  • analyzeJs (boolean, optional): Whether to analyze JavaScript/TypeScript and Python files (default: false)
  • includeSymbols (boolean, optional): Whether to include code symbols in the response (default: false)
  • symbolType (enum, optional): Type of symbols to include if includeSymbols is true (options: 'functions', 'variables', 'classes', 'imports', 'exports', 'all', default: 'all')
  • filePatterns (array of strings, optional): File patterns to analyze (e.g. ['.js', '.py', 'config.*'])
  • maxDepth (number, optional): Maximum directory depth to analyze (default: 5 levels)

Note: Anonymous functions are automatically filtered out of the results.

Example Output Text On Tool Call

Directory structure for: C:\Users\Admin\Desktop\mcp\context-provider-mcp

Code Analysis Summary:
- Files analyzed: 3
- Total functions: 29
- Total variables: 162
- Total classes: 0

Note: Symbol analysis is supported for JavaScript/TypeScript (.js, .jsx, .ts, .tsx) and Python (.py) files only.

Code analysis limited to a maximum depth of 5 directory levels (default).

├── index.js (39 KB)
│   └── [Analyzed: 22 functions, 150 variables, 0 classes]
│       Functions:
│       - initializeTreeSitter [39:0]
│       - getLanguageFromExtension [107:0]
│       - getPosition [138:24]

File Pattern Examples

You can use the filePatterns parameter to specify which files to analyze. This is useful for complex projects with multiple languages or specific files of interest.

Examples:

  • ["*.js", "*.py"] - Analyze all JavaScript and Python files
  • ["config.*"] - Analyze all configuration files regardless of extension
  • ["package.json", "*.config.js"] - Analyze package.json and any JavaScript config files
  • [".ts", ".tsx", ".py"] - Analyze TypeScript and Python files (using extension format)

The file pattern matching supports:

  • Simple glob patterns with wildcards (*)
  • Direct file extensions (with or without the dot)
  • Exact file names

Handling Large Projects

For very large projects, you can use the maxDepth parameter to limit how deeply the tool will traverse directories:

  • maxDepth: 2 - Only analyze the root directory and one level of subdirectories
  • maxDepth: 3 - Analyze the root, and two levels of subdirectories
  • maxDepth: 0 - Only analyze files in the root directory

This is particularly useful when:

  • Working with large monorepos
  • Analyzing projects with many dependencies
  • Focusing only on the main source code and not third-party libraries

Supported Languages

Code symbol analysis is supported for:

  • JavaScript (.js)
  • JSX (.jsx)
  • TypeScript (.ts)
  • TSX (.tsx)
  • Python (.py)

Using the filePatterns parameter allows you to include other file types in the directory structure, though symbolic analysis may be limited.

Development

Setting up the Development Environment

# Clone the repository
git clone https://github.com/your-username/code-context-provider-mcp.git
cd code-context-provider-mcp

# Install dependencies
npm install

# Set up WASM parsers
npm run setup

Post-Installation

After installation, the package's prepare script automatically runs to download the WASM parsers. If for some reason the download fails, users can manually run the setup:

npx code-context-provider-mcp-setup

License

MIT

For more information or help

Server Config

{
  "mcpServers": {
    "code-context-provider-mcp": {
      "command": "npx",
      "args": [
        "code-context-provider-mcp"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
CursorThe AI Code Editor
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
Serper MCP ServerA Serper MCP Server
ChatWiseThe second fastest AI chatbot™