Share
Embed
Transcript
35 slides
-
MCP en action: Connecter les IA aux systèmes d’entreprise Zineb
Bendhiba, Principal Software Engineer, Red Hat -
Model Context Protocol (MCP) A new protocol - A standard
for connecting AI agents to systems - Pushed by Anthropic (Claude) USB for AI integrations -
Capabilities Tools - The client can invoke “tool” and get
the response - Close to function calling, but the invocation is requested by the client - Can be anything: database, remote service… Resources - Expose data - URL -> Content Prompts - Pre-written prompt template - Allows executing specific prompt -
Transport JSON-RPC 2.0 - Everything is JSON - Request /
Response and Notifications - Possible multiplexing Transports - stdio -> The client instantiates the server, sends the requests on stdio and gets the response from the same channel - Server-Sent Event (SSE) -> The client sends a POST request to the server, the response is an SSE (chunked response) - Streamable HTTP -> -
Quarkus MCP server extensions 2 extensions - SSE (SSE) ->
quarkus-mcp-server-sse - stdio -> quarkus-mcp-server-stdio -
Quarkus MCP server extensions @Inject CodeService codeService; @Tool(description = "Converts
the string value to lower case" ) String toLowerCase(String value) { return value.toLowerCase(); } @Prompt(name = "code_assist") PromptMessage codeAssist(@PromptArg(name = "lang") String language) { return PromptMessage.withUserRole(new TextContent(codeService.assist(language))); } @Resource(uri = "file:///project/alpha" ) BlobResourceContents alpha(RequestUri uri) throws IOException{ return BlobResourceContents.create(uri.value(), Files.readAllBytes(Path.of("alpha.txt"))); } MCP Tool MCP Prompt MCP Resource -
Model and Model Serving Model Model Serving Model Serving -
Run the model - CPU / GPU - Expose an API Input - Prompt (text) - Instructions to give to the model - Taming a model is hard GPUs Input (Prompt) Output -
Application Model AI-infused application |ˌeɪˌaɪ ˈɪnˌfjuːzd ˌæplɪˈkeɪʃən| noun (Plural AI-Infused
applications) A software program enhanced with artificial intelligence capabilities, utilizing AI models to implement intelligent features and functionalities. Model Serving -
So… basically, you just call a REST API, right ?
[Spoiler Alert: No] -
Model <= HTTP Client <= Application HTTP Client Leaking HTTP
stuff or abstractions - Often leak HTTP details - Error code, connection pooling - Requires implementing memory and token counting logic Application -
LangChain4j LangChain4j Chains Agents Prompts Document Loaders Vector Stores Models
https://github.com/langchain4j/langchain4j -
LangChain / LangChain4j / Quarkus LangChain4j LangChain LangChain4j Quarkus LangChain4j
Inspired By Uses and extends Framework Clean separation, Managed interactions Integration Application -
Quarkus LangChain4j https://docs.quarkiverse.io/quarkus-langchain4j LangChain4j Quarkus LangChain4j Application LLMs Vector stores
Embedding Models - Declarative clients - CDI integration - Observability (Otel, Prometheus) - Auditing - Resilience - Guardrails - RAG building blocks - Agentic architecture - Testability (unit, IT, evaluation) - Developer Joy -
Agent and MCP servers MCP servers offer new tools and
resources that the model can call: Prompt (Context) Extend the context with MCP tools descriptions Invoke the model The model invoke a tool invocation (name + parameters) The tool is invoked via JSON-RPC and the result sent to the model The model computes the response using the tool result Response -
Quarkus Langchain4j MCP client extension quarkus.langchain4j.mcp.filesystem. transport-type =stdio quarkus.langchain4j.mcp.filesystem. command=npx,-y,@modelcontextprotocol/s
erver-filesystem,/my-system-path/location quarkus.langchain4j.mcp.wanaku. transport-type =http quarkus.langchain4j.mcp.wanaku. url=http://my-url/mcp/sse/ stdio SSE -
My obsertavtions - Most of servers are stdio - Entreprise
vs Local - Lack of documentation for SSE - Security - Authentication - Wanaku experience : limitation in the number of tools - MCP and Agentic -> emerging A2A - Not the only protocol (ACP …) -
Links - https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html - https://quarkus.io/blog/mcp-server/ - https://www.wanaku.ai/ - https://quarkus.io/blog/secure-mcp-sse-server/ -
https://www.anthropic.com/news/model-context-protocol - Quarkus Langchain4j à Devoxx France