analyze-codebase-for-mcp
Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document.
Skill by Philipp Thoss
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/pjt222-analyze-codebase-for-mcp
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, backend, data, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/analyze-codebase-for-mcp
Tools it pre-approves 4
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
ReadGrepGlobBash
What's inside
- Skill name
analyze-codebase-for-mcp- Description
- Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document. Use when planning an MCP server for an existing project, auditing a codebase before wrapping it as an AI-accessible tool surface, comparing what a codebase can do versus what is already exposed via MCP, or generating a tool spec to hand off to scaffold-mcp-server.
- License
- MIT
- Allowed tools
- Read, Grep, Glob, Bash
- Metadata
- tags: mcp, analysis, tool-design, codebase · author: Philipp Thoss · domain: mcp-integration · version: 1.0 · language: multi · complexity: advanced
- Instructions
- 186 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves any shell command
Files (1)
- SKILL.md
SKILL.md (first lines)
# Analyze Codebase for MCP
Scan a codebase to discover functions, REST endpoints, CLI commands, and data access patterns that are good candidates for MCP tool exposure, then produce a structured tool specification document.
## When to Use
- Planning an MCP server for an existing project and need to know what to expose
- Auditing a codebase before wrapping it as an AI-accessible tool surface
- Comparing what a codebase can do versus what is already exposed via MCP
- Generating a tool specification document to hand off to `scaffold-mcp-server`
- Evaluating whether a third-party library is worth wrapping as MCP tools
## Inputs
- **Required**: Path to the codebase root directory
- **Required**: Target language(s) of the codebase (e.g., TypeScript, Python, R, Go)
- **Optional**: Existing MCP server code to compare against (gap analysis)
- **Optional**: Domain focus (e.g., "data analysis", "file operations", "API integration")
- **Optional**: Maximum number of tools to recommend (default: 20)
## Procedure
### Step 1: Scan Codebase Structure
1.1. Use `Glob` to map the directory tree, focusing on source directories:
- `src/**/*.{ts,js,py,R,go,rs}` for source files
- `**/routes/**`, `**/api/**`, `**/controllers/**` for endpoint definitions
- `**/cli/**`, `**/commands/**` for CLI entry points
- `**/package.json`, `**/setup.py`, `**/DESCRIPTION` for dependency metadata
1.2. Categorize files by role:
- **Entry points**: main files, route handlers, CLI commands
- **Core logic**: business logic functions, algorithms, data transformers
- **Data access**: database queries, file I/O, API clients
- **Utilities**: helpers, formatters, validators
1.3. Count total files, lines of code, and exported symbols to gauge project size.
**Got:** A categorized file inventory with role annotations.
**If fail:** If the codebase is too large (>10,000 files), narrow the scan to specific directories or modules using the domain focus input. If no source files are found, verify the root path and language parameters.
### Step 2: Identify Exposed Functions and Endpoints
2.1. Use `Grep` to find exported functions and public APIs:
- TypeScript/JavaScript: `export (async )?function`, `export default`, `module.exports`
- Python: functions not prefixed with `_`, `@app.route`, `@router`
- R: functions listed in NAMESPACE or `#' @export` roxygen tags
- Go: capitalized function names (exported by convention)
2.2. For each candidate function, extract:
- **Name**: function or endpoint name
- **Signature**: parameters with types and defaults
- **Return type**: what the function produces
- **Documentation**: docstrings, JSDoc, roxygen, godoc
- **Location**: file path and line number
2.3. For REST APIs, additionally extract:
- HTTP method and route pattern
- Request body schema
- Response shape
- Authentication requirements
2.4. Build a candidate list sorted by potential utility (public, documented, well-typed functions first).
**Got:** A list of 20-100 candidate functions/endpoints with extracted metadata.
**If fail:** If few candidates are found, broaden the search to include internal functions that could be made public. If documentation is sparse, flag this as a risk in the output.
### Step 3: Evaluate MCP Suitability
3.1. For each candidate, assess against MCP tool criteria:
- **Input contract clarity**: Are parameters well-typed and documented? Can they be described in a JSON Schema?
- **Output predictability**: Does the function return structured data (JSON-serializable)? Is the return shape consistent?
- **Side effects**: Does the function modify state (files, database, external services)? Side effects must be clearly labeled.
- **Idempotency**: Is the operation safe to retry? Non-idempotent tools need explicit warnings.
- **Execution time**: Will it complete within a reasonable timeout (< 30 seconds)? Long-running operations need async patterns.
- **Error handling**: Does it throw structured errors or fail silently?
3.2. Score each candidate on a 1-5 scale:
- **5**: Pure function, typed I/O, documented, fast, no side effects
- **4**: Well-typed, documented, minor side effects (e.g., logging)
- **3**: Reasonable I/O contract but needs wrapping (e.g., returns raw objects)
- **2**: Significant side effects or unclear contract, needs substantial adaptation
- **1**: Not suitable without major refactoring
3.3. Filter candidates to those scoring 3 or above. Flag score-2 items as "future candidates" requiring refactoring.
**Got:** A scored and filtered candidate list with suitability rationale for each.
**If fail:** If most candidates score below 3, the codebase may need refactoring before MCP exposure. Document the gaps and recommend specific improvements (add types, extract pure functions, wrap side effects).
### Step 4: Design Tool Specifications
4.1. For each selected candidate (score >= 3), draft a tool specification:
```yaml
- name: tool_name
description: >
One-line description of what the tool does.
source_function: module.function_name
source_file: src/path/to/file.ts:42
parameters:
param_name:
type: string | number | boolean | object | array
description: What this parameter controls
required: true | false
default: value_if_optional
returns:
type: string | object | array
description: What the tool returns
side_effects:
- description of any side effect
estimated_latency: fast | medium | slow
suitability_score: 5
```
4.2. Group tools into logical categories (e.g., "Data Queries", "File Operations", "Analysis", "Configuration").From pjt222/agent-almanac, MIT.
More from pjt222/agent-almanac
- 0.616score
adaptic
Philipp Thoss
Master skill composing the 5-step synoptic cycle for panoramic synthesis across multiple domains.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
add-puzzle-type
Philipp Thoss
Scaffold a new puzzle type across all 10+ pipeline integration points in jigsawR.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
add-rcpp-integration
Philipp Thoss
Add Rcpp or RcppArmadillo integration to an R package for high-performance C++ code.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
aikido
Philipp Thoss
Practice aikido as a defensive martial art emphasizing harmony, redirection, and controlled resolution.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-codebase-workflow
Philipp Thoss
Analyze an arbitrary codebase to auto-detect workflows, data pipelines, and file dependencies using putior's put_auto() engine.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-diffusion-dynamics
Philipp Thoss
Analyze the dynamics of diffusion processes using stochastic differential equations, Fokker-Planck equations, first-passage time distributions, and parameter…
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-generative-diffusion-model
Philipp Thoss
Analyze pre-trained generative diffusion models (Stable Diffusion, DALL-E, Flux) by computing quality metrics (FID, IS, CLIP score, precision/recall)…
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-kernel-bottleneck
Philipp Thoss
Systematically identify whether a GPU kernel is compute-bound, memory-bound, or latency-bound using roofline analysis, occupancy calculations, compute/load…
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-magnetic-field
Philipp Thoss
Calculate and visualize magnetic fields produced by current distributions using the Biot-Savart law, Ampere's law, and magnetic dipole approximations.
SkillBFreshness: B★ 42Claude Code - 0.616score
analyze-magnetic-levitation
Philipp Thoss
Analyze magnetic levitation systems by applying Earnshaw's theorem to determine whether passive static levitation is possible, then identifying the…
SkillBFreshness: B★ 42Claude Code - 0.616score
analyze-prime-numbers
Philipp Thoss
Analyze prime numbers using primality tests, factorization algorithms, prime distribution analysis, and sieve methods.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
adapt-architecture
Philipp Thoss
Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation.
SkillBFreshness: B★ 42Claude Code +9
Signals
- Stars
- 42
- Forks
- 5
- Open issues
- 182
- Last commit (this folder)
- Aug 17, 2026 (2 months ago)
- Last release
- Aug 26, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0
- License
- MIT
- Repository
- github.com/pjt222/agent-almanac
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Philipp Thoss
- 0.616score
adaptic
Philipp Thoss
Master skill composing the 5-step synoptic cycle for panoramic synthesis across multiple domains.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
add-puzzle-type
Philipp Thoss
Scaffold a new puzzle type across all 10+ pipeline integration points in jigsawR.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
add-rcpp-integration
Philipp Thoss
Add Rcpp or RcppArmadillo integration to an R package for high-performance C++ code.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
aikido
Philipp Thoss
Practice aikido as a defensive martial art emphasizing harmony, redirection, and controlled resolution.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
analyze-codebase-workflow
Philipp Thoss
Analyze an arbitrary codebase to auto-detect workflows, data pipelines, and file dependencies using putior's put_auto() engine.
SkillBFreshness: B★ 42Claude Code +9 - 0.616score
adapt-architecture
Philipp Thoss
Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation.
SkillBFreshness: B★ 42Claude Code +9
Cite this page
analyze-codebase-for-mcp skill. Agent Mart. https://agentmart.dev/skills/pjt222-analyze-codebase-for-mcp (last updated 2026-10-24)