FDEP MCP Server

FDEP MCP Server

Provides static code analysis for enterprise-scale Haskell codebases with 40+ comprehensive tools for analyzing modules, functions, types, classes, imports, and architectural dependencies through real-time queries.

Category
访问服务器

README

FDEP MCP Server

A Static Code Analysis Model Context Protocol (MCP) server delivering 40+ comprehensive analysis tools for enterprise-scale Haskell codebases. Seamlessly integrates with MCP-compatible AI tools and clients to provide real-time code intelligence and architectural insights.

🔌 MCP Protocol Compliant | 🏗️ 40+ Analysis Tools | ⚡ Real-time Queries

✨ MCP Server Features

📊 40+ Comprehensive Analysis Tools

  • Module Analysis: 7 tools for module structure and dependencies
  • Function Analysis: 8 tools for call graphs and complexity metrics
  • Type System: 6 tools for type relationships and usage patterns
  • Class Analysis: 3 tools for typeclass and instance analysis
  • Import Analysis: 4 tools for dependency visualization
  • Advanced Queries: 4 tools for complex JSON-based code queries
  • Pattern Analysis: 5 tools for code pattern detection
  • Source Location: 3 tools for location-based analysis
  • Enhanced Analysis: 3 tools for advanced structural analysis

🚀 Quick Start

Prerequisites

  • Python 3.13+
  • UV package manager
  • PostgreSQL database (must be running)
  • FDEP output from Spider plugin (for comprehensive analysis)

Database Setup

Before installation, ensure PostgreSQL is running and create the required database:

# Start PostgreSQL (if not already running)
# On macOS with Homebrew:
brew services start postgresql

# On Ubuntu/Debian:
sudo systemctl start postgresql

# Create the database
createdb code_as_data # this should match with you $DB_NAME value in .env file (DEFAULT: code_as_data)

Installation

# Clone the repository
git clone https://github.com/juspay/fdep-mcp-server.git
cd fdep_mcp

# Install globally with UV (recommended)
uv tool install .

# OR install globally with pipx
# pipx install .

# OR system-wide installation
# pip install .vi 

Database Setup and Data Import

Important: Complete this step before using the MCP server with any client.

fdep-mcp-server --setup --verbose

This command will:

  • Initialize the PostgreSQL database schema
  • Import and process your FDEP data (if FDEP_PATH is configured)
  • Set up all necessary indexes and relationships

Note: The first run takes time as it processes large FDEP datasets.

Configure Environment

cp .env.example .env
# Edit .env with your database settings and FDEP_PATH

🔌 MCP Client Configuration

After installation, configure your preferred MCP client to connect to the FDEP server:

Claude Code

Add to your ~/.claude/settings.json:

{
  "mcpServers": {
    "fdepAnalyzer": {
      "command": "fdep-mcp-server",
      "args": [],
      "env": {
        "FDEP_PATH": "/path/to/your/fdep/output"
      }
    }
  }
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

Cursor

Add to your Cursor settings (Cmd/Ctrl + , → Extensions → MCP):

{
  "mcp.servers": {
    "fdepAnalyzer": {
      "command": "fdep-mcp-server",
      "args": [],
      "env": {
        "FDEP_PATH": "/path/to/your/fdep/output",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

VS Code

Install the MCP extension and add to settings.json:

{
  "mcp.servers": [
    {
      "name": "fdepAnalyzer",
      "command": "fdep-mcp-server", 
      "args": [],
      "env": {
        "FDEP_PATH": "/path/to/your/fdep/output"
      }
    }
  ]
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

Cline

Add to your Cline configuration:

{
  "mcpServers": {
    "fdepAnalyzer": {
      "command": "fdep-mcp-server",
      "args": [],
      "env": {
        "FDEP_PATH": "/path/to/your/fdep/output"
      }
    }
  }
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

Continue.dev

Add to your .continue/config.json:

{
  "mcpServers": [
    {
      "name": "fdepAnalyzer",
      "command": "fdep-mcp-server",
      "args": [],
      "env": {
        "FDEP_PATH": "/path/to/your/fdep/output"
      }
    }
  ]
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

Generic MCP Client

For any MCP-compatible client:

{
  "server_name": "fdepAnalyzer",
  "command": "fdep-mcp-server",
  "args": [],
  "environment": {
    "FDEP_PATH": "/path/to/your/fdep/output",
    "DB_HOST": "localhost",
    "DB_NAME": "code_as_data",
    "LOG_LEVEL": "INFO"
  }
}

Note: The first time running the server takes time as it imports and processes the FDEP data.

Environment Variables for All Clients

# Required
FDEP_PATH=/path/to/your/fdep/output

# Database (if different from defaults)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=code_as_data
DB_USER=postgres
DB_PASSWORD=postgres

# Optional
LOG_LEVEL=INFO
DEV_MODE=false

Verify Connection

After configuring your client, verify the connection:

  1. Start your MCP client
  2. Look for "fdepAnalyzer" in available tools/servers
  3. Test with a simple query: list_modules(limit=5)
  4. You should see your Haskell modules listed

🛠️ MCP Tools Available (40+ Total)

📁 Module Analysis (7 tools)

Tool Description
initialize_database Setup database and import FDEP data
list_modules Get list of modules with filtering
get_module_details Detailed module info with statistics
get_functions_by_module List all functions in a module
search_modules Pattern-based module search
get_module_dependencies Module dependency analysis
get_code_statistics Comprehensive codebase statistics

⚡ Function Analysis (8 tools)

Tool Description
get_function_details Detailed function information
search_functions Search functions by pattern
get_most_called_functions Find frequently called functions
get_function_call_graph Function call hierarchy
get_function_callers Who calls this function
get_function_callees What functions this calls
analyze_function_complexity Function complexity metrics
get_function_context Complete function context with dependencies

🏗️ Type System Analysis (6 tools)

Tool Description
list_types Get types by module/pattern with categories
get_type_details Type info with constructors/fields
search_types Advanced type search with filtering
get_type_dependencies Type dependency analysis
analyze_type_usage Type usage patterns
get_nested_types Get nested type definitions

📚 Class Analysis (3 tools)

Tool Description
list_classes Get class definitions with filtering
get_class_details Class info with instances
search_classes Pattern-based class search

📦 Import Analysis (4 tools)

Tool Description
analyze_imports Import patterns and dependencies
get_import_graph Module import relationship graphs
find_unused_imports Potential cleanup candidates
get_import_details Comprehensive import information

🔍 Advanced Queries (4 tools)

Tool Description
execute_query Basic SQL queries
execute_advanced_query JSON-based complex queries with joins
execute_custom_query Custom SQL queries with parameters
find_cross_module_calls Cross-module function usage

🎯 Pattern Analysis (5 tools)

Tool Description
find_similar_functions Find functions similar to a given function
find_code_patterns Find recurring code patterns
group_similar_functions Group functions by similarity
build_type_dependency_graph Build comprehensive type dependency graph
analyze_type_relationships Analyze deep type relationships

📍 Source Location (3 tools)

Tool Description
find_element_by_location Find code elements by source location
get_location_context Get context around a source location
generate_function_imports Generate import statements for functions

🔬 Enhanced Analysis (3 tools)

Tool Description
pattern_match_code Advanced pattern matching for code structures
analyze_cross_module_dependencies Comprehensive dependency analysis
enhanced_function_call_graph Enhanced call graphs with advanced options

🔍 Example Queries

Basic Analysis

# Search for validation functions
search_functions(pattern="validation", limit=10)

# Get details about main functions  
get_function_details(function_name="main")

# Find most called functions
get_most_called_functions(limit=20)

# List modules in a specific area
list_modules(limit=50)

Advanced Analysis

# Get function call hierarchy
get_function_call_graph(function_name="processData", depth=3)

# Analyze type dependencies
get_type_dependencies(type_name="User", include_dependents=true)

# Find cross-module function calls
find_cross_module_calls(source_module="Services", target_module="Database")

# Complex JSON query
execute_advanced_query({
  "type": "function",
  "conditions": [
    {"field": "name", "operator": "like", "value": "%Handler%"}
  ],
  "limit": 50
})

Architectural Analysis

# Module dependency analysis
get_module_dependencies(module_name="Core.Services", include_dependents=true)

# Import relationship graph
get_import_graph(root_module="Main", depth=3)

# Complexity analysis
analyze_function_complexity(module_name="BusinessLogic", min_complexity=5)

# Comprehensive statistics
get_code_statistics(include_details=true)

⚙️ Configuration

Environment Variables (.env)

# Database
DB_USER=postgres
DB_PASSWORD=postgres  
DB_HOST=localhost
DB_PORT=5432
DB_NAME=code_as_data

# FDEP Data Source
FDEP_PATH=/path/to/your/fdep/output

# Logging
LOG_LEVEL=INFO

Spider Plugin Integration

For Haskell projects using GHC 9.2.8:

  1. Add Spider flake input
  2. Configure cabal with fdep and fieldInspector plugins
  3. Run socket server during build
  4. Generate FDEP output for analysis

Tool Distribution

  • 📁 Module Analysis: 7 tools
  • Function Analysis: 8 tools
  • 🏗️ Type System: 6 tools
  • 📚 Class Analysis: 3 tools
  • 📦 Import Analysis: 4 tools
  • 🔍 Advanced Queries: 4 tools
  • 🎯 Pattern Analysis: 5 tools
  • 📍 Source Location: 3 tools
  • 🔬 Enhanced Analysis: 3 tools

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选