文件上下文服务器

文件上下文服务器

为大型语言模型提供文件系统上下文的MCP服务器,支持文件读取、搜索和分析。

安装

使用以下命令安装: npm install @modelcontextprotocol/file-context-server

启动服务器

运行以下命令启动: npm run dev

使用工具

  1. list_context_files:列出目录中的文件。 参数示例:{"path": "./src", "recursive": true}
  2. read_context:读取文件或目录内容。 参数示例:{"path": "./src/index.ts"}
  3. search_context:按模式搜索文件。 参数示例:{"pattern": "function.*", "path": "./src"}
  4. analyze_code:分析代码质量。 参数示例:{"path": "./src", "metrics": ["complexity"]}
  5. cache_stats:获取缓存统计信息。 参数示例:{"detailed": true}