Code Explainer MCP
コード解説者MCP
コード解説のためのMCP(Model Context Protocol)サーバーとして機能するCloudflare Worker。コードの構造と機能を包括的に分析・解説します。
特徴
アーキテクチャ ダイアグラム: 全体的な構造、コンポーネント間の関係、およびデータ フローを示す ASCII ダイアグラムを生成します。
コア機能分析: パターン認識に基づいてコードの主な目的を識別し、説明します。
コンポーネントの内訳: すべての主要なクラスと関数を、その役割の簡単な説明とともに一覧表示します。
多言語サポート: JavaScript、TypeScript、Python、Java、C# など、さまざまなプログラミング言語のコードを分析します。
JSDoc/Docstring 認識: コード内の既存のドキュメントを抽出して利用します。
セキュア API : エンドポイントを保護するためのベアラー トークン認証。
Related MCP server: Smart Code Reviewer
仕組み
Code Explainer は、次のような技術を組み合わせてソース コードを分析します。
パターン認識: コード構造と共通パターンを識別します
関係分析: コンポーネント間の依存関係をマッピングします
ドキュメント抽出: 既存のドキュメントコメントを優先します
アーキテクチャの視覚化: コード構造のASCIIダイアグラムを作成します
コンポーネントの説明: 関数とクラスの意味的な説明を提供します
すべての処理は外部依存なしに Cloudflare Worker 内で行われます。
インストール
前提条件
設定
このリポジトリをクローンします:
git clone https://github.com/BillDuke13/code-explainer-mcp.git cd code-explainer-mcp依存関係をインストールします:
npm install秘密鍵を設定します:
wrangler.jsoncを編集し、YOUR_SECRET_KEY_HEREを選択した秘密鍵に置き換えるか、Cloudflare シークレットを使用する (本番環境では推奨):
wrangler secret put SHARED_SECRET
Cloudflare Workers にデプロイする:
npm run deploy
使用法
APIエンドポイント
次の JSON 本文を含む POST リクエストをワーカー URL に送信します。
{
"method": "explainCode",
"params": ["your code here", "programming language"]
}秘密キーを含む Authorization ヘッダーを追加します。
Authorization: Bearer YOUR_SECRET_KEY_HERE応答フォーマット
応答は、コード分析を含むresultフィールドを持つ JSON オブジェクトになります。
{
"result": "# Code Analysis for JavaScript Code\n\n## Architecture Diagram\n...\n\n## Core Functionality\n..."
}使用例
JavaScript(ブラウザ)
async function explainCode(code, language) {
const response = await fetch('https://your-worker-url.workers.dev', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_SECRET_KEY_HERE',
},
body: JSON.stringify({
method: "explainCode",
params: [code, language]
}),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.result;
}
// Example usage
const jsCode = `function add(a, b) { return a + b; }`;
explainCode(jsCode, "javascript")
.then(explanation => console.log(explanation))
.catch(error => console.error('Error:', error));Python(リクエスト)
import requests
import json
def explain_code(code, language, api_url, secret_key):
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {secret_key}'
}
payload = {
'method': 'explainCode',
'params': [code, language]
}
response = requests.post(api_url, headers=headers, json=payload)
response.raise_for_status()
return response.json()['result']
# Example usage
code = "def hello(): print('Hello, world!')"
explanation = explain_code(code, "python", "https://your-worker-url.workers.dev", "YOUR_SECRET_KEY_HERE")
print(explanation)Node.js(アクシオス)
const axios = require('axios');
async function explainCode(code, language) {
try {
const response = await axios.post('https://your-worker-url.workers.dev', {
method: 'explainCode',
params: [code, language]
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_SECRET_KEY_HERE'
}
});
return response.data.result;
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
throw error;
}
}
// Example usage
const codeToAnalyze = `
class Person {
constructor(name) {
this.name = name;
}
sayHello() {
return \`Hello, my name is \${this.name}\`;
}
}
`;
explainCode(codeToAnalyze, 'javascript')
.then(explanation => console.log(explanation))
.catch(err => console.error('Failed to explain code:', err));地域開発
リポジトリをクローンし、依存関係をインストールします。
git clone https://github.com/BillDuke13/code-explainer-mcp.git cd code-explainer-mcp npm install開発サーバーを実行します。
wrangler devエンドポイントをローカルでテストします。
curl -X POST http://localhost:8787 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_SECRET_KEY_HERE" \ -d '{"method":"explainCode","params":["function hello() { return \"Hello World\"; }","javascript"]}'
開発ガイドライン
TypeScriptのベストプラクティスに従う
複雑なロジックにコメントを追加する
公開APIの変更に関するドキュメントの更新
新機能のテストを追加する
安全
APIはベアラートークン認証で保護されています
本番環境で共有シークレットを保存するには環境シークレットを使用します
実際の秘密鍵をバージョン管理にコミットしないでください
本番環境での導入にはレート制限が推奨されます
ライセンス
このプロジェクトは、Apache License 2.0 に基づいてライセンスされています。詳細については、 LICENSEファイルを参照してください。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConverts code into UML diagrams and flowcharts through static analysis, enabling visualization of code structure and explanation of functionality.38MIT
- AlicenseAqualityDmaintenanceEnables comprehensive code analysis including quality assessment, security vulnerability detection, refactoring suggestions, complexity calculations, and automatic documentation generation for multiple programming languages.514MIT
- AlicenseAqualityDmaintenanceEnables inspection and analysis of project structures to detect languages, frameworks, entry points, and dependencies across multiple programming languages including Node.js, Python, PHP, Go, Java, and Rust.3181ISC
- AlicenseNot gradedqualityDmaintenanceAnalyzes codebases to automatically generate README, API docs, architecture diagrams, and CHANGELOG.16MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/BillDuke13/code-explainer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server