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 Server
An MCP server implementation for the Mistral Codestral API, providing code completion, bug fixing, and test generation capabilities.
Features
- Code completion with Mistral's Codestral model
- Bug detection and fixing
- Automated test generation
- Support for multiple programming languages
- Rate limiting and error handling
- Resource access for code files
- Fill-in-the-Middle (FIM) completion support
- Comprehensive input validation using Zod schemas
Installation
- Clone this repository
- Install dependencies:Copy
- Copy
.env.example
to.env
and add your Mistral API key:Copy - Build the project:Copy
Usage
Start the server:
Configuration
Add your Mistral API key to the .env
file:
Available Tools
code_completion
Process code for completion, bug fixing, or test generation:
Parameters:
code
(string, required): The code to processlanguage
(string, optional): Programming languagetask
(string, required): One of:"complete"
: Code completion"fix"
: Bug fixing"test"
: Test generation"fim"
: Fill-in-the-Middle completion
API Details
The server supports two main Mistral models:
codestral-latest
: Default model for code-related taskscodestral-mamba-latest
: Alternative model with Mamba architecture
Features include:
- Automatic rate limiting (100ms minimum between requests)
- 30-second timeout for API calls
- Comprehensive error handling for API responses
- Response validation using Zod schemas
- Automatic extraction of code blocks from responses
- Debug logging for API interactions
Development
Run in development mode with auto-reloading:
Run tests:
Error Handling
The server implements comprehensive error handling:
- API errors are properly caught and formatted
- Rate limiting is implemented
- Input validation using Zod schemas
- Proper error propagation to clients
- Specific error messages for common issues:
- Authentication failures
- Rate limit exceeded
- Server errors
- Invalid input validation
Resource Access
The server provides access to code files through the file://code
resource URI, allowing integration with workspace files.
License
MIT
This server cannot be installed
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.
Provides code completion, bug fixing, and test generation for multiple programming languages, integrating with the Mistral Codestral API to enhance code development processes.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityProvides tools for collecting and documenting code from directories.Last updated -48112TypeScriptMIT License
- AsecurityAlicenseAqualityEnables intelligent code analysis and debugging through the Perplexity AI's API, offering detailed error analysis, pattern detection, and comprehensive solutions, with integration support for the Claude desktop client.Last updated -110JavaScriptMIT License
- AsecurityAlicenseAqualityAnalyzes source code dependencies across multiple programming languages in the specified directory to identify file relationships, assisting in dependency management and project structure understanding.Last updated -1PythonMIT License
- -securityFlicense-qualityProvides code generation and completion capabilities using the DeepSeek API, with support for tool chaining and cost optimization.Last updated -3JavaScript