PT-MCP (Paul Test Man Context Protocol)
Provides comprehensive codebase analysis and semantic understanding through integrated knowledge graphs, enabling AI assistants to understand project structure, patterns, dependencies, and context through multiple analysis tools and format generators.
README
PT-MCP (Paul Test Man Context Protocol)
"Where am I now?"
Named after Paul Marcarelli, the Verizon "Test Man" who famously traversed America asking "Can you hear me now?", PT-MCP asks the essential question for AI coding assistants: "Where am I now?" - providing comprehensive context understanding through integrated knowledge graphs and semantic schemas.
The Paul Test Man Story
Just as Paul Test Man mapped Verizon's network coverage across America to ensure clear communication, PT-MCP maps your codebase's semantic landscape to ensure clear understanding. The server doesn't just return code structure - it returns meaning through:
- YAGO 4.5 Knowledge Graphs: Base knowledge graph segments relevant to your context
- Schema.org Domain Graphs: Domain-specific semantic understanding
- Codebase Analysis: Comprehensive structure, patterns, and relationships
Overview
PT-MCP helps AI coding assistants understand your codebase by providing:
- Comprehensive codebase analysis - File structure, language distribution, code metrics
- Context file generation - Multiple format support (.cursorrules, SPEC.md, etc.)
- Incremental updates - Efficient context regeneration based on changes
- Pattern extraction - Identify architectural and coding patterns
- Dependency analysis - Map internal and external dependencies
- API surface extraction - Document public interfaces
- Context validation - Ensure accuracy and completeness
Installation
npm install
npm run build
Usage
As an MCP Server
Add to your Claude Code configuration (~/.config/claude/config.json):
{
"mcpServers": {
"context-manager": {
"command": "node",
"args": ["/path/to/context-manager-mcp/dist/index.js"],
"env": {}
}
}
}
Available Tools
1. analyze_codebase
Perform comprehensive codebase analysis including structure, dependencies, and metrics.
{
path: string; // Root directory path
languages?: string[]; // Languages to analyze (auto-detect if omitted)
depth?: number; // Analysis depth (1-5, default: 3)
include_patterns?: string[]; // Glob patterns to include
exclude_patterns?: string[]; // Glob patterns to exclude
analysis_type?: 'quick' | 'standard' | 'deep'; // Default: 'standard'
}
Example:
{
"path": "/path/to/project",
"analysis_type": "standard",
"exclude_patterns": ["**/node_modules/**", "**/.git/**"]
}
Returns:
- Total files, lines, and size
- Language distribution with percentages
- Directory structure and depth
- Entry points identification
- Package information (if available)
2. generate_context
Generate context files in specified format.
{
path: string;
format: 'cursorrules' | 'cursor_dir' | 'spec_md' | 'agents_md' | 'custom';
output_path?: string;
analysis_result?: any;
options?: Record<string, any>;
}
Note: Implementation pending (stub currently returns placeholder)
3. update_context
Incrementally update existing context files based on code changes.
{
path: string;
changed_files: string[];
context_format: string;
force_full_regeneration?: boolean;
}
Note: Implementation pending (stub currently returns placeholder)
4. extract_patterns
Identify and extract architectural and coding patterns.
{
path: string;
pattern_types?: string[];
min_occurrences?: number;
}
Note: Implementation pending (stub currently returns placeholder)
5. analyze_dependencies
Analyze and map internal and external dependencies.
{
path: string;
include_external?: boolean;
include_internal?: boolean;
max_depth?: number;
}
Note: Implementation pending (stub currently returns placeholder)
6. watch_project
Start monitoring project for changes and auto-update context.
{
path: string;
context_formats: string[];
debounce_ms?: number;
watch_patterns?: string[];
}
Note: Implementation pending (stub currently returns placeholder)
7. extract_api_surface
Extract and document public API surface.
{
path: string;
include_private?: boolean;
output_format?: 'markdown' | 'json' | 'typescript';
}
Note: Implementation pending (stub currently returns placeholder)
8. validate_context
Validate accuracy and completeness of generated context files.
{
path: string;
context_path: string;
checks?: string[];
}
Note: Implementation pending (stub currently returns placeholder)
Available Resources
context://project/{path}
Current project context including structure, patterns, and dependencies.
context://patterns/{path}
Architectural and coding patterns detected in the codebase.
context://dependencies/{path}
Internal and external dependency relationships.
Development Status
Phase 1: Foundation (✅ Complete)
- [x] MCP server boilerplate with stdio transport
- [x] Project structure and dependencies
- [x]
analyze_codebasetool - fully functional - [x] Stub implementations for remaining tools
Phase 2: Core Analysis (🚧 In Progress)
- [ ] Implement
generate_contexttool - [ ] Implement
extract_patternstool - [ ] Implement
analyze_dependenciestool - [ ] Add tree-sitter integration for deep code analysis
Phase 3: Advanced Features (📋 Planned)
- [ ] Implement
update_contexttool with incremental updates - [ ] Implement
watch_projecttool with file system monitoring - [ ] Implement
extract_api_surfacetool - [ ] Implement
validate_contexttool
Architecture
context-manager-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── tools/ # Tool implementations
│ │ ├── index.ts # Tool registration
│ │ ├── analyze-codebase.ts
│ │ ├── generate-context.ts
│ │ ├── update-context.ts
│ │ ├── extract-patterns.ts
│ │ ├── analyze-dependencies.ts
│ │ ├── watch-project.ts
│ │ ├── extract-api-surface.ts
│ │ └── validate-context.ts
│ ├── resources/ # Resource handlers
│ │ └── index.ts
│ ├── analyzers/ # Code analysis engines (future)
│ ├── generators/ # Context generators (future)
│ ├── utils/ # Utility functions (future)
│ └── types/ # TypeScript type definitions (future)
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
Testing
Test the MCP server locally:
# Build the project
npm run build
# Test analyze_codebase tool
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"analyze_codebase","arguments":{"path":"/path/to/project","analysis_type":"standard"}}}' | node dist/index.js
Contributing
This is a work in progress. See the specification document for the full implementation roadmap.
Next Steps
- Implement context file generators for different formats
- Add tree-sitter integration for deeper code analysis
- Implement pattern extraction algorithms
- Add file system watching and incremental updates
- Create comprehensive test suite
License
MIT
Related Projects
- Giga AI - VS Code extension for context management
- Kilo Code CLI - CLI wrapper for VS Code extensions
- Model Context Protocol - Protocol specification
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。