Skip to main content
Glama
AB498

Code Context Provider MCP

by AB498

コードコンテキストプロバイダー MCP

AIアシスタントにコードコンテキストと分析を提供するMCPサーバー。ネイティブ依存関係ゼロのWebAssembly Tree-sitterパーサーを使用して、ディレクトリ構造とコードシンボルを抽出します。


特徴

  • ディレクトリツリー構造を生成する

  • JavaScript/TypeScriptおよびPythonファイルを分析する

  • コードシンボル(関数、変数、クラス、インポート、エクスポート)を抽出します

  • MCPプロトコルと互換性があり、AIアシスタントとのシームレスな統合が可能

Related MCP server: syntax-map-mcp

クイック使用方法(MCP セットアップ)

Smithery経由でインストール

Smithery経由で Claude Desktop のコード コンテキスト プロバイダーを自動的にインストールするには:

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

ウィンドウズ

{
  "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"
      ]
    }
  }
}

またはnpmを使用してグローバルにインストールします。

npm install -g code-context-provider-mcp

次に、次のコマンドを実行して使用します。

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

利用可能なツール

get_code_context

ディレクトリを分析し、その構造とコード シンボル (オプション) を返します。

パラメータ:

  • absolutePath (文字列、必須): 分析するディレクトリへの絶対パス

  • analyzeJs (ブール値、オプション): JavaScript/TypeScript および Python ファイルを分析するかどうか (デフォルト: false)

  • includeSymbols (ブール値、オプション):レスポンスにコードシンボルを含めるかどうか(デフォルト:false)

  • symbolType (列挙型、オプション): includeSymbols が true の場合に含めるシンボルの種類 (オプション: 'functions'、'variables'、'classes'、'imports'、'exports'、'all'、デフォルト: 'all')

  • filePatterns (文字列の配列、オプション): 分析するファイルパターン (例: [' .js', ' .py', 'config.*'])

  • maxDepth (数値、オプション): 分析するディレクトリの最大深度 (デフォルト: 5 レベル)

注: 匿名関数は結果から自動的に除外されます。

ツール呼び出し時の出力テキストの例

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]

ファイルパターンの例

filePatternsパラメータを使用して、分析するファイルを指定できます。これは、複数の言語や特定のファイルを扱う複雑なプロジェクトに役立ちます。

例:

  • ["*.js", "*.py"] - すべてのJavaScriptおよびPythonファイルを分析します

  • ["config.*"] - 拡張子に関係なくすべての設定ファイルを分析します

  • ["package.json", "*.config.js"] - package.jsonとJavaScript設定ファイルを解析します

  • [".ts", ".tsx", ".py"] - TypeScript および Python ファイルを解析します (拡張子形式を使用)

ファイル パターン マッチングでは以下がサポートされます。

  • ワイルドカード (*) を使用した単純な glob パターン

  • 直接ファイル拡張子(ドットの有無にかかわらず)

  • 正確なファイル名

大規模プロジェクトの取り扱い

非常に大規模なプロジェクトの場合、 maxDepthパラメータを使用して、ツールがディレクトリを走査する深さを制限できます。

  • maxDepth: 2 - ルートディレクトリと1階層下のサブディレクトリのみ解析する

  • maxDepth: 3 - ルートと2階層のサブディレクトリを解析します

  • maxDepth: 0 - ルートディレクトリ内のファイルのみを解析する

これは特に次の場合に役立ちます:

  • 大規模なモノレポジトリでの作業

  • 多くの依存関係を持つプロジェクトの分析

  • メインのソースコードのみに焦点を当て、サードパーティのライブラリには焦点を当てない

サポートされている言語

コード シンボル分析は以下に対してサポートされています:

  • JavaScript (.js)

  • JSX (.jsx)

  • タイプスクリプト (.ts)

  • TSX (.tsx)

  • Python (.py)

filePatternsパラメータを使用すると、ディレクトリ構造に他のファイル タイプを含めることができますが、シンボリック分析は制限される可能性があります。

発達

開発環境の設定

# 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

インストール後

インストール後、パッケージのprepareスクリプトが自動的に実行され、WASMパーサーがダウンロードされます。何らかの理由でダウンロードに失敗した場合は、手動でセットアップを実行できます。

npx code-context-provider-mcp-setup

ライセンス

マサチューセッツ工科大学

詳細情報やヘルプ

Available Tools

1 tool
get_code_contextA

Returns Complete Context of a given project directory, including directory tree, and code symbols. Useful for getting a quick overview of a project. Use this tool when you need to get a comprehensive overview of a project's codebase. Useful at the start of a new task.

ParametersJSON Schema
NameRequiredDescriptionDefault
absolutePathYesAbsolute path to the directory to analyze. For windows, it is recommended to use forward slashes to avoid escaping (e.g. C:/Users/username/Documents/project/src)
analyzeJsNoWhether to analyze JavaScript/TypeScript and Python files. Returns the count of functions, variables, classes, imports, and exports in the codebase.
includeSymbolsNoWhether to include code symbols in the response. Returns the code symbols for each file.
maxDepthNoMaximum directory depth for code analysis (default: 5 levels). Directory tree will still be built for all levels. Reduce the depth if you only need a quick overview of the project.
symbolTypeNoType of symbols to include if includeSymbols is true. Otherwise, returns only the directory tree.all

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool returns (context, directory tree, code symbols) and its usefulness for project overviews, but lacks details on performance, error handling, or specific output format. This provides basic behavioral context but leaves gaps for a tool with 5 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences that each add value: stating the tool's purpose, its usefulness for overviews, and when to use it. It is front-loaded with the core functionality. A minor deduction for slight redundancy ('useful' appears twice).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is moderately complete. It covers the purpose and usage context but lacks details on output format, error cases, or performance considerations. Without an output schema, more guidance on return values would be beneficial for full contextual understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema fully documents all 5 parameters. The description does not add any parameter-specific semantics beyond what the schema provides, such as explaining interactions between parameters like analyzeJs and includeSymbols. The baseline score of 3 reflects adequate but not enhanced parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('returns complete context') and resources ('project directory, including directory tree, and code symbols'). It distinguishes the tool's comprehensive overview capability, which is well-defined even without sibling tools for comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool ('useful for getting a quick overview of a project' and 'useful at the start of a new task'). However, it lacks explicit guidance on when not to use it or alternatives, as there are no sibling tools mentioned to differentiate from.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedget_code_context

TDQS

A3.7/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear and distinct purpose focused on providing project context.

Naming Consistency5/5

The naming follows a consistent verb_noun pattern (get_code_context), and with only one tool, there is no inconsistency to evaluate. The naming is clear and descriptive.

Tool Count2/5

A single tool is generally too few for most MCP server purposes, as it limits functionality and can feel thin. For a 'Code Context Provider', one tool may not cover all potential needs like updating or filtering context, making it borderline inadequate.

Completeness2/5

The tool set is severely incomplete for the implied domain of code context provision. While it offers a comprehensive overview, there are obvious gaps such as tools for updating context, filtering by file type, or handling specific symbols, which could lead to agent workarounds or failures.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to understand and navigate codebases through structural analysis. Provides code mapping, symbol search, and impact analysis using ast-grep for accurate parsing of Python, JavaScript, TypeScript, and Go projects.
    4
    52
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables code analysis of JavaScript, TypeScript, TSX, Python, and Rust files using Tree-sitter, providing symbol listing, definition/reference lookup, AST queries, LSP-style features, and SQLite indexing for efficient cross-file searches.
    8 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.
    9 npm
    1
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    A deterministic structural code map server for AI agents, giving them the shape of a codebase (imports, exports, classes, functions, signatures, comments, TODO-markers) without reading whole files into context. Powered by tree-sitter WASM grammars, it runs anywhere Node 18+ works.
    7
    2 npm
    1
    AGPL 3.0