Skip to main content
Glama
tugraskan

swatplus-mcp

by tugraskan

Tamandua

让您已经在使用的编码助手 —— Claude Code、Copilot、Codex、本地模型 —— 在 SWAT+ 上更便宜、更准确。

它不是助手。它仅通过静态分析构建 SWAT+ Fortran 源码的纯事实索引,并将其作为 MCP 工具以及您检出目录中的一个文件提供。过程及其位置、调用图、带单元号的文件 I/O、按字段路径的变量写入、带索引变量的循环头、派生类型及其源码内联说明的单位和含义。其中没有任何内容是由模型编写的。

为什么要费这个劲:当被要求列出 hru_control 中的循环时,一个基于原始源码工作的助手读完了全部 890 行,却产出了一份整洁的 18 项表格——而实际有 21 项。答案中没有任何迹象表明它不完整。在这里,穷尽性问题在构造上就是穷尽的,每一行都带有其文件和行号。

使用

如果你只想要这些工具 —— 无需 SWAT+ 检出或解析器:

pip install "git+https://github.com/tugraskan/Tamandua.git@v0.1.1"

带标签的软件包包含固定版本的 SWAT+ 事实快照。未来的 PyPI 发行名称是 swatplus-tamanduatamandua 已被一个无关项目占用)。将你的助手指向该服务器,无需任何机器特定路径:

// .mcp.json (Claude Code) — VS Code uses .vscode/mcp.json, where these
// entries nest inside a top-level "servers" object instead.
{
  "mcpServers": {
    "swatplus-source": {
      "command": "swatplus-mcp",
      "args": ["--compact"]
    }
  }
}

如果你有 SWAT+ 检出和解析器,直接将服务器指向源码:

swatplus-mcp --source /path/to/swatplus --compact

运行中的进程会在每次请求前对工作 Fortran 目录树计算指纹。它只会在编辑后重新解析,因此下一条答案会紧跟源码,无需手动重建或重启服务器。

要为他人生成可移植的事实文件:

cd <your swatplus checkout> && swatplus-build

这会写入 swatplus-facts.json,仅此而已。以 --facts 启动的服务器会在该文件被替换时察觉,并在不重启的情况下重新加载最新的完整快照。随软件包捆绑的发布快照按设计保持静态。

如果你的工具无法运行 MCP 服务器swatplus-build --markdown 还会渲染 SWATPLUS_INDEX.md,并让每个助手指令文件(CLAUDE.mdAGENTS.md.github/copilot-instructions.md)指向它,以便改用 grep 检索。这是后备方案,不是默认方案。

该检查对工作树(而不是最后一次提交)计算哈希——提问所涉及的是正在编辑的代码,而正是在这种时候,基于提交的检查会把过时索引当作最新状态。

Related MCP server: fw-context-mcp

与 dataselector 搭配

swatplus-dataselector 提供另一半:输入文件中某一列的含义,以及真实 TxtInOut 数据集中的内容。两者并不重叠——这个知道 Fortran 做什么,那个知道文件里有什么。同时运行两者,并告诉你的助手哪个对应哪个。

布局

tamandua/
├── index/             # build the facts, render, install pointers, snapshot
│   ├── build.py       #   static analysis -> SourceIndex
│   ├── snapshot.py    #   read/write swatplus-facts.json, so serving needs no parser
│   ├── render.py      #   SOURCE_INDEX.md
│   ├── install.py     #   assistant instruction-file pointers
│   └── scope.py       #   loop nesting, for conditional breakpoints
├── mcp/server.py      # 14 read-only tools over the same objects
├── mcp/client.py      # generic MCP stdio client (talk to another server)
├── output/reader.py   # query a run's output files
└── config.py          # loads docs/pins.toml

开发

export SWATPLUS_SOURCE=/path/to/swatplus
export SWATPLUS_REFERENCE_CORPUS=/path/to/swatplus-reference-corpus  # the parser
python -m pip install -e ".[dev]"
pytest                       # 151 pass, 9 skipped (128/32 without the parser)

解析器只是构建时依赖:捆绑的事实文件让已安装的服务器既不需要解析器也不需要 SWAT+ 源码即可运行(参见 D-8)。传入 --facts 以使用另一个快照,或传入 --source 从检出目录实时构建。

# build the publishable artifacts
swatplus-build --facts dist/swatplus-facts.json --out dist/SWATPLUS_INDEX.md

# serve them with nothing else installed
swatplus-mcp --facts dist/swatplus-facts.json

打上 v*.*.* 标签会触发运行 .github/workflows/release.yml,该工作流会根据锁定的提交构建两者,删除检出目录,验证快照仍然能够回答,然后发布它。

原则

仅事实——如果是模型编写的,它就不会进入索引。每一条声明都带有其文件和行号。先测量,再下结论;发现记录在 docs/*_experiment.md 中,并附有生成它们的脚本。这项工作中的八个缺陷都是由日常使用发现的,没有一个是由任何测试工具发现的,因此宁可实际运行它,也不要仅靠推理。

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
2Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A local, SQLite-backed code index for Claude Code, exposed over MCP, enabling targeted code retrieval without external APIs.
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Exposes tools for AI assistants to query a persistent SQLite+FTS5 index of C/C++ symbols parsed from real build commands, enabling sub-millisecond lookup, full-text search, and natural-language explanation without hallucination.
    38
    7
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Local-first, read-only MCP server for Claude Code that indexes and searches full-stack projects (FastAPI + React + PostgreSQL) with SQLite-backed FTS, cross-reference graph, and file-watcher auto-reload.
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Semantic code index and gatekeeper that exposes 14 read-only MCP tools for AI agents, enabling symbol search, definition lookup, reference finding, and impact analysis via static analysis of codebases.
    14
    MIT

View all related MCP servers

Related MCP Connectors

  • Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.

  • Read-only MCP connector serving the Run It on AI book; index and Implementation Blocks are free.

  • Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tugraskan/Tamandua'

If you have feedback or need assistance with the MCP directory API, please join our Discord server