{"id":1571,"date":"2024-12-24T00:18:26","date_gmt":"2024-12-24T00:18:26","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/12\/24\/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker\/"},"modified":"2024-12-24T00:18:26","modified_gmt":"2024-12-24T00:18:26","slug":"the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/12\/24\/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker\/","title":{"rendered":"The Model Context Protocol: Simplifying Building AI apps with Anthropic Claude Desktop and Docker"},"content":{"rendered":"<p>Anthropic recently unveiled the <a href=\"https:\/\/www.anthropic.com\/news\/model-context-protocol\" target=\"_blank\">Model Context Protocol<\/a> (MCP), a new standard for connecting AI assistants and models to reliable data and tools. However, packaging and distributing MCP servers is very challenging due to complex environment setups across multiple architectures and operating systems. Docker is the perfect solution for this \u2013 it allows developers to encapsulate their development environment into containers, ensuring consistency across all team members\u2019 machines and deployments consistent and predictable. In this blog post, we provide a few examples of using Docker to containerize Model Context Protocol (MCP) to simplify building AI applications.\u00a0<\/p>\n<h2 class=\"wp-block-heading\">What is Model Context Protocol (MCP)?<\/h2>\n<p>MCP (<a href=\"https:\/\/modelcontextprotocol.io\/introduction\" target=\"_blank\">Model Context Protocol<\/a>), a new protocol open-sourced by Anthropic, provides standardized interfaces for LLM applications to integrate with external data sources and tools. With MCP, your AI-powered applications can retrieve data from external sources, perform operations with third-party services, or even interact with local filesystems.<\/p>\n<p>Among the use cases enabled by this protocol is the ability to expose custom tools to AI models. This provides key capabilities such as:<\/p>\n<p><strong>Tool discovery<\/strong>: Helping LLMs identify tools available for execution<\/p>\n<p><strong>Tool invocation<\/strong>: Enabling precise execution with the right context and arguments<\/p>\n<p>Since its release, the developer community has been particularly energized. We asked David Soria Parra, Member of Technical Staff from Anthropic, why he felt MCP was having such an impact: \u201c<em>Our initial developer focus means that we\u2019re no longer bound to one specific tool set.\u00a0 We are giving developers the power to build for their particular workflow<\/em>.\u201d<\/p>\n<h2 class=\"wp-block-heading\">How does MCP work? What challenges exist?<\/h2>\n<p>MCP works by introducing the concept of <a href=\"https:\/\/modelcontextprotocol.io\/clients\" target=\"_blank\">MCP clients<\/a> and MCP Servers \u2013 clients request resources and the servers handle the request and perform the requested action. MCP Clients are often embedded into LLM-based applications, such as the Claude Desktop App. The MCP Servers are launched by the client to then perform the desired work using any additional tools, languages, or processes needed to perform the work.<\/p>\n<p>Examples of tools include filesystem access, GitHub and GitLab repo management, integrations with Slack, or retrieving or modifying state in Kubernetes clusters.<\/p>\n<p>Figure 1: A high-level architecture diagram of MCP client and server interactions<\/p>\n<p>The goal of MCP servers is to provide reusable toolsets and reuse them across <a href=\"https:\/\/modelcontextprotocol.io\/clients\" target=\"_blank\">clients<\/a>, like Claude Desktop \u2013 write one set of tools and reuse them across many LLM-based applications. But, packaging and distributing these servers is currently a challenge. Specifically:<\/p>\n<p><strong>Environment conflicts<\/strong>: Installing MCP servers often requires specific versions of Node.js, Python, and other dependencies, which may conflict with existing installations on a user\u2019s machine<\/p>\n<p><strong>Lack of host isolation<\/strong>: MCP servers currently run on the host, granting access to all host files and resources<\/p>\n<p><strong>Complex setup<\/strong>: MCP servers currently require users to download and configure all of the code and configure the environment, making adoption difficult<\/p>\n<p><strong>Cross-platform challenges<\/strong>: Running the servers consistently across different architectures (e.g., x86 vs. ARM, Windows vs Mac) or operating systems introduces additional complexity<\/p>\n<p><strong>Dependencies<\/strong>: Ensuring that server-specific runtime dependencies are encapsulated and distributed safely.<\/p>\n<h2 class=\"wp-block-heading\">How does Docker help?<\/h2>\n<p>Docker solves these challenges by providing a standardized method and tooling to develop, package, and distribute applications, including MCP servers. By packaging these MCP servers as containers, the challenges of isolation or environment differences disappear. Users can simply run a container, rather than spend time installing dependencies and configuring the runtime.<\/p>\n<p><a href=\"https:\/\/www.docker.com\/products\/docker-desktop\/\">Docker Desktop<\/a> provides a development platform to build, test, and run these MCP servers. <a href=\"https:\/\/www.docker.com\/products\/docker-hub\/\">Docker Hub<\/a> is the world\u2019s largest repository of container images, making it the ideal choice to distribute containerized MCP servers. <a href=\"https:\/\/www.docker.com\/products\/docker-scout\/\">Docker Scout<\/a> helps ensure images are kept secure and free of vulnerabilities. <a href=\"https:\/\/www.docker.com\/products\/build-cloud\/\">Docker Build Cloud<\/a> helps you build images more quickly and reliably, especially when cross-platform builds are required.<\/p>\n<p>The Docker suite of products brings benefits to both publishers and consumers \u2013 publishers can easily package and distribute their servers and consumers can easily download and run them with little to no configuration.<\/p>\n<p>Again quoting David Soria Parra,\u00a0<\/p>\n<p><em>\u201cBuilding an MCP server for ffmpeg would be a tremendously difficult undertaking without Docker. Docker is one of the most widely used packaging solutions for developers. The same way it solved the packaging problem for the cloud, it now has the potential to solve the packaging problem for rich AI agents\u201d.\u00a0<\/em><\/p>\n<p>Figure 2: Architecture diagram demonstrating MCP servers running in a Docker container<\/p>\n<p>As we continue to explore how MCP allows us to connect to existing ecosystems of tools, we also envision MCP bridges to existing containerized tools.<\/p>\n<p>Figure 3: Architecture diagram that shows a single MCP server calling multiple tools in their own containers<\/p>\n<h2 class=\"wp-block-heading\">Try it yourself with containerized Reference Servers<\/h2>\n<p>As part of publishing the <a href=\"https:\/\/spec.modelcontextprotocol.io\/specification\/\" target=\"_blank\">specification<\/a>, Anthropic published an initial set of <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers\" target=\"_blank\">reference servers<\/a>. We have worked with the Anthropic team to create Docker images for these servers and make them available from the new Docker Hub <a href=\"https:\/\/hub.docker.com\/u\/mcp\" target=\"_blank\">mcp namespace<\/a>.<\/p>\n<p>Developers can try this out today using Claude Desktop as the MCP client and Docker Desktop to run any of the reference servers by updating <a href=\"https:\/\/modelcontextprotocol.io\/quickstart\/user\" target=\"_blank\">your claude_desktop_config.json<\/a> file.<\/p>\n<p>The <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers?tab=readme-ov-file#-reference-servers\" target=\"_blank\">list of current servers<\/a> documents how to update the claude_desktop_config.json to activate these MCP server docker containers on your local host.<\/p>\n<h2 class=\"wp-block-heading\">Using Puppeteer to take and modify screenshots using Docker<\/h2>\n<p>This demo will use the <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers\/tree\/main\/src\/puppeteer\" target=\"_blank\">Puppeteer MCP server<\/a> to take a screenshot of a website and invert the colors using Claude Desktop and Docker Desktop. Doing this without a containerized environment requires quite a bit of setup, but is fairly trivial using containers.<\/p>\n<p>Update your claude_desktop_config.json file to include the following configuration:<\/p>\n<p>For example, extending Claude Desktop to use puppeteer for browser automation and web scraping requires the following entry (which is fully documented <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers\/tree\/main\/src\/puppeteer#docker\" target=\"_blank\">here<\/a>):<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n{<br \/>\n  &#8220;mcpServers&#8221;: {<br \/>\n    &#8220;puppeteer&#8221;: {<br \/>\n      &#8220;command&#8221;: &#8220;docker&#8221;,<br \/>\n      &#8220;args&#8221;: [&#8220;run&#8221;, &#8220;-i&#8221;, &#8220;&#8211;rm&#8221;, &#8220;&#8211;init&#8221;, &#8220;-e&#8221;, &#8220;DOCKER_CONTAINER=true&#8221;, &#8220;mcp\/puppeteer&#8221;]<br \/>\n    }<br \/>\n  }<br \/>\n}\n<\/div>\n<p>Restart Claude Desktop to apply the changed config file.<\/p>\n<p>Submit the following prompt using the Sonnet 3.5 model:<\/p>\n<p>\u201c<em>Take a screenshot of docs.docker.com and then invert the colors<\/em>\u201c<\/p>\n<p>Claude will run through several consent screens ensuring that you\u2019re okay running these new tools.<\/p>\n<p>After a brief moment, you\u2019ll have your requested screenshot<\/p>\n<p>What happened? Claude planned out a series of tool calls, starting the puppeteer MCP server in a container, and then used the headless browser in that container to navigate to a site, grab a screenshot, invert the colors on the page, and then finally grab a screenshot of the altered page.<\/p>\n<div class=\"wp-block-embed__wrapper\">\n<\/div>\n<p>Figure 4: Running Dockerized Puppeteer in Claude Desktop to invert colors on <a href=\"https:\/\/docs.docker.com\/\" target=\"_blank\">https:\/\/docs.docker.com\/<\/a><\/p>\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n<p>There\u2019s already a lot that developers can try with this first set of servers. For an educational glimpse into what\u2019s possible with database containers, we recommend that you connect the <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers\/tree\/main\/src\/sqlite#docker\" target=\"_blank\">sqlite<\/a> server container, and run the sample prompt that it provides. It\u2019s an eye-opening display of what\u2019s already possible today. Plus, the demo is containerized!<\/p>\n<p>We\u2019re busy adding more content to enable you to easily build and distribute your own MCP docker images. We are also encouraging and working closely with the community to package more Docker containers. Please reach out with questions in the <a href=\"https:\/\/github.com\/orgs\/modelcontextprotocol\/discussions\" target=\"_blank\">discussion group<\/a>.\u00a0\u00a0<\/p>\n<h2 class=\"wp-block-heading\">Learn more<\/h2>\n<p>Read the<a href=\"https:\/\/www.docker.com\/blog\/tag\/docker-desktop-release\/\"> Docker Desktop release collection<\/a> to see even more updates and innovation announcements.<\/p>\n<p>Subscribe to the<a href=\"https:\/\/www.docker.com\/newsletter-subscription\/\"> Docker Navigator newsletter<\/a><\/p>\n<p>Subscribe to the <a href=\"https:\/\/www.linkedin.com\/newsletters\/docker-labs-genai-7204877599427194882\/\" target=\"_blank\">Docker Labs: GenAI newsletter<\/a><\/p>\n<p>Discover the<a href=\"https:\/\/www.docker.com\/blog\/november-2024-updated-plans-announcement\/\"> upgraded Docker plans.\u00a0<\/a><\/p>\n<p>See what\u2019s<a href=\"https:\/\/www.docker.com\/blog\/tag\/docker-desktop-release\/\"> new in Docker Desktop<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Anthropic recently unveiled the Model Context Protocol (MCP), a new standard for connecting AI assistants and models to reliable data [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1571","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=1571"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1571\/revisions"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=1571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=1571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=1571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}