Skip to main content
Glama
FDEP MCP Server

FDEP MCP Server

by juspay

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

Related MCP server: OrgBrain MCP Server

πŸš€ 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

Available Tools

42 tools
analyze_cross_module_dependenciesC

Comprehensive analysis of cross-module dependencies and coupling

Inputs: analysis_type, module_pattern, include_metrics, threshold, +1 more.

analyze_function_complexityC

Analyze function complexity metrics including call count and signature complexity

Inputs: module_name, min_complexity, limit.

analyze_importsC

Analyze import patterns and dependencies for modules

Inputs: module_name, import_pattern, include_qualified, limit.

analyze_type_relationshipsC

Analyze deep type relationships and dependencies

Inputs: type_name (required), source_module (required), analysis_depth, include_dependents, +1 more.

analyze_type_usageC

Analyze how types are used throughout the codebase

Inputs: type_name, module_name, usage_threshold, limit.

build_type_dependency_graphC

Build a comprehensive type dependency graph showing relationships between types

Inputs: root_type, module_pattern, include_external, max_depth.

enhanced_function_call_graphC

Generate enhanced function call graphs with advanced options

Inputs: function_name (required), module_name, max_depth, graph_format, +2 more.

execute_advanced_queryC

Execute complex JSON-based queries with joins and advanced conditions

Inputs: query (required).

execute_custom_queryC

Execute custom SQL queries on the code database with parameters

Inputs: query (required), parameters, limit.

execute_queryC

Execute a basic SQL query on the code database

Inputs: query_type (required), filters.

find_code_patternsC

Find recurring code patterns across functions

Inputs: pattern_code (required), min_matches, module_pattern, limit.

find_cross_module_callsC

Find function calls that cross module boundaries

Inputs: source_module, target_module, limit.

find_element_by_locationC

Find code elements (functions, types, classes, imports) by source location

Inputs: file_path (required), line_number (required), base_directory, element_types.

find_similar_functionsC

Find functions similar to a given function based on signature and code

Inputs: function_name (required), module_name, similarity_threshold, limit.

find_unused_importsC

Find potentially unused imports in modules

Inputs: module_name, package_pattern, limit.

generate_function_importsB

Generate all necessary import statements for a function or code element

Inputs: element_name (required), source_module (required), element_type, import_style.

get_class_detailsB

Get detailed information about a specific class including methods and instances

Inputs: class_name (required), module_name, include_instances.

get_code_statisticsC

Get comprehensive statistics about the codebase

Inputs: include_details.

get_function_calleesC

Get all functions called by a specific function

Inputs: function_name (required), module_name, limit.

get_function_callersB

Get all functions that call a specific function

Inputs: function_name (required), module_name, limit.

get_function_call_graphB

Get function call hierarchy showing what functions this function calls and what calls it

Inputs: function_name (required), module_name, depth, include_callers, +1 more.

get_function_contextC

Get complete context for a function including all used types and functions

Inputs: function_name (required), module_name, include_prompts, include_local_definitions, +1 more.

get_function_detailsB

Get detailed information about a specific function

Inputs: function_name (required), module_name.

get_functions_by_moduleB

Get all functions defined in a specific module

Inputs: module_name (required), limit, include_signatures.

get_import_detailsC

Get detailed information about imports in a module

Inputs: module_name (required), include_source_info.

get_import_graphC

Generate module import relationship graph

Inputs: root_module, depth, include_external, limit.

get_location_contextC

Get comprehensive context around a source location

Inputs: file_path (required), line_number (required), context_radius, include_dependencies.

get_module_dependenciesC

Analyze module dependencies and imports

Inputs: module_name (required), include_imports, include_dependents.

get_module_detailsC

Get detailed information about a specific module including function counts and statistics

Inputs: module_name (required).

get_most_called_functionsC

Get the most frequently called functions

Inputs: limit.

get_nested_typesC

Get all nested type definitions for specified types

Inputs: type_names (required), gateway_name (required), exclude_pattern, include_raw_definitions.

get_type_dependenciesC

Analyze type dependencies and relationships

Inputs: type_name (required), module_name, include_dependents, depth.

get_type_detailsC

Get detailed information about a specific type including constructors and fields

Inputs: type_name (required), module_name, include_constructors, include_fields.

group_similar_functionsC

Group functions by similarity to identify common patterns

Inputs: similarity_threshold, module_pattern, min_group_size, limit.

list_classesB

Get class definitions with filtering by module or pattern

Inputs: module_name, pattern, limit.

list_modulesC

Get list of all modules in the database

Inputs: limit.

list_typesC

Get types by module or pattern with support for different type categories

Inputs: module_name, pattern, type_category, limit.

pattern_match_codeC

Advanced pattern matching to find code structures

Inputs: pattern_type (required), pattern_config (required), limit.

search_classesC

Search for classes by name pattern with module filtering

Inputs: pattern (required), module_pattern, limit.

search_functionsB

Search for functions by name pattern

Inputs: pattern (required), limit.

search_modulesC

Search for modules by name pattern

Inputs: pattern (required), limit.

search_typesC

Search for types by name pattern with advanced filtering

Inputs: pattern (required), module_pattern, type_category, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 42 tools

    Disambiguation3/5

    The tools cover distinct aspects of code analysis, but there is significant overlap in purpose that could cause confusion. For example, 'analyze_imports', 'get_import_details', and 'get_module_dependencies' all deal with imports, while 'analyze_type_relationships', 'analyze_type_usage', 'get_type_dependencies', and 'build_type_dependency_graph' focus on type analysis. Descriptions help differentiate them, but agents might struggle to choose the optimal tool for a given task due to these overlaps.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun naming pattern (e.g., 'analyze_cross_module_dependencies', 'get_function_details'), which aids readability. However, there are minor deviations such as 'enhanced_function_call_graph' (adjective-based) and 'pattern_match_code' (verb_noun order reversed), slightly disrupting the overall consistency. The naming is largely predictable but not perfectly uniform.

    Tool Count2/5

    With 42 tools, the count is excessive for a code analysis server, making it heavy and potentially overwhelming for agents. While the domain is broad, many tools could be consolidated (e.g., multiple import-related tools) without losing functionality. This large number suggests poor scoping and may lead to inefficiency in tool selection and usage.

    Completeness5/5

    The tool set provides comprehensive coverage for code analysis, including dependency tracking, complexity metrics, query execution, and search capabilities across modules, functions, classes, and types. It supports CRUD-like operations for code elements (e.g., get, list, search, analyze) and handles advanced scenarios like pattern matching and graph generation, leaving no obvious gaps for the stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Analyzes codebases to generate dependency graphs and architectural insights across multiple programming languages, helping developers understand code structure and validate against architectural rules.
      6
      53 npm
      20
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides knowledge extraction and cross-repo analysis tools for multi-repository organizations. It enables users to query type definitions, service dependencies, and infrastructure configurations across an entire organization's codebase.
      MIT