mcp4mcp

mcp4mcp

A Meta MCP Server that provides persistent memory and intelligent guidance for MCP development projects.

Category
访问服务器

README

mcp4mcp - Meta MCP Server

A Meta MCP Server that provides persistent memory and intelligent guidance for MCP development projects.

🎯 Overview

mcp4mcp is a specialized MCP server designed to help developers build better MCP projects. It provides:

  • Persistent Project Memory: Track tools, their status, and development progress across sessions
  • AI-Powered Intelligence: Get suggestions, detect duplicates, and avoid conflicts
  • Development Session Tracking: Monitor your development activities and progress
  • Code Analysis: Automatic discovery and analysis of MCP tools in your codebase
  • Similarity Detection: Find similar tools to avoid duplication and improve consistency

🚀 Quick Start

Installation

# Install dependencies
pip install -e .

# Start the server
python server.py

# Or use the main entry point
python main.py server

Basic Usage

# Run the demo to see all features
python main.py demo

# Run tests
python main.py test

🛠️ Features

Core Tools

The server provides 11 MCP tools organized into three categories:

State Management

  • get_project_state_tool - Load current project state and tools
  • update_project_state_tool - Update project information and add/modify tools
  • scan_project_files_tool - Automatically scan files for MCP tools

Intelligence & Analysis

  • check_before_build_tool - Check for conflicts before building new tools
  • suggest_next_action_tool - Get AI-powered development suggestions
  • analyze_tool_similarity_tool - Analyze tools for similarity and duplication

Development Tracking

  • track_development_session_tool - Log development activities and progress
  • end_development_session_tool - End a development session with summary
  • get_development_sessions_tool - Get recent development sessions
  • get_session_analytics_tool - Get development analytics and insights
  • update_tool_status_tool - Update individual tool status

📋 Usage Examples

1. Project Management

# Start a new development session
await track_development_session(
    "Started working on file tools",
    "my_project",
    "file_reader",
    "Implementing CSV file reading capability"
)

# Update project with new tools
await update_project_state(
    "my_project",
    "File processing MCP server",
    [
        {
            "name": "read_csv",
            "description": "Read CSV files",
            "status": "planned"
        },
        {
            "name": "write_csv", 
            "description": "Write CSV files",
            "status": "planned"
        }
    ]
)

2. Conflict Detection

# Check before building a new tool
result = await check_before_build(
    "csv_processor",
    "Process CSV files by reading and writing",
    "my_project"
)

# Result will show potential conflicts with existing tools
print(f"Conflicts found: {len(result['conflicts'])}")
print(f"Recommendations: {result['recommendations']}")

3. AI-Powered Suggestions

# Get intelligent suggestions
suggestions = await suggest_next_action(
    "my_project",
    "I've implemented file reading, what should I do next?"
)

print("AI Suggestions:")
for suggestion in suggestions['suggestions']:
    print(f"- {suggestion}")

4. Code Scanning

# Automatically discover tools in your codebase
scan_result = await scan_project_files("my_project", "./src")

print(f"Found {scan_result['tools_found']} tools:")
for tool in scan_result['tools']:
    print(f"- {tool['name']}: {tool['description']}")

🏗️ Architecture

Project Structure

mcp4mcp/
├── server.py              # FastMCP server entry point
├── mcp4mcp/
│   ├── models.py           # Pydantic data models
│   ├── storage.py          # SQLite storage backend
│   ├── tools/              # MCP tool implementations
│   │   ├── state_management.py
│   │   ├── intelligence.py
│   │   └── tracking.py
│   ├── analyzers/          # Code analysis modules
│   │   ├── code_scanner.py
│   │   └── similarity.py
│   └── utils/              # Utility functions
├── tests/                  # Comprehensive test suite
└── examples/               # Usage examples and demos

Data Models

ProjectState

class ProjectState(BaseModel):
    name: str
    description: str
    tools: Dict[str, Tool]
    sessions: List[DevelopmentSession]
    analysis: Optional[ProjectAnalysis]
    created_at: datetime
    updated_at: datetime

Tool

class Tool(BaseModel):
    name: str
    description: str
    status: ToolStatus  # PLANNED, IN_PROGRESS, IMPLEMENTED, TESTED
    file_path: Optional[str]
    function_name: Optional[str]
    parameters: List[Dict[str, Any]]
    return_type: Optional[str]
    similarity_scores: Dict[str, float]

💾 Storage

All project data is stored in SQLite at ~/.mcp4mcp/projects.db with the following tables:

  • projects - Project metadata and state
  • tools - Individual tool definitions and status
  • sessions - Development session tracking
  • session_actions - Detailed session activities

🧪 Testing

Comprehensive test suite covering:

# Run all tests
python -m pytest tests/ -v

# Run specific test categories
python -m pytest tests/test_models.py -v      # Data models
python -m pytest tests/test_storage.py -v     # Storage backend
python -m pytest tests/test_tools.py -v       # Tool functionality
python -m pytest tests/test_server.py -v      # Server integration

📚 Examples

Example Project

The examples/example_project/ directory contains a sample MCP server with:

  • File manipulation tools (read, write, list)
  • Mathematical calculation tools (calculator, sqrt, power, factorial)
  • Proper FastMCP integration

Demo Script

Run the comprehensive demo:

python examples/demo_usage.py

This demonstrates:

  • Project creation and management
  • Tool scanning and analysis
  • Development session tracking
  • AI-powered suggestions
  • Conflict detection

🔧 Configuration

Environment Variables

  • MCP4MCP_DB_PATH - Custom database path (default: ~/.mcp4mcp/projects.db)
  • MCP4MCP_LOG_LEVEL - Logging level (default: INFO)

FastMCP Integration

from fastmcp import FastMCP
from mcp4mcp.tools.state_management import register_state_tools
from mcp4mcp.tools.intelligence import register_intelligence_tools
from mcp4mcp.tools.tracking import register_tracking_tools

mcp = FastMCP("your-mcp-server")

# Register mcp4mcp tools
register_state_tools(mcp)
register_intelligence_tools(mcp)
register_tracking_tools(mcp)

# Register your own tools
@mcp.tool()
def your_tool():
    return "Hello from your tool!"

mcp.run()

🚀 Development

Adding New Tools

  1. Create tool functions in appropriate module (mcp4mcp/tools/)
  2. Add tests in tests/test_tools.py
  3. Register tools in server.py
  4. Update documentation

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

📄 License

This project is licensed under the MIT License.

🤝 Support

  • Issues: Report bugs and request features on GitHub
  • Documentation: Full API documentation in the code
  • Examples: See examples/ directory for usage patterns

mcp4mcp - Making MCP development smarter, one tool at a time! 🚀

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选