Skip to main content
Glama
PureScript MCP Server

PureScript MCP Server

by avi892nash

PureScript MCP Tools

npm version License: MIT

A Model Context Protocol (MCP) server that provides PureScript development tools for AI assistants like Claude.

Features

  • Code Analysis: Parse and analyze PureScript code structure without heavy IDE setup

  • PureScript IDE Integration: Start and manage PureScript IDE servers

  • Type Information: Look up types and find code usages

  • Dependency Graphs: Generate visual representations of module dependencies

  • AI-First: Built specifically for AI assistants using the Model Context Protocol

Related MCP server: TypeScript Definition Finder

Installation

npm install -g purescript-mcp-tools

From Source

# Clone this repository
git clone https://github.com/avi892nash/purescript-mcp-tools.git
cd purescript-mcp-tools

# Install dependencies
npm install

# Test that it works
npm test

Configuration

For Claude Desktop

  1. Find your Claude config file:

    • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%/Claude/claude_desktop_config.json

  2. Add this server configuration:

If installed via npm:

{
  "mcpServers": {
    "purescript-tools": {
      "command": "npx",
      "args": ["purescript-mcp-tools"]
    }
  }
}

If installed from source:

{
  "mcpServers": {
    "purescript-tools": {
      "command": "node",
      "args": ["/FULL/PATH/TO/purescript-mcp-tools/index.js"]
    }
  }
}
  1. Restart Claude Desktop.

For Other MCP Clients

Configure as a stdio MCP server:

  • Command: npx (or node if from source)

  • Arguments: ["purescript-mcp-tools"] (or ["/full/path/to/index.js"] if from source)

  • Protocol: stdio

Usage

Verify Installation

In your MCP client, try running:

get_server_status

You should see a response showing the server is running.

Available Tools

This MCP server provides the following tools:

Static Analysis (No IDE Required)

  • getModuleName - Extract module name from PureScript file

  • getImports - List all imports from a module

  • getAllFunctionNames - Get all function definitions

  • getExports - List exported values

  • getFunctionSignature - Get type signature for a function

  • getDependencyGraph - Generate module dependency graph

PureScript IDE Integration

  • start_purs_ide_server - Start a PureScript IDE server

  • stop_purs_ide_server - Stop the IDE server

  • pursIdeLoad - Load modules into IDE

  • pursIdeType - Get type information

  • pursIdeComplete - Get completion suggestions

  • pursIdeUsages - Find where a symbol is used

  • pursIdeCaseSplit - Generate case splits

  • pursIdeAddClause - Add function clause

  • pursIdeImport - Add imports

Basic Workflow

  1. Check status: get_server_status

  2. For simple analysis: Use static analysis tools directly

  3. For advanced features:

    • start_purs_ide_server with your project path

    • pursIdeLoad to load modules

    • Use pursIdeType, pursIdeUsages, etc.

Requirements

  • Node.js >= 14.0.0

  • PureScript compiler (purs) - Required only if using IDE features

  • Your PureScript project - With compiled output for IDE features

Troubleshooting

Server won't start: Check that Node.js is installed and dependencies are installed (npm install)

Tools not working: Run get_server_status to see what's available

Path errors: Ensure you use absolute paths in your MCP configuration

Multiple servers: Only run one PureScript IDE server at a time to avoid port conflicts

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Acknowledgments

This server implements the Model Context Protocol and provides comprehensive PureScript development assistance to AI tools.

Available Tools

19 tools
echoA

Simple test tool that echoes back your input. Use to verify the MCP server is responding correctly.

Inputs: message (required).

generate_dependency_graphA

Create a dependency graph showing which functions/types use which others in PureScript modules. PREREQUISITES: IDE server must be running and modules must be loaded. Useful for understanding code relationships and refactoring impact.

Inputs: target_modules (required), max_concurrent_requests.

getFunctionNamesA

Extract only function names from PureScript code snippets. Focuses specifically on functions, ignoring data types and classes. Quick analysis for code understanding.

Inputs: code (required).

getImportsA

Find all import statements in PureScript code (like 'import Data.List', 'import Prelude'). Shows what external modules the code depends on. Works without the IDE server.

Inputs: code, filePath.

getModuleNameA

Extract the module name (like 'Data.List' or 'Main') from PureScript code. Works on files or code snippets without needing the IDE server. Useful for understanding code structure.

Inputs: code, filePath.

get_server_statusA

Check if IDE server processes are running to avoid resource conflicts. Shows status of Tree-sitter parser (lightweight code analysis) and purs IDE server (process for type checking). ALWAYS use this before starting new IDE servers to prevent running multiple processes simultaneously.

Inputs: no named parameters.

getTopLevelDeclarationNamesA

List all main definitions in PureScript code: function names, data types, type classes, etc. Gets just the names (like 'myFunction', 'MyDataType'). Fast analysis without needing IDE server.

Inputs: code, filePath.

getTopLevelDeclarationsA

Get detailed information about all main definitions in PureScript code: names, types (function/data/class), and full source code. Includes filtering options to find specific items. More comprehensive than getTopLevelDeclarationNames.

Inputs: code, filePath, filters.

getWhereBindingsB

Find 'where' clauses in PureScript functions. These contain local helper functions and variables. Useful for understanding function implementation details.

Inputs: code (required).

pursIdeCwdA

Get the current working directory that the IDE server is using. PREREQUISITE: IDE server must be running. Useful for understanding the project context.

Inputs: no named parameters.

pursIdeListB

List available modules in the project or imports in a specific file. PREREQUISITES: IDE server running and modules loaded. Helps understand project structure and dependencies.

Inputs: listType (required), file.

pursIdeLoadA

Load PureScript modules into the IDE server for type checking and completions. PREREQUISITE: IDE server must be running. ALWAYS run this first after starting the IDE server before using other pursIde* tools.

Inputs: modules.

pursIdeQuitA

Gracefully shut down the IDE server and free up resources. PREREQUISITE: IDE server must be running. Same effect as stop_purs_ide_server but uses the server's built-in quit command first.

Inputs: no named parameters.

pursIdeRebuildA

Quickly recompile a single PureScript module and check for errors. PREREQUISITES: IDE server running and modules loaded. Much faster than full project rebuild. Use when editing code to get immediate feedback.

Inputs: file (required), actualFile, codegen.

pursIdeResetA

Clear all loaded modules from the IDE server's memory. PREREQUISITE: IDE server must be running. Use when switching projects or after major code changes. You'll need to run pursIdeLoad again after this.

Inputs: no named parameters.

pursIdeTypeA

Look up the type signature of functions, variables, or values in PureScript code. PREREQUISITES: IDE server running and modules loaded. Helpful for understanding what a function expects and returns.

Inputs: search (required), currentModule, filters.

pursIdeUsagesA

Find everywhere a specific function, type, or value is used across the project. PREREQUISITES: IDE server running and modules loaded. Essential for refactoring - shows impact of changes. If you plan to refactor, get usages before refactoring so you can make changes to all places that function is used.

Inputs: identifier (required), module (required), namespace (required).

start_purs_ide_serverA

Start the PureScript IDE server for type checking, auto-completion, and error detection. Automatically stops any existing server to prevent conflicts. Only run one at a time. Required for all pursIde* tools to work. Automatically selects a random available port to avoid conflicts - the port number is returned in the response. Only accepts absolute paths.

Inputs: project_path (required), log_level, output_directory, source_globs.

stop_purs_ide_serverA

Stop the PureScript IDE server to free up system resources. Use when you're done with type checking or want to switch projects. All pursIde* tools will stop working after this.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between getTopLevelDeclarationNames and getTopLevelDeclarations, where the latter is a more detailed version of the former, which could cause confusion. Other tools like getFunctionNames and getTopLevelDeclarationNames also have overlapping scopes, but descriptions help clarify differences.

    Naming Consistency2/5

    Naming is inconsistent with mixed conventions: snake_case (e.g., get_server_status, start_purs_ide_server), camelCase (e.g., getFunctionNames, pursIdeCwd), and verb_noun patterns vary (e.g., generate_dependency_graph vs. pursIdeList). This lack of a predictable pattern makes the tool set harder to navigate.

    Tool Count3/5

    With 19 tools, the count is borderline high for a PureScript server, leaning towards heavy but not extreme. It covers both IDE server management and code analysis, which justifies some bulk, but it could be streamlined for better coherence.

    Completeness5/5

    The tool set provides comprehensive coverage for PureScript development, including IDE server lifecycle management (start, stop, status), code analysis (dependencies, imports, types, usages), and module operations (load, rebuild, reset). No obvious gaps exist for the stated domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A TypeScript implementation of a Model Context Protocol server that provides a frictionless framework for developers to build and deploy AI tools and prompts, focusing on developer experience with zero boilerplate and automatic tool registration.
      2,105 npm
      14
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that helps AI code editors locate TypeScript symbol definitions in codebases, particularly useful for finding original definitions of imported symbols and classes.
      1
      13 npm
      -
    • A
      license
      B
      quality
      D
      maintenance
      A TypeScript-based Model Context Protocol server that enables AI assistants to perform secure database operations on PostgreSQL databases through structured tool interfaces.
      8
      22 npm
      MIT