Fortran Companion MCP Server

Fortran Companion MCP Server

Enables AI models to write, format, compile, lint, and structure modern Fortran code using best practices and industry design patterns.

Category
Visit Server

README

Fortran Companion MCP Server

A Model Context Protocol (MCP) server designed to enable AI models to write, format, compile, lint, and structure modern Fortran code (F2003/F2018/F2023) using best practices and industry design patterns.

🌟 Why This Project?

AI models are trained on large volumes of legacy Fortran code (e.g., Fortran 66, 77, 90). When generating Fortran today, they regularly produce "AI Slop":

  • Implicit variable typing (omitting implicit none).
  • Non-standard vendor-specific types (like real*8 or integer*4 instead of standard kind parameters).
  • Obsolescent control structures (numbered loops like do 10 i = 1, N and goto statements).
  • Global state blocks (common and equivalence) which violate modern scoping rules.
  • Lack of explicit interfaces (omitting module containers and dummy argument intent attributes).

This MCP server equips AI agents (in Cursor, Claude Desktop, or Antigravity CLI) with tools to statically check, auto-format, compile, and structure Fortran code. This creates a self-correcting feedback loop where the AI compiles and lints its own work, ensuring only high-quality, modern Fortran is delivered.


šŸ› ļø Features

  • Legacy Linter: Scans code for obsolete type notations, missing intents, missing implicit none units, fixed-format layouts, and deprecated statements.
  • Auto-Formatter: Connects directly to fprettify to cleanly indent and format Fortran code.
  • Strict Compiler Verification: Triggers compilation checks using gfortran or fpm with strict diagnostic flags (-Wall -Wextra -Wimplicit-interface -fcheck=all -std=f2018).
  • Boilerplate Initializer: Sets up standard modular layouts (supporting both fpm or standard Makefiles) with modern syntax, intents, and testing templates.
  • Design Patterns Database: Serves architectural blueprints and code templates for:
    • OOP: Classes, inheritance, polymorphism, and deferred bindings.
    • Generics: Function/operator overloading using generic interfaces.
    • RAII: Automated resource cleanups using allocatable.
    • Callbacks: Strategy pattern using abstract interfaces and procedure pointers.
    • C-Interop: Interfacing standard C and Python bindings using iso_c_binding.

šŸ“‚ Project Structure

fortran-mcp/
ā”œā”€ā”€ pyproject.toml              # Python project configuration & dependencies
ā”œā”€ā”€ README.md                   # Project overview & documentation
ā”œā”€ā”€ session_handoff.md          # Context handoff for AI agents
ā”œā”€ā”€ src/
│   └── fortran_mcp/
│       ā”œā”€ā”€ __init__.py
│       ā”œā”€ā”€ linter.py           # Custom Fortran Linter engine
│       └── server.py           # FastMCP tools definitions and entrypoint
ā”œā”€ā”€ test/                       # Demonstration and verification test suite
│   ā”œā”€ā”€ unformatted_legacy.f90  # Non-compliant Fortran demonstration file
│   ā”œā”€ā”€ modern_compliant.f90    # Formatted, best-practice compliant Fortran file
│   ā”œā”€ā”€ illustrate_mcp_tools.py # Python script orchestrating the MCP tool calls
│   └── README.md               # Test runner documentation
└── dist/                       # Packaged python distributions (tar/wheel)

āš™ļø Setup & Connection

This server uses the standard Python MCP SDK (fastmcp) and requires Python 3.14+ (or 3.10+ compatible environments) with uv or pip.

1. Add to Antigravity CLI

Add the server configuration to your local Antigravity config file at ~/.gemini/antigravity-cli/mcp_config.json:

{
  "mcpServers": {
    "fortran-companion": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/fortran-mcp",
        "run",
        "fortran-mcp"
      ]
    }
  }
}

2. Add to Claude Desktop

To use this with Claude Desktop, insert the block below into your claude_desktop_config.json (typically under ~/Library/Application Support/Claude/ on macOS or %APPDATA%/Claude/ on Windows):

{
  "mcpServers": {
    "fortran-companion": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/fortran-mcp",
        "run",
        "fortran-mcp"
      ]
    }
  }
}

šŸš€ How to Test

Start a new conversation session with any MCP-capable host (like Claude or Antigravity) in this workspace. Try prompts like:

"Design a modules-based modern Fortran project that integrates a user-defined function using midpoint integration. Make sure you use modern intents, explicit kinds, and test it."

The agent will use the MCP tools to bootstrap the structure, write, lint, format, and compile the code successfully, correcting its errors on the fly.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured