Projet MCP Server-Client
About
An implementation of the Model Context Protocol (MCP) for communication between AI models and external tools, featuring server and client examples in Python and Spring Boot.
Details
- Author
- thekingyouneed
- Categories
- Developer Tools, AI, API
Jump to
Setup
Install Projet MCP Server-Client in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/thekingyouneed/mcp-server-client-spring-ai-main
Follow the installation instructions in the repository README, then restart your MCP client.
Ce projet est une implémentation du protocole MCP (Model Context Protocol) qui permet la communication entre des modèles d'IA et des outils externes. L'application est composée de trois composants principaux:
- Serveur MCP Python- Un serveur MCP léger écrit en Python utilisant la bibliothèque FastMCP
- Serveur MCP Spring Boot- Un serveur MCP basé sur Spring Boot utilisant le protocole SSE (Server-Sent Events)
- Client MCP Spring Boot- Un client qui se connecte aux serveurs MCP et utilise l'API Anthropic Claude pour les fonctionnalités d'IA
mcp-server-client-spring-ai-main/ │ ├── python-mcp-server/ # Serveur MCP Python │ ├── server.py # Point d'entrée du serveur MCP Python │ └── main.py # Fichier Python principal │ ├── sse-mcp-server/ # Serveur MCP Spring Boot │ ├── pom.xml # Configuration Maven │ └── src/ # Code source Java │ ├── mcp-client/ # Client MCP Spring Boot │ ├── pom.xml # Configuration Maven │ ├── src/ # Code source Java │ └── resources/ # Fichiers de configuration │ ├── application.properties # Configuration principale │ ├── application-secrets.properties # Clés API (non versionnées) │ └── mcp-servers.json # Configuration des serveurs MCP │ └── run-all.bat # Script pour démarrer tous les composants
- Java 21 ou supérieur
- Python 3.10 ou supérieur
- Maven (inclus via les wrappers mvnw)
- Clé API Anthropic Claude
cd python-mcp-server pip install fastmcp
- Configuration de la clé API Anthropic (OBLIGATOIRE)
L'application nécessite une clé API Anthropic Claude valide pour fonctionner. Sans cette clé, vous recevrez une erreur d'authentification (HTTP 401 - invalid x-api-key).
a) Créez un fichierapplication-secrets.propertiesdans le dossiermcp-client/src/main/resources/basé sur le modèle fourni:
# Clé API Anthropic spring.ai.anthropic.api-key=sk-ant-api03-VOTRE_CLÉ_API_ICI
b) Alternativement, vous pouvez définir une variable d'environnement système nomméeCLAUDE_API_KEYavec votre clé API comme valeur.
IMPORTANT: Ne partagez jamais votre clé API et ne la publiez pas sur GitHub ou tout autre dépôt public. Le fichierapplication-secrets.propertiesest automatiquement ignoré par Git pour protéger votre clé.
- Assurez-vous que vous avez bien configuré votre clé API Anthropic (voir section précédente)
- Vérifiez que Python est installé et que la bibliothèque FastMCP est disponible
- Si vous utilisez le serveur filesystem, vérifiez que Node.js est installé et accessible
Méthode 1: Démarrage automatisé (recommandée)
Utilisez le script batch qui lance tous les composants dans l'ordre correct avec les délais appropriés:
- Démarre d'abord le serveur MCP Python dans une fenêtre séparée
- Attend 3 secondes pour l'initialisation
- Démarre le serveur MCP Spring Boot dans une deuxième fenêtre
- Attend 5 secondes pour l'initialisation
- Lance le client MCP dans la fenêtre actuelle
Méthode 2: Démarrage manuel des composants
Si vous préférez un contrôle plus précis, vous pouvez démarrer chaque composant manuellementdans cet ordre:
cd sse-mcp-server ./mvnw spring-boot:run # Sous Windows: mvnw.cmd spring-boot:run
cd mcp-client ./mvnw spring-boot:run # Sous Windows: mvnw.cmd spring-boot:run
Une fois démarrée, l'application client est accessible à:
- URL:http://localhost:8080
- Le serveur Python MCP s'exécute sur le port 8878
- Le serveur Spring Boot MCP s'exécute sur le port 8877
Le système utilise le protocole MCP (Model Context Protocol) pour permettre la communication entre différents composants:
- LeServeur MCP Pythonfournit des outils simples comme la récupération d'informations sur les employés
- LeServeur MCP Spring Bootfournit des services supplémentaires via Spring Boot
- LeClient MCPse connecte à ces serveurs pour accéder à leurs outils et les expose à travers une interface web
Le fichierapplication.propertiescontient la configuration principale:
# Configuration du client MCP spring.ai.mcp.client.type=sync spring.ai.mcp.client.connection-timeout=60000 spring.ai.mcp.client.read-timeout=60000 spring.ai.mcp.client.sse.connections.server1.url=http://localhost:8877
Le fichiermcp-servers.jsondéfinit les serveurs MCP disponibles:
{ "mcpServers": { "filesystem": { "command": "C:/Program Files/nodejs/npx.cmd", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "chemin/vers/dossier" ] }, "Python-MCP-Server": { "command": "python", "args": [ "chemin/vers/server.py" ] } } }
Les clés API sensibles sont stockées dans un fichierapplication-secrets.propertiesqui est exclu du contrôle de version Git. Ne partagez jamais ce fichier et ne l'incluez pas dans vos commits.
- Vérifiez que votre clé API Anthropic est correctement configurée dansapplication-secrets.properties
Erreur "Cannot run program 'npx'"
- Vérifiez que Node.js est installé ou désactivez le serveur filesystem en ajoutant:
- spring.ai.mcp.client.stdio.filesystem.auto-initialization.enabled=falsedansapplication.properties
- Vérifiez que les serveurs MCP sont en cours d'exécution
- Vérifiez les paramètres de timeout dansapplication.properties
- Forker le dépôt
- Créer une branche pour votre fonctionnalité (git checkout -b nouvelle-fonctionnalite)
- Valider vos modifications (git commit -am 'Ajouter une nouvelle fonctionnalité')
- Pousser vers la branche (git push origin nouvelle-fonctionnalite)
- Créer une Pull Request
Ce projet est distribué sous licence MIT.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Arbitrary code execution and tool-use platform for LLMs by Riza
Agent-native developer Q&A API with MCP + A2A endpoints for citations, job pickup, and answer submission.
An AI agent using the Model Context Protocol (MCP) with a Node.js server providing REST resources for users and messages.
Open-source, self-hosted AI gateway with built-in MCP client and server support for connecting MCP tools to AI applications.
Search 15,000+ AI tools, check agent-compatibility scores, find alternatives, and audit dependencies before calling any external API or MCP.
Integrate with the Flowise API to create predictions and manage chatflows and assistants.
An MCP server that provides seamless access to Kirha AI tools.
A toolkit to integrate agent frameworks like MCP with Maton APIs through function calling.
Unified MCP gateway that gives AI agents access to 100+ tools, marketplace MCPs, and custom MCP servers through simple search and execute workflows.
a complete and intuitive SDK for building MCP Servers, MCP Agents, and LLM integrations (OpenAI, Claude, Gemini) with minimal effort. It abstracts all the complexity of the MCP protocol, provides an intelligent agent with automatic model routing, and includes a universal client for external APIs all through a single, simple, and powerful interface. Perfect for chatbots, enterprise automation, internal system integrations, and rapid development of MCP-based ecosystems.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




