This is a modular MCP agent for analyzing local code repositories.
It exposes tools to inspect a projectβs file structure, read files (with language detection), and guide the user through code exploration via structured prompts.
Powered by Model Context Protocol TypeScript SDK with
Streamable HTTPas Transport Type.
- ποΈ Initializes and inspects code repositories (with
.gitignoresupport) - π Traverses directory trees with depth control
- π Reads file content (up to 1MB / 1000 lines)
- π¬ Provides prompt-guided codebase analysis for LLMs
- β Fully compatible with MCP Inspector
- Node.js
>= 18.x - MCP-compatible client (e.g., MCP Inspector)
- Local repo access via allowed
roots
git clone https://github.com/sur950/mcp-server-examples.git
cd mcp-server-examples
npm install-
Start the MCP server:
npm run dev
-
Open a second terminal and run:
npm run debug
This opens the MCP Inspector UI at http://127.0.0.1:6274.
π― In the Inspector, make sure to select
Streamable HTTPas the transport type, then set the URL to:http://localhost:3000/mcp
| Tool | Description |
|---|---|
init_repo |
Initialize a repo path (must be allowed) |
get_repo_info |
Return .gitignore and path details |
get_repo_structure |
Show directory tree by depth/subpath |
read_file |
Read file contents with language detection |
| Prompt | Description |
|---|---|
analyze_code_repository |
Guided exploration of repo for LLM use |
The prompt walks the LLM through:
- Initialization β Structure β File reading
- Forming and verifying hypotheses
- Producing structured, evidence-based conclusions
| Resource Name | URI Pattern | Description |
|---|---|---|
repo-schema |
schema://main |
Returns tree structure of initialized repo |
code-analysis/
βββ tools.ts # Tool implementations (init, structure, file)
βββ prompt.ts # Prompt definition for LLM agents
βββ utils.ts # Gitignore parsing, reader helpers
βββ server.ts # MCP server with registration logic
βββ resource.ts # Resources registered (e.g., file://, schema://)
βββ assets/ # Screenshots for demo
βββ README.md

