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 模式进行全面的输入验证
安装
- 克隆此存储库
- 安装依赖项:Copy
- 将
.env.example
复制到.env
并添加您的 Mistral API 密钥:Copy - 构建项目:Copy
用法
启动服务器:
配置
将您的 Mistral API 密钥添加到.env
文件:
可用工具
代码完成
用于完成、修复错误或生成测试的流程代码:
参数:
code
(字符串,必需):要处理的代码language
(字符串,可选):编程语言task
(字符串,必需):以下之一:"complete"
:代码完成"fix"
:错误修复"test"
:测试生成"fim"
:中间填空
API 详细信息
该服务器支持两种主要的 Mistral 型号:
codestral-latest
:代码相关任务的默认模型codestral-mamba-latest
:采用 Mamba 架构的替代模型
功能包括:
- 自动速率限制(请求间隔至少 100 毫秒)
- API 调用超时 30 秒
- API 响应的全面错误处理
- 使用 Zod 模式进行响应验证
- 从响应中自动提取代码块
- API 交互的调试日志记录
发展
以自动重新加载的方式在开发模式下运行:
运行测试:
错误处理
服务器实现了全面的错误处理:
- API 错误被正确捕获并格式化
- 实施速率限制
- 使用 Zod 模式进行输入验证
- 正确向客户端传播错误
- 常见问题的具体错误消息:
- 身份验证失败
- 超出速率限制
- 服务器错误
- 输入验证无效
资源访问
服务器通过file://code
资源 URI 提供对代码文件的访问,允许与工作区文件集成。
执照
麻省理工学院
This server cannot be installed
为多种编程语言提供代码完成、错误修复和测试生成,并与 Mistral Codestral API 集成以增强代码开发流程。