{"id":58926,"date":"2026-01-08T17:19:59","date_gmt":"2026-01-08T22:19:59","guid":{"rendered":"https:\/\/codesamplez.com\/?p=58926"},"modified":"2026-01-08T17:20:12","modified_gmt":"2026-01-08T22:20:12","slug":"model-context-protocol-for-beginners","status":"publish","type":"post","link":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners","title":{"rendered":"Model Context Protocol For Beginners: Superpower of AI Agents"},"content":{"rendered":"\n<p>I&#8217;ll never forget the moment I watched Claude automatically pull data from database and draft insights based on the data\u2014all without me writing a single API integration. That&#8217;s the magic of <strong>Model Context Protocol for beginners<\/strong> like I was three months ago.<\/p>\n\n\n\n<p>Before MCP, connecting AI agents to real-world systems meant building custom integrations for every single tool. After MCP? I built one server that exposed five different data sources in under an hour. If you&#8217;ve ever wished your AI assistant could actually <em>do things<\/em> instead of just suggesting them, you&#8217;re in the right place.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-model-context-protocol-mcp\">What is Model Context Protocol (MCP)?<\/h3>\n\n\n\n<p><strong>Model Context Protocol (MCP) is an open-source standard created by Anthropic that enables AI agents to securely connect to your local tools, databases, APIs, and file systems through a universal interface.<\/strong><\/p>\n\n\n\n<p>Think of MCP as the missing bridge between large language models and the messy, beautiful chaos of your actual work environment. It&#8217;s what transforms Claude from a smart chatbot into an agentic system that can read your documentation, query your databases, and execute actions on your behalf.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Model Context Protocol Matters (And Why You Should Care)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. One Protocol, Infinite Connections \ud83d\udd0c<\/h3>\n\n\n\n<p>Instead of building custom integrations for Notion, GitHub, Postgres, Slack, and fifty other tools, you build <em>one<\/em> MCP server. AI agents that support MCP (like Claude) can instantly talk to everything you expose. It&#8217;s the difference between carrying fifteen different chargers and having one USB-C cable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Security by Design<\/h3>\n\n\n\n<p>MCP servers run locally on your machine or infrastructure. Your database credentials never leave your environment. When Claude needs customer data, it asks <em>your<\/em> MCP server\u2014which enforces <em>your<\/em> access rules. No cloud middleman storing your API keys.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Real-World Use Cases That Actually Ship<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Customer Support Agent<\/strong>: Queries your Zendesk API, checks order status in your database, and suggests refund amounts based on company policy stored in Confluence<\/li>\n\n\n\n<li><strong>Code Review Assistant<\/strong>: Reads your GitHub PRs, fetches relevant design docs from Notion, and cross-references your internal style guide<\/li>\n\n\n\n<li><strong>Data Analyst Copilot<\/strong>: Connects to your data warehouse, runs SQL queries, and generates visualizations\u2014all through natural language<\/li>\n<\/ul>\n\n\n\n<p>I&#8217;ve seen teams reduce integration development time from weeks to <em>hours<\/em> using MCP for beginners patterns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Guide: Build Your First MCP Server<\/h2>\n\n\n\n<p>Let&#8217;s build something real. We&#8217;ll create an MCP server that exposes a simple task management system to any MCP-compatible AI agent. By the end, Claude will be able to create, list, and complete tasks through natural conversation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Node.js 18+ installed (<a href=\"https:\/\/modelcontextprotocol.io\/introduction\">official MCP documentation<\/a>)<\/li>\n\n\n\n<li>Basic JavaScript knowledge<\/li>\n\n\n\n<li>10 minutes of focus time<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Initialize Your MCP Server<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly># Create project directory\nmkdir my-first-mcp-server\ncd my-first-mcp-server\n\n# Initialize with the official MCP SDK\nnpm init -y\nnpm install @modelcontextprotocol\/sdk\n\n# Create your server file\ntouch server.js<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #616E88\"># Create project directory<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">mkdir<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">my-first-mcp-server<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">cd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">my-first-mcp-server<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Initialize with the official MCP SDK<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">npm<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">init<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-y<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">npm<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">@modelcontextprotocol\/sdk<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create your server file<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">touch<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">server.js<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#2e3440ff;color:#c8d0e0;font-size:12px;line-height:1;position:relative\">Bash<\/span><\/div>\n\n\n\n<p><strong>Pro Tip:<\/strong> The <code>@modelcontextprotocol\/sdk<\/code> package handles all the protocol complexity. You just define tools\u2014MCP does the heavy lifting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Define Your First MCP Tool<\/h3>\n\n\n\n<p>Open <code>server.js<\/code> and paste this well-commented code:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(3 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import { Server } from \"@modelcontextprotocol\/sdk\/server\/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol\/sdk\/server\/stdio.js\";\nimport { CallToolRequestSchema } from \"@modelcontextprotocol\/sdk\/types.js\";\nimport { z } from \"zod\";\n\n\/\/ Define request schemas\nconst ListToolsRequestSchema = z.object({\n  method: z.literal(\"tools\/list\"),\n  params: z.object({})\n});\n\n\/\/ In-memory task storage (use a real DB in production!)\nconst tasks = [];\n\n\/\/ Initialize MCP server\nconst server = new Server(\n  {\n    name: \"task-manager\",\n    version: \"1.0.0\",\n  },\n  {\n    capabilities: {\n      tools: {}, \/\/ We're exposing tools to AI agents\n    },\n  }\n);\n\n\/\/ Define the \"add_task\" tool\nserver.setRequestHandler(ListToolsRequestSchema, async () => {\n  return {\n    tools: [\n      {\n        name: \"add_task\",\n        description: \"Add a new task to the task list\",\n        inputSchema: {\n          type: \"object\",\n          properties: {\n            title: {\n              type: \"string\",\n              description: \"Task title\",\n            },\n            priority: {\n              type: \"string\",\n              enum: &#91;\"low\", \"medium\", \"high\"&#93;,\n              description: \"Task priority level\",\n            },\n          },\n          required: &#91;\"title\"&#93;,\n        },\n      },\n      {\n        name: \"list_tasks\",\n        description: \"Get all current tasks\",\n        inputSchema: {\n          type: \"object\",\n          properties: {},\n        },\n      },\n    ],\n  };\n});\n\n\/\/ Handle tool execution requests from AI agents\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n  const { name, arguments: args } = request.params;\n\n  if (name === \"add_task\") {\n    const newTask = {\n      id: Date.now(),\n      title: args.title,\n      priority: args.priority || \"medium\",\n      completed: false,\n    };\n    tasks.push(newTask);\n    return {\n      content: &#91;\n        {\n          type: \"text\",\n          text: `\u2705 Task added: \"${newTask.title}\" (Priority: ${newTask.priority})`,\n        },\n      &#93;,\n    };\n  }\n\n  if (name === \"list_tasks\") {\n    const taskList = tasks.map(\n      (t) => `&#91;${t.completed ? \"\u2713\" : \" \"}&#93; ${t.title} (${t.priority})`\n    );\n    return {\n      content: &#91;\n        {\n          type: \"text\",\n          text: taskList.length > 0 \n            ? taskList.join(\"\\n\") \n            : \"No tasks yet!\",\n        },\n      &#93;,\n    };\n  }\n\n  throw new Error(`Unknown tool: ${name}`);\n});\n\n\/\/ Start server with stdio transport (connects via stdin\/stdout)\nasync function main() {\n  const transport = new StdioServerTransport();\n  await server.connect(transport);\n  console.error(\"Task Manager MCP Server running\"); \/\/ stderr for logs\n}\n\nmain();<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">Server<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">@modelcontextprotocol\/sdk\/server\/index.js<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">StdioServerTransport<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">@modelcontextprotocol\/sdk\/server\/stdio.js<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">CallToolRequestSchema<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">@modelcontextprotocol\/sdk\/types.js<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">z<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">zod<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Define request schemas<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">ListToolsRequestSchema<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">z<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">object<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #88C0D0\">method<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">z<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">literal<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">tools\/list<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #88C0D0\">params<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">z<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">object<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">{}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ In-memory task storage (use a real DB in production!)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">tasks<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> []<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Initialize MCP server<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">server<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">new<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">Server<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">name<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">task-manager<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">version<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">1.0.0<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">capabilities<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">tools<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{},<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ We&#39;re exposing tools to AI agents<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Define the &quot;add_task&quot; tool<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">server<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">setRequestHandler<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">ListToolsRequestSchema<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">async<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">tools<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">name<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">add_task<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">description<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Add a new task to the task list<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">inputSchema<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">properties<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">title<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #88C0D0\">description<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Task title<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #88C0D0\">priority<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #88C0D0\">enum<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> &#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">low<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">medium<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">high<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">&#93;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #88C0D0\">description<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Task priority level<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">required<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> &#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">title<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">&#93;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">name<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">list_tasks<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">description<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Get all current tasks<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">inputSchema<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">properties<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    ]<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Handle tool execution requests from AI agents<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">server<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">setRequestHandler<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">CallToolRequestSchema<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">async<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">request<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> arguments<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">args<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">request<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">params<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">===<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">add_task<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">newTask<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">id<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Date<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">now<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">title<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">args<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">title<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">priority<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">args<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">priority<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">||<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">medium<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">completed<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">false<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">tasks<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">push<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">newTask<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">content<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> &#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">text<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">text<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">\u2705 Task added: &quot;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">newTask<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">title<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&quot; (Priority: <\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">newTask<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">priority<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">)<\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      &#93;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">===<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">list_tasks<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">taskList<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">tasks<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">map<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">t<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">&#91;<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">t<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">completed<\/span><span style=\"color: #A3BE8C\"> <\/span><span style=\"color: #81A1C1\">?<\/span><span style=\"color: #A3BE8C\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u2713<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\"> <\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #A3BE8C\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#93; <\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">t<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">title<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\"> (<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">t<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">priority<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">)<\/span><span style=\"color: #ECEFF4\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    )<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #88C0D0\">content<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> &#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">type<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">text<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #88C0D0\">text<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">taskList<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9FF\">length <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #81A1C1\">?<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">taskList<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">join<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #EBCB8B\">\\n<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">) <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #81A1C1\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">No tasks yet!<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      &#93;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">throw<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">new<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">Error<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #A3BE8C\">Unknown tool: <\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">name<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #ECEFF4\">`<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Start server with stdio transport (connects via stdin\/stdout)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">async<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">main<\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">const<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">transport<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">new<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">StdioServerTransport<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #81A1C1\">await<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">server<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">connect<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">transport<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #D8DEE9\">console<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">error<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Task Manager MCP Server running<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ stderr for logs<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">main<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #81A1C1\">;<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#2e3440ff;color:#c8d0e0;font-size:12px;line-height:1;position:relative\">JavaScript<\/span><\/div>\n\n\n\n<p><strong>What&#8217;s Happening Here?<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>We define two tools: <code>add_task<\/code> and <code>list_tasks<\/code><\/li>\n\n\n\n<li>Each tool has a JSON schema describing its inputs (AI agents read this!)<\/li>\n\n\n\n<li>When an agent calls a tool, our handler executes the logic and returns results<\/li>\n\n\n\n<li>The <code>StdioServerTransport<\/code> lets AI agents communicate via standard input\/output<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Configure Claude Desktop to Use Your Server<\/h3>\n\n\n\n<p>Create a configuration file at <code>~\/Library\/Application Support\/Claude\/claude_desktop_config.json<\/code> (macOS) or <code>%APPDATA%\\Claude\\claude_desktop_config.json<\/code> (Windows):<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"mcpServers\": {\n    \"task-manager\": {\n      \"command\": \"node\",\n      \"args\": &#91;\"\/absolute\/path\/to\/your\/my-first-mcp-server\/server.js\"&#93;\n    }\n  }\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">mcpServers<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">: <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">task-manager<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">command<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">node<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">args<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> &#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\/absolute\/path\/to\/your\/my-first-mcp-server\/server.js<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#2e3440ff;color:#c8d0e0;font-size:12px;line-height:1;position:relative\">JavaScript<\/span><\/div>\n\n\n\n<p><strong>Critical:<\/strong> Use the absolute path to your <code>server.js<\/code> file. Restart Claude Desktop after saving.<\/p>\n\n\n\n<p>Note\ud83d\udca1: See we haven&#8217;t run the server ourselves yet. Because we don&#8217;t have to, Claude Desktop does it for us when we start it. However, if you want to test that there&#8217;s no error in the script, try running <code>node server.js<\/code> command to ensure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Test With Claude<\/h3>\n\n\n\n<p>Open Claude Desktop and try these prompts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>&#8220;Add a task called &#8216;Write MCP tutorial&#8217; with high priority&#8221;<\/em><\/li>\n\n\n\n<li><em>&#8220;Show me all my tasks&#8221;<\/em><\/li>\n\n\n\n<li><em>&#8220;Add another task: &#8216;Review pull requests&#8217; with medium priority&#8221;<\/em><\/li>\n<\/ul>\n\n\n\n<p>Claude will automatically discover your tools, call them with the right parameters, and show you the results. You just created your first agentic workflow! \ud83c\udf89<\/p>\n\n\n\n<p>Pro Tip \ud83d\udca1: Creating your own agent. Try our<a href=\"https:\/\/codesamplez.com\/development\/building-ai-agent-from-scratch\" target=\"_blank\" rel=\"noreferrer noopener\"> in-depth guide to create AI agents in Python<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting &amp; Gotchas<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">&#8220;Claude doesn&#8217;t see my tools&#8221;<\/h3>\n\n\n\n<p><strong>Quick Fix:<\/strong> Check these in order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Restart Claude Desktop completely (quit from menu bar)<\/li>\n\n\n\n<li>Verify your config file has valid JSON (use <a href=\"https:\/\/codesamplez.com\/tools\/json-formatter\" target=\"_blank\" rel=\"noreferrer noopener\">JSON Validator and Formatter<\/a>)<\/li>\n\n\n\n<li>Check absolute paths\u2014relative paths fail silently<\/li>\n\n\n\n<li>Look at Claude&#8217;s logs: <code>~\/Library\/Logs\/Claude\/<\/code> (macOS) or <code>%APPDATA%\\Claude\\logs\\<\/code> (Windows)<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">&#8220;Tool execution fails with timeout&#8221;<\/h3>\n\n\n\n<p>Your tool handler is taking too long. MCP has a 60-second timeout by default. If you&#8217;re calling slow APIs, return a &#8220;working on it&#8221; message quickly, then use resources to stream updates (<a href=\"https:\/\/modelcontextprotocol.io\/docs\/concepts\/resources\" target=\"_blank\" rel=\"noreferrer noopener\">advanced pattern here<\/a>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8220;Can&#8217;t install @modelcontextprotocol\/sdk&#8221;<\/h3>\n\n\n\n<p>Make sure you&#8217;re on Node.js 18+. Run <code>node --version<\/code> to check. MCP uses modern ES modules that older Node versions don&#8217;t support.<\/p>\n\n\n\n<p><strong>Pro Tip:<\/strong> Always validate your tool&#8217;s <code>inputSchema<\/code> carefully. AI agents rely on these schemas to construct valid requests. A missing <code>required<\/code> field means Claude might not pass that parameter!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Limitations &amp; When MCP Isn&#8217;t The Answer<\/h2>\n\n\n\n<p>Let&#8217;s be honest about what MCP <em>doesn&#8217;t<\/em> do well:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. High-Latency Operations<\/h3>\n\n\n\n<p>MCP tools execute synchronously. If your database query takes 30 seconds, Claude waits 30 seconds. For long-running tasks, use MCP to <em>trigger<\/em> the work, then provide a separate tool to check status.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Complex State Management<\/h3>\n\n\n\n<p>Our example uses in-memory storage. Real applications need databases. MCP doesn&#8217;t include ORM magic\u2014you&#8217;ll integrate your own data layer. Think of MCP as the <em>interface<\/em>, not the entire backend.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Binary Data Handling<\/h3>\n\n\n\n<p>MCP primarily exchanges text and JSON. Need to process images or PDFs? You&#8217;ll encode them as base64 or store them separately and pass references through MCP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Mitigation Strategies<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>For slow operations:<\/strong> Return immediately with a task ID, expose a <code>check_status<\/code> tool<\/li>\n\n\n\n<li><strong>For complex state:<\/strong> Use proven databases (SQLite for local, Postgres for production) behind your MCP tools<\/li>\n\n\n\n<li><strong>For binary data:<\/strong> Store files locally\/S3, pass URLs or file paths through MCP<\/li>\n<\/ul>\n\n\n\n<p>The Model Context Protocol for beginners isn&#8217;t trying to be your entire application architecture. It&#8217;s the <em>communication layer<\/em> that makes AI agents useful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next Steps: Level Up Your MCP Skills<\/h2>\n\n\n\n<p>You&#8217;ve built your first MCP server. Here&#8217;s where to go next:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Add Authentication:<\/strong> Implement token-based auth in your tool handlers (<a href=\"https:\/\/modelcontextprotocol.io\/specification\/draft\/basic\/security_best_practices\" target=\"_blank\" rel=\"noreferrer noopener\">security best practices<\/a>)<\/li>\n\n\n\n<li><strong>Connect Real APIs:<\/strong> Wrap GitHub, Notion, or your company&#8217;s internal APIs as MCP tools<\/li>\n\n\n\n<li><strong>Explore Resources:<\/strong> MCP also supports <em>resources<\/em> (read-only data like docs) and <em>prompts<\/em> (reusable instruction templates)<\/li>\n\n\n\n<li><strong>Build With Python:<\/strong> The SDK supports Python too\u2014check out the <a href=\"https:\/\/modelcontextprotocol.io\/docs\/develop\/build-server#python\" target=\"_blank\" rel=\"noreferrer noopener\">Python quickstart<\/a><\/li>\n\n\n\n<li><strong>Join The Community:<\/strong> Share your servers at <a href=\"https:\/\/github.com\/modelcontextprotocol\/servers\" target=\"_blank\" rel=\"noreferrer noopener\">MCP Servers GitHub<\/a><\/li>\n<\/ol>\n\n\n\n<p><strong>Question to reflect on:<\/strong> What&#8217;s one repetitive task in your workflow that an AI agent with MCP access could automate for you right now?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: You&#8217;re Now Dangerous With MCP<\/h2>\n\n\n\n<p>Congratulations! You&#8217;ve gone from &#8220;What&#8217;s Model Context Protocol?&#8221; to running a working MCP server that turns Claude into an agentic task manager. That&#8217;s not theoretical knowledge\u2014you&#8217;ve shipped actual code that AI agents can execute.<\/p>\n\n\n\n<p>The beauty of MCP for beginners is how quickly you can go from concept to working prototype. That server you just built? Add five more tools and suddenly Claude is managing your entire development workflow.<\/p>\n\n\n\n<p><strong>Your mission:<\/strong> Take the code from this tutorial and replace the in-memory task storage with a real SQLite database. Then add a <code>complete_task<\/code> tool. You&#8217;ll have a production-ready task system in under an hour.<\/p>\n\n\n\n<p>The future of AI isn&#8217;t smarter chatbots. It&#8217;s agents that work <em>with<\/em> your systems, respecting your security boundaries, using tools you define. You just learned how to build that future.<\/p>\n\n\n\n<p>Now go build something amazing. \ud83d\ude80<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faqs-on-model-context-protocol\">FAQs on Model Context Protocol<\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1767909734490\"><strong class=\"schema-faq-question\">What&#8217;s the difference between MCP and function calling?<\/strong> <p class=\"schema-faq-answer\">Great question! Function calling (like OpenAI&#8217;s tool use) happens <strong>in the cloud<\/strong>\u2014you send function definitions with each API request, and the model returns structured calls you execute server-side.<br\/>MCP flips this. Your <strong>server runs locally<\/strong>, exposing tools that AI agents discover and call directly. The AI never sees your implementation details or credentials. Think of function calling as &#8220;here&#8217;s what you <em>could<\/em> do&#8221; versus MCP as &#8220;here&#8217;s what you <em>can actually access<\/em>.&#8221;<br\/><strong>Real-world impact:<\/strong> With MCP, Claude Desktop can query your local PostgreSQL database without your credentials ever touching Anthropic&#8217;s servers. That&#8217;s impossible with traditional function calling.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1767909748661\"><strong class=\"schema-faq-question\">Do I need to keep my MCP server running 24\/7?<\/strong> <p class=\"schema-faq-answer\">Nope! MCP servers are <strong>ephemeral by design<\/strong>.<br\/><strong>Claude Desktop:<\/strong> Starts your server when you open a chat, stops it when you close<br\/><strong>API usage:<\/strong> You control the lifecycle\u2014start server, send requests, shut down<br\/><strong>No daemon required:<\/strong> Unlike web servers, MCP servers don&#8217;t listen on ports<br\/>This is actually a security feature. Your database connection credentials only exist in memory while the server runs, then disappear.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1767909825572\"><strong class=\"schema-faq-question\">How is MCP different from LangChain or AutoGPT?<\/strong> <p class=\"schema-faq-answer\"><strong>MCP is a protocol, not a framework.<\/strong><br\/><strong>LangChain\/AutoGPT:<\/strong> Full frameworks with agents, memory, chains, and orchestration logic<br\/><strong>MCP:<\/strong> A standardized way for AI agents to discover and call tools<br\/>Think of it this way:<br\/><strong>MCP = USB-C<\/strong> (the connection standard)<br\/><strong>LangChain = The entire laptop<\/strong> (includes USB-C ports plus everything else)<br\/>You can absolutely <strong>use MCP within LangChain<\/strong>! Build an MCP server with your tools, then create a LangChain agent that calls those tools. Best of both worlds\u2014LangChain&#8217;s orchestration + MCP&#8217;s standardized tool interface.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Model Context Protocol (MCP) is Anthropic&#8217;s open standard that lets AI agents securely access your tools, databases, and APIs. Think of it as USB-C for AI\u2014one universal protocol connecting language models to everything they need to actually get work done in your environment.<\/p>\n","protected":false},"author":1,"featured_media":59352,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11],"tags":[3472],"class_list":{"0":"post-58926","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-development","8":"tag-ai","9":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Model Context Protocol For Beginners: Superpower of AI Agents - CodeSamplez.com<\/title>\n<meta name=\"description\" content=\"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Model Context Protocol For Beginners: Superpower of AI Agents\" \/>\n<meta property=\"og:description\" content=\"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners\" \/>\n<meta property=\"og:site_name\" content=\"CodeSamplez.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codesamplez\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ranacseruet\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-08T22:19:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-08T22:20:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1086\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Rana Ahsan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ranacseruet\" \/>\n<meta name=\"twitter:site\" content=\"@codesamplez\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rana Ahsan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners\"},\"author\":{\"name\":\"Rana Ahsan\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#\\\/schema\\\/person\\\/a82c3c07205f4bb73d6b3b0906bc328b\"},\"headline\":\"Model Context Protocol For Beginners: Superpower of AI Agents\",\"datePublished\":\"2026-01-08T22:19:59+00:00\",\"dateModified\":\"2026-01-08T22:20:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners\"},\"wordCount\":1549,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/mcp-for-beginners-scaled.webp\",\"keywords\":[\"AI\"],\"articleSection\":[\"Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners\",\"url\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners\",\"name\":\"Model Context Protocol For Beginners: Superpower of AI Agents - CodeSamplez.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/mcp-for-beginners-scaled.webp\",\"datePublished\":\"2026-01-08T22:19:59+00:00\",\"dateModified\":\"2026-01-08T22:20:12+00:00\",\"description\":\"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909734490\"},{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909748661\"},{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909825572\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#primaryimage\",\"url\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/mcp-for-beginners-scaled.webp\",\"contentUrl\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/mcp-for-beginners-scaled.webp\",\"width\":2560,\"height\":1086,\"caption\":\"MCP For Beginners\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codesamplez.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Model Context Protocol For Beginners: Superpower of AI Agents\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#website\",\"url\":\"https:\\\/\\\/codesamplez.com\\\/\",\"name\":\"CODESAMPLEZ.COM\",\"description\":\"Programming And Development Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codesamplez.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#organization\",\"name\":\"codesamplez.com\",\"url\":\"https:\\\/\\\/codesamplez.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/cropped-favicon.webp\",\"contentUrl\":\"https:\\\/\\\/codesamplez.com\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/cropped-favicon.webp\",\"width\":512,\"height\":512,\"caption\":\"codesamplez.com\"},\"image\":{\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codesamplez\",\"https:\\\/\\\/x.com\\\/codesamplez\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/#\\\/schema\\\/person\\\/a82c3c07205f4bb73d6b3b0906bc328b\",\"name\":\"Rana Ahsan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g\",\"caption\":\"Rana Ahsan\"},\"description\":\"Rana Ahsan is a seasoned software engineer and technology leader specialized in distributed systems and software architecture. With a Master\u2019s in Software Engineering from Concordia University, his experience spans leading scalable architecture at Coursera and TopHat, contributing to open-source projects. This blog, CodeSamplez.com, showcases his passion for sharing practical insights on programming and distributed systems concepts and help educate others. Github | X | LinkedIn\",\"sameAs\":[\"https:\\\/\\\/github.com\\\/ranacseruet\",\"https:\\\/\\\/www.facebook.com\\\/ranacseruet\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/ranacseruet\\\/\",\"https:\\\/\\\/x.com\\\/ranacseruet\"],\"url\":\"https:\\\/\\\/codesamplez.com\\\/author\\\/admin\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909734490\",\"position\":1,\"url\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909734490\",\"name\":\"What's the difference between MCP and function calling?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Great question! Function calling (like OpenAI's tool use) happens <strong>in the cloud<\\\/strong>\u2014you send function definitions with each API request, and the model returns structured calls you execute server-side.<br\\\/>MCP flips this. Your <strong>server runs locally<\\\/strong>, exposing tools that AI agents discover and call directly. The AI never sees your implementation details or credentials. Think of function calling as \\\"here's what you <em>could<\\\/em> do\\\" versus MCP as \\\"here's what you <em>can actually access<\\\/em>.\\\"<br\\\/><strong>Real-world impact:<\\\/strong> With MCP, Claude Desktop can query your local PostgreSQL database without your credentials ever touching Anthropic's servers. That's impossible with traditional function calling.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909748661\",\"position\":2,\"url\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909748661\",\"name\":\"Do I need to keep my MCP server running 24\\\/7?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Nope! MCP servers are <strong>ephemeral by design<\\\/strong>.<br\\\/><strong>Claude Desktop:<\\\/strong> Starts your server when you open a chat, stops it when you close<br\\\/><strong>API usage:<\\\/strong> You control the lifecycle\u2014start server, send requests, shut down<br\\\/><strong>No daemon required:<\\\/strong> Unlike web servers, MCP servers don't listen on ports<br\\\/>This is actually a security feature. Your database connection credentials only exist in memory while the server runs, then disappear.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909825572\",\"position\":3,\"url\":\"https:\\\/\\\/codesamplez.com\\\/development\\\/model-context-protocol-for-beginners#faq-question-1767909825572\",\"name\":\"How is MCP different from LangChain or AutoGPT?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<strong>MCP is a protocol, not a framework.<\\\/strong><br\\\/><strong>LangChain\\\/AutoGPT:<\\\/strong> Full frameworks with agents, memory, chains, and orchestration logic<br\\\/><strong>MCP:<\\\/strong> A standardized way for AI agents to discover and call tools<br\\\/>Think of it this way:<br\\\/><strong>MCP = USB-C<\\\/strong> (the connection standard)<br\\\/><strong>LangChain = The entire laptop<\\\/strong> (includes USB-C ports plus everything else)<br\\\/>You can absolutely <strong>use MCP within LangChain<\\\/strong>! Build an MCP server with your tools, then create a LangChain agent that calls those tools. Best of both worlds\u2014LangChain's orchestration + MCP's standardized tool interface.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Model Context Protocol For Beginners: Superpower of AI Agents - CodeSamplez.com","description":"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners","og_locale":"en_US","og_type":"article","og_title":"Model Context Protocol For Beginners: Superpower of AI Agents","og_description":"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.","og_url":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners","og_site_name":"CodeSamplez.com","article_publisher":"https:\/\/www.facebook.com\/codesamplez","article_author":"https:\/\/www.facebook.com\/ranacseruet","article_published_time":"2026-01-08T22:19:59+00:00","article_modified_time":"2026-01-08T22:20:12+00:00","og_image":[{"width":2560,"height":1086,"url":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","type":"image\/webp"}],"author":"Rana Ahsan","twitter_card":"summary_large_image","twitter_creator":"@ranacseruet","twitter_site":"@codesamplez","twitter_misc":{"Written by":"Rana Ahsan","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#article","isPartOf":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners"},"author":{"name":"Rana Ahsan","@id":"https:\/\/codesamplez.com\/#\/schema\/person\/a82c3c07205f4bb73d6b3b0906bc328b"},"headline":"Model Context Protocol For Beginners: Superpower of AI Agents","datePublished":"2026-01-08T22:19:59+00:00","dateModified":"2026-01-08T22:20:12+00:00","mainEntityOfPage":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners"},"wordCount":1549,"commentCount":0,"publisher":{"@id":"https:\/\/codesamplez.com\/#organization"},"image":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#primaryimage"},"thumbnailUrl":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","keywords":["AI"],"articleSection":["Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners","url":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners","name":"Model Context Protocol For Beginners: Superpower of AI Agents - CodeSamplez.com","isPartOf":{"@id":"https:\/\/codesamplez.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#primaryimage"},"image":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#primaryimage"},"thumbnailUrl":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","datePublished":"2026-01-08T22:19:59+00:00","dateModified":"2026-01-08T22:20:12+00:00","description":"Learn Model Context Protocol for beginners with hands-on examples. Build your first MCP server in 10 minutes. Connect AI agents to MCP tools.","breadcrumb":{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#breadcrumb"},"mainEntity":[{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909734490"},{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909748661"},{"@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909825572"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#primaryimage","url":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","contentUrl":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","width":2560,"height":1086,"caption":"MCP For Beginners"},{"@type":"BreadcrumbList","@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codesamplez.com\/"},{"@type":"ListItem","position":2,"name":"Model Context Protocol For Beginners: Superpower of AI Agents"}]},{"@type":"WebSite","@id":"https:\/\/codesamplez.com\/#website","url":"https:\/\/codesamplez.com\/","name":"CODESAMPLEZ.COM","description":"Programming And Development Resources","publisher":{"@id":"https:\/\/codesamplez.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codesamplez.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codesamplez.com\/#organization","name":"codesamplez.com","url":"https:\/\/codesamplez.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codesamplez.com\/#\/schema\/logo\/image\/","url":"https:\/\/codesamplez.com\/wp-content\/uploads\/2024\/10\/cropped-favicon.webp","contentUrl":"https:\/\/codesamplez.com\/wp-content\/uploads\/2024\/10\/cropped-favicon.webp","width":512,"height":512,"caption":"codesamplez.com"},"image":{"@id":"https:\/\/codesamplez.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codesamplez","https:\/\/x.com\/codesamplez"]},{"@type":"Person","@id":"https:\/\/codesamplez.com\/#\/schema\/person\/a82c3c07205f4bb73d6b3b0906bc328b","name":"Rana Ahsan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c7a4f88bcf4a55cd1483386318ebecf27359154275a0b355b0ea186676f9f7f?s=96&d=mm&r=g","caption":"Rana Ahsan"},"description":"Rana Ahsan is a seasoned software engineer and technology leader specialized in distributed systems and software architecture. With a Master\u2019s in Software Engineering from Concordia University, his experience spans leading scalable architecture at Coursera and TopHat, contributing to open-source projects. This blog, CodeSamplez.com, showcases his passion for sharing practical insights on programming and distributed systems concepts and help educate others. Github | X | LinkedIn","sameAs":["https:\/\/github.com\/ranacseruet","https:\/\/www.facebook.com\/ranacseruet","https:\/\/www.linkedin.com\/in\/ranacseruet\/","https:\/\/x.com\/ranacseruet"],"url":"https:\/\/codesamplez.com\/author\/admin"},{"@type":"Question","@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909734490","position":1,"url":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909734490","name":"What's the difference between MCP and function calling?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Great question! Function calling (like OpenAI's tool use) happens <strong>in the cloud<\/strong>\u2014you send function definitions with each API request, and the model returns structured calls you execute server-side.<br\/>MCP flips this. Your <strong>server runs locally<\/strong>, exposing tools that AI agents discover and call directly. The AI never sees your implementation details or credentials. Think of function calling as \"here's what you <em>could<\/em> do\" versus MCP as \"here's what you <em>can actually access<\/em>.\"<br\/><strong>Real-world impact:<\/strong> With MCP, Claude Desktop can query your local PostgreSQL database without your credentials ever touching Anthropic's servers. That's impossible with traditional function calling.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909748661","position":2,"url":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909748661","name":"Do I need to keep my MCP server running 24\/7?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Nope! MCP servers are <strong>ephemeral by design<\/strong>.<br\/><strong>Claude Desktop:<\/strong> Starts your server when you open a chat, stops it when you close<br\/><strong>API usage:<\/strong> You control the lifecycle\u2014start server, send requests, shut down<br\/><strong>No daemon required:<\/strong> Unlike web servers, MCP servers don't listen on ports<br\/>This is actually a security feature. Your database connection credentials only exist in memory while the server runs, then disappear.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909825572","position":3,"url":"https:\/\/codesamplez.com\/development\/model-context-protocol-for-beginners#faq-question-1767909825572","name":"How is MCP different from LangChain or AutoGPT?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"<strong>MCP is a protocol, not a framework.<\/strong><br\/><strong>LangChain\/AutoGPT:<\/strong> Full frameworks with agents, memory, chains, and orchestration logic<br\/><strong>MCP:<\/strong> A standardized way for AI agents to discover and call tools<br\/>Think of it this way:<br\/><strong>MCP = USB-C<\/strong> (the connection standard)<br\/><strong>LangChain = The entire laptop<\/strong> (includes USB-C ports plus everything else)<br\/>You can absolutely <strong>use MCP within LangChain<\/strong>! Build an MCP server with your tools, then create a LangChain agent that calls those tools. Best of both worlds\u2014LangChain's orchestration + MCP's standardized tool interface.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/codesamplez.com\/wp-content\/uploads\/2026\/01\/mcp-for-beginners-scaled.webp","jetpack_shortlink":"https:\/\/wp.me\/p1hHlI-fkq","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":59581,"url":"https:\/\/codesamplez.com\/productivity\/best-ai-coding-agents","url_meta":{"origin":58926,"position":0},"title":"Best AI Coding Agents in 2026: The Complete Beginner&#8217;s Guide","author":"Rana Ahsan","date":"February 18, 2026","format":false,"excerpt":"The best AI coding agents in 2026 don't just autocomplete your lines \u2014 they plan, execute, and debug entire features autonomously. Whether you're a weekend hacker or a seasoned engineer, this guide breaks down Google Antigravity, Claude Code, OpenAI Codex, OpenCode, and KiloCode so you can pick the right tool\u2026","rel":"","context":"In &quot;Productivity&quot;","block_context":{"text":"Productivity","link":"https:\/\/codesamplez.com\/category\/productivity"},"img":{"alt_text":"Best AI Coding Agents","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/best-ai-coding-agents.webp?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":59404,"url":"https:\/\/codesamplez.com\/development\/add-memory-to-ai-agent-python-tutorial","url_meta":{"origin":58926,"position":1},"title":"Add Memory to AI Agent: Python Tutorial for Beginners","author":"Rana Ahsan","date":"January 22, 2026","format":false,"excerpt":"Discover how to add memory to AI agent systems using pure Python\u2014no frameworks required. This hands-on tutorial walks you through building short-term conversation tracking and long-term persistent storage, transforming stateless chatbots into context-aware assistants that actually remember your conversations and preferences across sessions.","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/codesamplez.com\/category\/development"},"img":{"alt_text":"Add Memory To AI Agents","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/01\/add-memory-to-ai-agents.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/01\/add-memory-to-ai-agents.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/01\/add-memory-to-ai-agents.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/01\/add-memory-to-ai-agents.webp?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":59319,"url":"https:\/\/codesamplez.com\/development\/building-ai-agent-from-scratch","url_meta":{"origin":58926,"position":2},"title":"Building AI Agent From Scratch: Complete Tutorial","author":"Rana Ahsan","date":"December 17, 2025","format":false,"excerpt":"Ever wondered how AI agents like Siri actually work? This comprehensive guide teaches you building AI agent from scratch using Python, covering everything from LLM integration to tool implementation with real code examples.","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/codesamplez.com\/category\/development"},"img":{"alt_text":"Building AI Agent","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/12\/building-ai-agent.webp?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":57985,"url":"https:\/\/codesamplez.com\/productivity\/ai-coding-agent","url_meta":{"origin":58926,"position":3},"title":"AI Coding Assistant: VSCode + Cline OSS Setup Guide","author":"Rana Ahsan","date":"February 17, 2025","format":false,"excerpt":"Discover how to supercharge your coding skills with an AI Coding Agent in VSCode, powered by the free Cline OSS extension. Our casual, step-by-step guide reveals personal tips, shares real anecdotes, and offers practical advice, turning your everyday coding tasks into a fast and fun experience. Instantly level up now!","rel":"","context":"In &quot;Productivity&quot;","block_context":{"text":"Productivity","link":"https:\/\/codesamplez.com\/category\/productivity"},"img":{"alt_text":"AI Coding Assistant Agent","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2025\/02\/ai-coding-assistant-agent-scaled.webp?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":59765,"url":"https:\/\/codesamplez.com\/productivity\/local-ai-coding-agent","url_meta":{"origin":58926,"position":4},"title":"Local LLM for Coding: Free AI Coding Agent With Ollama + Claude","author":"Rana Ahsan","date":"March 11, 2026","format":false,"excerpt":"This guide walks you through setting up a fully private, local LLM for coding on your own hardware. From model selection and hardware planning to IDE integration with Ollama and Continue.dev, you'll build an AI coding stack where no code ever leaves your machine.","rel":"","context":"In &quot;Productivity&quot;","block_context":{"text":"Productivity","link":"https:\/\/codesamplez.com\/category\/productivity"},"img":{"alt_text":"Local Coding Agent","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/03\/local-coding-agent.webp?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":59460,"url":"https:\/\/codesamplez.com\/development\/building-rag-system-in-python","url_meta":{"origin":58926,"position":5},"title":"A step-by-step guide to building a simple RAG system in Python","author":"Rana Ahsan","date":"February 5, 2026","format":false,"excerpt":"Build a small, practical Retrieval-Augmented Generation (RAG) system in Python: chunk your docs, embed them, store vectors in Chroma, retrieve top matches, and have an LLM answer using only that context. Includes a runnable example and common pitfalls.","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/codesamplez.com\/category\/development"},"img":{"alt_text":"RAG Systems In Python","src":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/codesamplez.com\/wp-content\/uploads\/2026\/02\/rag-system-in-python.webp?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/posts\/58926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/comments?post=58926"}],"version-history":[{"count":12,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/posts\/58926\/revisions"}],"predecessor-version":[{"id":59363,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/posts\/58926\/revisions\/59363"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/media\/59352"}],"wp:attachment":[{"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/media?parent=58926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/categories?post=58926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codesamplez.com\/wp-json\/wp\/v2\/tags?post=58926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}