Mistral Codestral MCP Server

Mistral Codestral MCP Server

Provides code completion, bug fixing, and test generation for multiple programming languages, integrating with the Mistral Codestral API to enhance code development processes.

bsmi021

Developer Tools
Version Control
Visit Server

README

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

  1. Clone this repository

  2. Install dependencies:

    npm install
    
  3. Copy .env.example to .env and add your Mistral API key:

    cp .env.example .env
    
  4. Build the project:

    npm run build
    

Usage

Start the server:

npm start

Configuration

Add your Mistral API key to the .env file:

MISTRAL_API_KEY=your_api_key_here

Available Tools

code_completion

Process code for completion, bug fixing, or test generation:

Parameters:

  • code (string, required): The code to process
  • language (string, optional): Programming language
  • task (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 tasks
  • codestral-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:

npm run dev

Run tests:

npm test

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Gitingest-MCP

Gitingest-MCP

An MCP server for gitingest. It allows MCP clients like Claude Desktop, Cursor, Cline etc to quickly extract information about Github repositories including repository summaries, project directory structure, file contents, etc

Featured
Local
Python
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript