Token导航 LogoToken导航TokenDH.com
Cobol Indexer MCP Server logo
开发工具stdio官方级别未说明来源级核验

Cobol Indexer MCP Server

MCP Server

@cobol/mcp

一个提供COBOL函数提取能力的MCP服务器,支持索引和提取COBOL代码中的函数、段落和过程,适用于大型语言模型与COBOL代码库的交互。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
大型语言模型TypeScriptClaude代码索引Claude DesktopClaudeCursorWindsurfVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

digimangos-work-demo

提供方

digimangos-work-demo

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx @cobol/mcp [options]

详细介绍

COBOL MCP服务器

提供COBOL函数提取功能的模型上下文协议(MCP)服务器。此服务器使LLM能够通过从COBOL文件中索引和提取函数、节、段落和过程与COBOL代码库进行交互。

特性

  • 工作区索引:自动扫描工作区中的COBOL文件(.cob、.COBOL、.cbl)
  • 函数提取:解析和提取COBOL函数、部分、段落和过程
  • 智能搜索:按名称模式搜索函数,支持通配符和正则表达式
  • 代码检索:提取包含行号和上下文的完整函数代码
  • 多种方言:支持各种COBOL方言(COBOL-85、企业COBOL等)

需求

  • Node.js 18或更新版本
  • VS Code、Cursor、Windsurf、Claude Desktop、Goose或任何其他MCP客户端

安装

npm install @cobol/mcp

用法

作为MCP服务器

添加到MCP客户端配置中:

{
  "mcpServers": {
    "cobol": {
      "command": "npx",
      "args": ["@cobol/mcp"]
    }
  }
}

通过配置

{
  "mcpServers": {
    "cobol": {
      "command": "npx",
      "args": ["@cobol/mcp", "--config", "cobol-config.json"]
    }
  }
}

命令行选项

npx @cobol/mcp [options]

Options:
  --config 
    Path to configuration file
  --root 
      Root path to scan for COBOL files (default: current directory)
  --port     Port for HTTP transport (default: stdio)
  --debug            Enable debug logging
  --help, -h         Show help message

配置

创建一个 cobol-config.json 文件:

{
  "workspace": {
    "rootPaths": ["./src", "./legacy"],
    "includePatterns": ["**/*.cob", "**/*.cobol", "**/*.cbl"],
    "excludePatterns": ["**/backup/**", "**/temp/**"],
    "maxFileSize": 10485760
  },
  "parser": {
    "dialect": "cobol-85",
    "extractComments": true,
    "columnFormat": "fixed"
  },
  "functions": {
    "extractTypes": ["section", "paragraph", "procedure", "program"],
    "includeLineNumbers": true,
    "includeContext": true,
    "minimumLines": 1
  },
  "indexing": {
    "autoIndex": true,
    "maxFunctionsPerFile": 1000
  }
}

MCP工具

cobol_index_workspace

扫描工作区中的COBOL文件并构建函数索引。

参数:

  • rootPaths (可选):要扫描的根路径数组
  • includePatterns (可选):要包含的文件模式
  • excludePatterns (可选):要排除的文件模式

cobol_list_函数

列出所有带有可选筛选的索引COBOL函数。

参数:

  • type (可选):按函数类型(节、段、过程、程序)过滤
  • division (可选):按部门筛选(标识、环境、数据、程序)
  • filePath (可选):按文件路径筛选

cobol_get函数

按名称提取完整的功能代码。

参数:

  • name (必填):要提取的函数名称
  • includeLineNumbers (可选):在输出中包含行号
  • includeContext (可选):包括周围环境

cobol_search_函数

按名称模式或内容搜索功能。

参数:

  • pattern (必填):搜索模式(支持通配符或正则表达式)
  • regex (可选):将模式视为正则表达式
  • caseSensitive (可选):区分大小写的搜索
  • type (可选):按功能类型筛选

例子

基本用法

# Index current directory
npx @cobol/mcp --root .

# Index specific COBOL project
npx @cobol/mcp --root /path/to/cobol/project

使用MCP客户端

连接到MCP客户端后,您可以使用以下命令:

# Index the workspace
Use tool: cobol_index_workspace with rootPaths: ["/path/to/cobol/files"]

# List all functions
Use tool: cobol_list_functions

# Get specific function
Use tool: cobol_get_function with name: "CALCULATE-PAYROLL"

# Search functions
Use tool: cobol_search_functions with pattern: "*CALC*"

支持的COBOL构造

  • 程序:PROGRAM-ID声明
  • 章节:程序部分中的指定部分
  • 段落:程序部分中的指定段落
  • 程序:一般程序构造

文件格式

  • 固定格式(传统的72列COBOL)
  • 自由格式(现代COBOL)
  • 自动检测格式

日志记录和调试

COBOL MCP服务器包括全面的日志记录和调试功能。使用环境变量配置日志记录:

环境变量

  • COBOL_LOG_LEVEL:设置日志记录级别(错误、警告、信息、调试、跟踪)
  • COBOL_DEBUG=true:启用调试模式
  • COBOL_VERBOSE=true:启用详细上下文的详细模式
  • NO_COLOR=true:禁用彩色输出

例子

# Enable debug logging
COBOL_DEBUG=true echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"cobol_index_workspace","arguments":{"rootPaths":["./src"]}}}' | node cli.js

# Verbose logging with timing information
COBOL_VERBOSE=true echo '...' | node cli.js

# Only show errors
COBOL_LOG_LEVEL=error echo '...' | node cli.js

有关详细的日志记录文档,请参阅 docs/LOGGING.md.

依赖项

  • Node.js 18+
  • 模型上下文协议SDK

许可证

阿帕奇-2.0

贡献

欢迎投稿!请随时提交问题和拉取请求。

发展

# Clone the repository
git clone https://github.com/microsoft/cobol-mcp.git
cd cobol-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

目录标签

目录标签

大型语言模型TypeScriptClaude代码索引COBOL解析本地部署函数提取开发工具

支持客户端

Claude DesktopClaudeCursorWindsurfVS Code

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@cobol/mcp

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP