Mistral Codestral MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Loads environment variables from a .env file to configure the application, particularly for storing the Mistral API key.

  • Used for package management, installation of dependencies, and running scripts for building and starting the MCP server.

  • Implements comprehensive input validation using Zod schemas to ensure data integrity and provide proper error handling for API requests.

Mistral Codestral MCP 服务器

Mistral Codestral API 的 MCP 服务器实现,提供代码完成、错误修复和测试生成功能。

特征

  • 使用 Mistral 的 Codestral 模型完成代码
  • 错误检测和修复
  • 自动测试生成
  • 支持多种编程语言
  • 速率限制和错误处理
  • 代码文件的资源访问
  • 中间填充 (FIM) 补全支持
  • 使用 Zod 模式进行全面的输入验证

安装

  1. 克隆此存储库
  2. 安装依赖项:
    npm install
  3. .env.example复制到.env并添加您的 Mistral API 密钥:
    cp .env.example .env
  4. 构建项目:
    npm run build

用法

启动服务器:

npm start

配置

将您的 Mistral API 密钥添加到.env文件:

MISTRAL_API_KEY=your_api_key_here

可用工具

代码完成

用于完成、修复错误或生成测试的流程代码:

参数:

  • code (字符串,必需):要处理的代码
  • language (字符串,可选):编程语言
  • task (字符串,必需):以下之一:
    • "complete" :代码完成
    • "fix" :错误修复
    • "test" :测试生成
    • "fim" :中间填空

API 详细信息

该服务器支持两种主要的 Mistral 型号:

  • codestral-latest :代码相关任务的默认模型
  • codestral-mamba-latest :采用 Mamba 架构的替代模型

功能包括:

  • 自动速率限制(请求间隔至少 100 毫秒)
  • API 调用超时 30 秒
  • API 响应的全面错误处理
  • 使用 Zod 模式进行响应验证
  • 从响应中自动提取代码块
  • API 交互的调试日志记录

发展

以自动重新加载的方式在开发模式下运行:

npm run dev

运行测试:

npm test

错误处理

服务器实现了全面的错误处理:

  • API 错误被正确捕获并格式化
  • 实施速率限制
  • 使用 Zod 模式进行输入验证
  • 正确向客户端传播错误
  • 常见问题的具体错误消息:
    • 身份验证失败
    • 超出速率限制
    • 服务器错误
    • 输入验证无效

资源访问

服务器通过file://code资源 URI 提供对代码文件的访问,允许与工作区文件集成。

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

为多种编程语言提供代码完成、错误修复和测试生成,并与 Mistral Codestral API 集成以增强代码开发流程。

  1. Features
    1. Installation
      1. Usage
        1. Configuration
        2. Available Tools
        3. API Details
      2. Development
        1. Error Handling
          1. Resource Access
            1. License
              ID: p0l4p3h2s2