VS

vudayani/spring-ai-mcp-workshop

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

12 stars 11 forks 质量 52 趋势 19

Spring AI MCP Workshop Examples

概览

Welcome to the "From Prompts to Agents" workshop! In this 90-minute session, we'll explore how to build intelligent, context-aware AI applications with Spring AI and the Model Context Protocol (MCP). We'll go beyond simple prompts to create applications that can reason over your data, integrate with external systems, and orchestrate real-world workflows. In this workshop, we'll build an AI assistant that helps a developer start their day. We will build an MCP client that can connect to Github MCP server and a custom MCP server that exposes internal tools. By the end, you'll be able to ask questions like: * "What are the recent activities in the spring-projects/spring-ai repository?" * "Who is on call for support today?" You can find the complete code for this workshop in this GitHub repository. Before you begin, ensure you have the following installed: * * : For building the project * : For cloning the repository * : We'll use Docker to run the GitHub MCP Server.

README

以下为原文 README 节选,完整内容请查看原文。

From Prompts to Agents: Supercharging Spring Boot with AI and MCP

Welcome to the “From Prompts to Agents” workshop! In this 90-minute session, we’ll explore how to build intelligent, context-aware AI applications with Spring AI and the Model Context Protocol (MCP).

We’ll go beyond simple prompts to create applications that can reason over your data, integrate with external systems, and orchestrate real-world workflows.

What We’re Building

In this workshop, we’ll build an AI assistant that helps a developer start their day. We will build an MCP client that can connect to Github MCP server and a custom MCP server that exposes internal tools. By the end, you’ll be able to ask questions like:

  • “What are the recent activities in the spring-projects/spring-ai repository?”
  • “Who is on call for support today?”

You can find the complete code for this workshop in this GitHub repository.

Prerequisites

Before you begin, ensure you have the following installed:

  • Java 21 or higher
  • Maven: For building the project
  • Git: For cloning the repository
  • Docker: We’ll use Docker to run the GitHub MCP Server. You can find installation instructions at the official Docker website.
  • Node.js and npx: We’ll use npx to run the MCP Model Inspector. You can install it from the official Node.js website.
  • An IDE: Your favorite IDE (Spring Tool Suite, IntelliJ IDEA, VS Code with Spring extensions)
  • An AI Model Provider Account: You’ll need an API key from a provider like OpenAI or Anthropic, or a locally running model with Ollama

Setup Instructions

1. Clone the Repository

Open your terminal and clone this repository:

git clone [email protected]:vudayani/spring-ai-mcp-workshop.git
cd spring-ai-mcp-workshop

2. Configure Your AI Model Provider

Spring AI supports a wide range of LLM providers. For this workshop, you can use any provider, but we have included instructions for three popular options below. For a complete list of supported providers and their specific configurations, please refer to the official Spring AI documentation.

Choose one of the following options to configure your connection to a Large Language Model (LLM).

Option A: OpenAI

  1. Get API Key: If you don’t have one, create an API key at platform.openai.com/api-keys.

  2. Set Environment Variable: Export the key as an environment variable.

    export SPRING_AI_OPENAI_API_KEY=''
    
  3. Verify Your Key: Run the following curl command to ensure your key is working correctly.

    curl https://api.openai.com/v1/chat/completions \
      -H "Content-Type: application/json" \
在 GitHub 查看完整 README

安装

npx -y @modelcontextprotocol/inspector npx @modelcontextprotocol/server-filesystem /path/to/a/directory
新手?先看 mcpskill.org 教程 →