{"id":5177,"date":"2025-05-19T01:37:55","date_gmt":"2025-05-18T20:07:55","guid":{"rendered":"https:\/\/itechgenie.com\/myblog\/?p=5177"},"modified":"2025-05-19T09:30:18","modified_gmt":"2025-05-19T04:00:18","slug":"enhancing-the-vs-code-agent-mode-to-integrate-with-local-tools-using-model-context-protocol-mcp","status":"publish","type":"post","link":"https:\/\/itechgenie.com\/myblog\/2025\/05\/enhancing-the-vs-code-agent-mode-to-integrate-with-local-tools-using-model-context-protocol-mcp\/","title":{"rendered":"Enhancing the VS Code Agent Mode to integrate with Local tools using Model Context Protocol (MCP)"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><h1>Building a Todo List Server with Model Context Protocol (MCP)<\/h1>\n<p><a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/GitHub-Repository-green.svg\" alt=\"GitHub Repository\"><\/a>\n<a href=\"https:\/\/nodejs.org\/\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/node-%3E%3D22.0.0-brightgreen.svg\" alt=\"Node Version\"><\/a>\n<a href=\"https:\/\/github.com\/microsoft\/modelcontextprotocol\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/MCP%20SDK-Latest-blue.svg\" alt=\"MCP SDK\"><\/a><\/p>\n<p>This blog post walks through creating a Todo List server using the Model Context Protocol (MCP), demonstrating how to build AI-friendly tools that integrate seamlessly with VS Code.<\/p>\n<blockquote>\n<p>\ud83d\udd17 <strong>Source Code<\/strong>: The complete implementation is available on <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\">GitHub<\/a><\/p>\n<\/blockquote>\n<h2>Table of Contents<\/h2>\n<ul>\n<li><a href=\"#the-evolution-of-ai-assisted-development\">The Evolution of AI-Assisted Development<\/a><\/li>\n<li><a href=\"#what-is-model-context-protocol-mcp\">What is Model Context Protocol (MCP)?<\/a><\/li>\n<li><a href=\"#architecture-overview\">Architecture Overview<\/a><\/li>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#setting-up-the-project\">Setting Up the Project<\/a><\/li>\n<li><a href=\"#implementing-the-mcp-server\">Implementing the MCP Server<\/a><\/li>\n<li><a href=\"#vs-code-integration\">VS Code Integration<\/a><\/li>\n<li><a href=\"#using-the-todo-mcp-server\">Using the Todo MCP Server<\/a><\/li>\n<li><a href=\"#next-steps-and-improvements\">Next Steps and Improvements<\/a><\/li>\n<li><a href=\"#troubleshooting\">Troubleshooting<\/a><\/li>\n<li><a href=\"#resources\">Resources<\/a><\/li>\n<\/ul>\n<h2>The Evolution of AI-Assisted Development<\/h2>\n<p>I have been using VS Code with GitHub Copilot for development purposes. The introduction of text-based chat, which brought GPT capabilities directly into the IDE, was revolutionary.<\/p>\n<h3>GitHub Copilot and the Local Tools Gap<\/h3>\n<p>GitHub Copilot has revolutionized how developers write code by providing intelligent code suggestions and completions. While it excels at understanding code context and generating relevant snippets, there has been a notable gap in its ability to interact with local development tools, intranet KBs, and execute actions in the development environment. This limitation means that while Copilot can suggest code, it cannot directly help with tasks like running commands, managing files, or interacting with local services.<\/p>\n<h3>Agent Mode: Bridging the Gap<\/h3>\n<p>The introduction of Agent Mode in GitHub Copilot represents a significant step forward in AI-assisted development. It enables Copilot to:<\/p>\n<ul>\n<li>Execute terminal commands<\/li>\n<li>Modify files directly<\/li>\n<li>Interact with the VS Code environment<\/li>\n<li>Handle project-specific tasks<\/li>\n<\/ul>\n<p>This advancement transformed Copilot from a passive code suggestion tool into an active development partner that can help manage your entire development workflow. Here are some powerful capabilities and example interactions:<\/p>\n<h4>1. Build and Test Automation<\/h4>\n<p>Trigger Maven builds with specific profiles:<\/p>\n<pre><code>&quot;Run mvn clean install with the 'production' profile for my project&quot;\n<\/code><\/pre>\n<p>Execute JUnit test suites:<\/p>\n<pre><code>&quot;Execute all JUnit tests in the UserServiceTest class&quot;\n<\/code><\/pre>\n<p>Run code quality tools:<\/p>\n<pre><code>&quot;Run ESLint on all JavaScript files in the src directory&quot;\n&quot;Start a local Sonar analysis with coverage and security scan&quot;\n<\/code><\/pre>\n<h4>2. Documentation and Release Management<\/h4>\n<p>Generate release documentation:<\/p>\n<pre><code>&quot;Generate release notes for changes between tag v1.2.0 and v1.3.0&quot;\n<\/code><\/pre>\n<p>Technical documentation:<\/p>\n<pre><code>&quot;Create a technical design document for the authentication service&quot;\n&quot;Update the API documentation in Confluence for the new endpoints&quot;\n<\/code><\/pre>\n<h4>3. Project Management Integration<\/h4>\n<p>JIRA ticket management:<\/p>\n<pre><code>&quot;Create a JIRA ticket for the memory leak bug we found in the login service&quot;\n&quot;Convert all TODO comments in AuthService.java to JIRA tickets&quot;\n<\/code><\/pre>\n<p>Sprint management:<\/p>\n<pre><code>&quot;Update the status of PROJ-123 to 'In Review' and add a comment with the PR link&quot;\n&quot;Show me all JIRA tickets assigned to me that are blocking the current sprint&quot;\n<\/code><\/pre>\n<h4>4. Cross-Repository Operations<\/h4>\n<p>Multi-repo analysis:<\/p>\n<pre><code>&quot;Check if the latest changes in the API repo are compatible with our client library&quot;\n&quot;Run integration tests across both the frontend and backend repositories&quot;\n<\/code><\/pre>\n<p>While these capabilities demonstrate the power of Agent Mode, they highlight a crucial challenge: the need for external API integrations. Each of these tasks requires:<\/p>\n<ul>\n<li>Authentication with external services (JIRA, Confluence, Sonar)<\/li>\n<li>Managing different API versions and endpoints<\/li>\n<li>Handling various authentication methods<\/li>\n<li>Maintaining connection states and sessions<\/li>\n<li>Coordinating operations across multiple systems<\/li>\n<\/ul>\n<p>This complexity creates significant overhead for developers who need to:<\/p>\n<ol>\n<li>Implement and maintain integration code for each service<\/li>\n<li>Handle authentication and authorization<\/li>\n<li>Manage API versioning and changes<\/li>\n<li>Deal with different response formats and error handling<\/li>\n<\/ol>\n<h3>MCP: The New Standard for AI Tool Integration<\/h3>\n<p>Model Context Protocol (MCP) emerges as the next evolution in this space, providing a standardized way for AI models to interact with development tools and services. Unlike traditional approaches where AI assistants are limited to suggesting code, MCP enables:<\/p>\n<ol>\n<li>\n<p><strong>Direct Tool Integration<\/strong><\/p>\n<ul>\n<li>AI models can directly invoke local tools<\/li>\n<li>Real-time interaction with development environment<\/li>\n<li>Standardized communication protocol<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Extensible Architecture<\/strong><\/p>\n<ul>\n<li>Custom tool definitions<\/li>\n<li>Plugin-based system<\/li>\n<li>Easy integration with existing services<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Development Environment Awareness<\/strong><\/p>\n<ul>\n<li>Context-aware assistance<\/li>\n<li>Access to local resources<\/li>\n<li>Real-time feedback loop<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>What is Model Context Protocol (MCP)?<\/h2>\n<p>Model Context Protocol (MCP) is a specification that enables AI models to interact with external tools and services in a standardized way. It defines how tools can expose their functionality through a structured interface that AI models can understand and use.<\/p>\n<p>Key benefits of MCP that I have personally benefited from:<\/p>\n<ul>\n<li>Standardized tool definitions with JSON Schema<\/li>\n<li>Real-time interaction capabilities<\/li>\n<li>Session management<\/li>\n<li>Built-in VS Code integration<\/li>\n<\/ul>\n<p><a href=\"https:\/\/modelcontextprotocol.io\">More about MCP Architecture Documentation<\/a><\/p>\n<h3>How MCP Tools Work<\/h3>\n<p>Each MCP tool follows a standardized structure:<\/p>\n<pre><code class=\"language-javascript\">{\n  name: &quot;toolName&quot;,\n  description: &quot;What the tool does&quot;,\n  parameters: {\n    \/\/ JSON Schema definition of inputs\n  },\n  returns: {\n    \/\/ JSON Schema definition of outputs\n  }\n}\n<\/code><\/pre>\n<p>When an AI model wants to use a tool:<\/p>\n<ol>\n<li>It sends a request with the tool name and parameters<\/li>\n<li>The MCP server validates the request<\/li>\n<li>The tool executes with the provided parameters<\/li>\n<li>Results are returned in a standardized format<\/li>\n<\/ol>\n<p>This structured approach ensures:<\/p>\n<ul>\n<li>Consistent tool behavior<\/li>\n<li>Type safety throughout the system<\/li>\n<li>Easy tool discovery and documentation<\/li>\n<li>Predictable error handling<\/li>\n<\/ul>\n<h2>Architecture Overview<\/h2>\n<p>Here\u2019s how the different components interact in our MCP Todo implementation:<\/p>\n<pre><code class=\"language-mermaid\">graph TD\n    A[GitHub Copilot] --&gt;|Natural Language Commands| B[VS Code]\n    B --&gt;|MCP Protocol| C[MCP Todo Server]\n    C --&gt;|CRUD Operations| D[(LowDB\/Database)]\n    C --&gt;|Real-time Updates| B\n    B --&gt;|Command Results| A\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/vscode-agents-mcp.png\" alt=\"TODO MCP Server Components\"><\/p>\n<h2>Prerequisites<\/h2>\n<p>To follow along, you\u2019ll need:<\/p>\n<ul>\n<li>Node.js (v22 or higher)<\/li>\n<li>VS Code<\/li>\n<li>Basic understanding of Express.js<\/li>\n<li>npm or yarn package manager<\/li>\n<\/ul>\n<h2>Setting Up the Project<\/h2>\n<ol>\n<li>First, create a new project and initialize npm:<\/li>\n<\/ol>\n<pre><code class=\"language-bash\">mkdir mcp-todo-server\ncd mcp-todo-server\nnpm init -y\n<\/code><\/pre>\n<ol start=\"2\">\n<li>Install required dependencies:<\/li>\n<\/ol>\n<pre><code class=\"language-bash\">npm install @modelcontextprotocol\/sdk express lowdb zod\n<\/code><\/pre>\n<p>For this demonstration, we\u2019re using lowdb to manage tasks in a JSON file without actual integration with an external system. In a production environment, the lowdb functions can be replaced with actual JIRA CRUD API calls for end-to-end implementation.<\/p>\n<ol start=\"3\">\n<li>Create the basic directory structure:<\/li>\n<\/ol>\n<pre><code>mcp-todo-server\/\n\u251c\u2500\u2500 src\/\n\u2502   \u251c\u2500\u2500 config\/\n\u2502   \u251c\u2500\u2500 tools\/\n\u2502   \u251c\u2500\u2500 utils\/\n\u2502   \u2514\u2500\u2500 server.js\n\u2514\u2500\u2500 package.json\n<\/code><\/pre>\n<h2>Implementing the MCP Server<\/h2>\n<h3>1. Basic Server Setup<\/h3>\n<p>We started with a basic Express server that implements the MCP protocol. The server uses StreamableHTTP for real-time communication and session management.<\/p>\n<p>Key components in <code>server.js<\/code>:<\/p>\n<ul>\n<li>Express server setup<\/li>\n<li>MCP SDK integration<\/li>\n<li>StreamableHTTP transport configuration<\/li>\n<li>Session management for maintaining tool state<\/li>\n<\/ul>\n<h3>2. Database Configuration<\/h3>\n<p>We used lowdb, a lightweight JSON database, to persist our todos. The database configuration in <code>config\/db.js<\/code> handles:<\/p>\n<ul>\n<li>JSON file storage<\/li>\n<li>Basic CRUD operations<\/li>\n<li>Data persistence between server restarts<\/li>\n<\/ul>\n<h3>3. Implementing Todo Tools<\/h3>\n<p>We implemented four main tools for managing todos:<\/p>\n<ol>\n<li>\n<p><strong>createTodo<\/strong><\/p>\n<ul>\n<li>Creates new todo items<\/li>\n<li>Validates input using Zod schema<\/li>\n<li>Returns the created todo with a unique ID<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>listTodos<\/strong><\/p>\n<ul>\n<li>Lists all todos or filters by completion status<\/li>\n<li>Formats output for easy reading<\/li>\n<li>Supports real-time updates<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>updateTodo<\/strong><\/p>\n<ul>\n<li>Updates todo completion status<\/li>\n<li>Validates input parameters<\/li>\n<li>Returns updated todo information<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>deleteTodo<\/strong><\/p>\n<ul>\n<li>Removes todos by ID<\/li>\n<li>Provides completion confirmation<\/li>\n<li>Handles error cases gracefully<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>VS Code Integration<\/h2>\n<p>To enable VS Code to use our MCP server, follow these steps:<\/p>\n<ol>\n<li>Enable Agent mode in VS Code. Click on the drop down just before the model listing and select agent from it.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1-enable-agents.png\" alt=\"Enable Agent Mode in VS Code\"><\/p>\n<ol start=\"2\">\n<li>Then click on the Gear icon next to the speaker icon in the above image and select \u201cAdd more tools\u201d then select \u201cAdd MCP Server\u201d<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/2-add-mcp-server.png\" alt=\"Add MCP Server\"><\/p>\n<ol start=\"3\">\n<li>Then select HTTP or Server-Sent Events and provide the URL based on the server we created. In this case, it\u2019s http:\/\/localhost:3000. Then select a name for the server.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/3-select-http.png\" alt=\"Select HTTP or Server-Sent events\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/5-provide-name.png\" alt=\"Provide name\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/6-user-settings.png\" alt=\"Select settings\"><\/p>\n<ol start=\"4\">\n<li>Alternatively you can Press <code>Ctrl+Shift+P<\/code> (Windows\/Linux) or <code>Cmd+Shift+P<\/code> (Mac) to open the Command Palette. Type \u201cOpen Settings (JSON)\u201d and select it and add the following configuration:<\/li>\n<\/ol>\n<pre><code class=\"language-json\">{\n    &quot;mcp&quot;: {\n        &quot;servers&quot;: {\n            &quot;my-mcp-server&quot;: {\n                &quot;url&quot;: &quot;http:\/\/localhost:3000\/mcp&quot;\n            }\n        }\n    }\n}\n<\/code><\/pre>\n<p>You can use the 4th step to verify if the server is added correctly after the first 3 steps are done. The User Settings option has Start, Stop, and Restart options. This step helped me identify if there are any issues with the MCP tools server effectively.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/8-settings.json_.png\" alt=\"Settings JSON\"><\/p>\n<ol start=\"5\">\n<li>\n<p>Reload VS Code to apply the changes or use the Start, Stop, Restart options in the settings.json as shown above.<\/p>\n<\/li>\n<li>\n<p>After successful addition of the MCP server, you should see the tools listed when you click the gear icon in the Copilot chat window.<\/p>\n<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/7-tools-listed.png\" alt=\"Tools listed successfully\"><\/p>\n<h2>Using the Todo MCP Server<\/h2>\n<p>Here are some example prompts you can use in VS Code with GitHub Copilot to interact with the todo server. Each example includes a screenshot of the actual interaction:<\/p>\n<ol>\n<li>\n<p><strong>Creating a Todo<\/strong><\/p>\n<pre><code>Prompt: &quot;Create a new todo item called 'Review PR #123'&quot;\nResponse: Successfully created todo &quot;Review PR #123&quot;\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1.1-request-todo.png\" alt=\"Creating a new todo\">\n<img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1.2-existing-list.png\" alt=\"Execute Add\">\n<img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1.3-create-success.png\" alt=\"Create TODO success\"><\/p>\n<\/li>\n<li>\n<p><strong>Listing Todos<\/strong><\/p>\n<pre><code>Prompt: &quot;Show me all my todos&quot;\nResponse: Here are your todos:\n- Review PR #123 (Not completed)\n- Update documentation (Completed)\n- Setup test environment (Not completed)\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1.4-list-todos.png\" alt=\"Listing all TODOs execute\">\n<img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/1.5-verify-todo.png\" alt=\"Listing all TODOs\">\n<img decoding=\"async\" src=\"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/todo-list-all.png\" alt=\"Listing all TODOs\"><\/p>\n<\/li>\n<li>\n<p><strong>Updating a Todo<\/strong><\/p>\n<pre><code>Prompt: &quot;Mark the todo about PR review as completed&quot;\nResponse: Updated &quot;Review PR #123&quot; to completed\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Deleting a Todo<\/strong><\/p>\n<pre><code>Prompt: &quot;Delete the todo about documentation&quot;\nResponse: Successfully deleted &quot;Update documentation&quot;\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Filtering Todos<\/strong><\/p>\n<pre><code>Prompt: &quot;Show me only completed todos&quot;\nResponse: Completed todos:\n- Review PR #123\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2>Next Steps and Improvements<\/h2>\n<p>Potential enhancements for the project:<\/p>\n<ol>\n<li>\n<p><strong>Authentication<\/strong><\/p>\n<ul>\n<li>Add user authentication<\/li>\n<li>Implement role-based access<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Advanced Features<\/strong><\/p>\n<ul>\n<li>Due dates for todos<\/li>\n<li>Categories\/tags<\/li>\n<li>Priority levels<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Performance<\/strong><\/p>\n<ul>\n<li>Caching<\/li>\n<li>Database optimization<\/li>\n<li>Rate limiting<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Testing<\/strong><\/p>\n<ul>\n<li>Unit tests<\/li>\n<li>Integration tests<\/li>\n<li>Load testing<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>Troubleshooting<\/h2>\n<h3>Common Issues and Solutions<\/h3>\n<ol>\n<li>\n<p><strong>Server Connection Issues<\/strong><\/p>\n<ul>\n<li>Verify the server is running on port 3000<\/li>\n<li>Check VS Code settings for correct server URL<\/li>\n<li>Ensure no firewall blocking the connection<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Tool Registration Problems<\/strong><\/p>\n<pre><code>Error: Tool 'createTodo' not found\nSolution: Check if server is properly initializing tools in server.js\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Schema Validation Errors<\/strong><\/p>\n<ul>\n<li>Ensure todo items match the required schema<\/li>\n<li>Check Zod validation rules in tool implementations<\/li>\n<li>Verify JSON payload format<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Real-time Updates Not Working<\/strong><\/p>\n<ul>\n<li>Confirm SSE (Server-Sent Events) connection is established<\/li>\n<li>Check browser console for connection errors<\/li>\n<li>Verify StreamableHTTP transport configuration<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>Source Code Reference<\/h3>\n<p>Key implementation files:<\/p>\n<ul>\n<li>Server setup: <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/server.js\"><code>src\/server.js<\/code><\/a><\/li>\n<li>Tool implementations:\n<ul>\n<li><a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/tools\/createTodo.js\"><code>src\/tools\/createTodo.js<\/code><\/a><\/li>\n<li><a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/tools\/updateTodo.js\"><code>src\/tools\/updateTodo.js<\/code><\/a><\/li>\n<li><a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/tools\/deleteTodo.js\"><code>src\/tools\/deleteTodo.js<\/code><\/a><\/li>\n<li><a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/tools\/listTodos.js\"><code>src\/tools\/listTodos.js<\/code><\/a><\/li>\n<\/ul>\n<\/li>\n<li>Database configuration: <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/src\/config\/db.js\"><code>src\/config\/db.js<\/code><\/a><\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>We\u2019ve successfully built a fully functional MCP-compatible Todo server that:<\/p>\n<ul>\n<li>Implements CRUD operations<\/li>\n<li>Maintains persistent storage<\/li>\n<li>Provides real-time updates<\/li>\n<li>Integrates seamlessly with VS Code<\/li>\n<\/ul>\n<p>This implementation serves as a great starting point for building more complex MCP tools and understanding how AI models can interact with custom tools through the Model Context Protocol.<\/p>\n<h2>Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/microsoft\/modelcontextprotocol\">MCP SDK Documentation<\/a><\/li>\n<li><a href=\"https:\/\/expressjs.com\/\">Express.js Documentation<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/colinhacks\/zod\">Zod Documentation<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/typicode\/lowdb\">LowDB Documentation<\/a><\/li>\n<\/ul>\n<h1>mcp-todo-server<\/h1>\n<p>This project is a simple MCP server that manages a todo list using the Model Context Protocol TypeScript SDK. It provides a RESTful API for creating, updating, and deleting todo items.<\/p>\n<h2>Project Structure<\/h2>\n<pre><code>mcp-todo-server\n\u251c\u2500\u2500 src\n\u2502   \u251c\u2500\u2500 resources\n\u2502   \u2502   \u2514\u2500\u2500 todos.js\n\u2502   \u251c\u2500\u2500 tools\n\u2502   \u2502   \u251c\u2500\u2500 createTodo.js\n\u2502   \u2502   \u251c\u2500\u2500 updateTodo.js\n\u2502   \u2502   \u2514\u2500\u2500 deleteTodo.js\n\u2502   \u251c\u2500\u2500 config\n\u2502   \u2502   \u2514\u2500\u2500 db.js\n\u2502   \u251c\u2500\u2500 utils\n\u2502   \u2502   \u2514\u2500\u2500 sessionManager.js\n\u2502   \u2514\u2500\u2500 server.js\n\u251c\u2500\u2500 db.json\n\u251c\u2500\u2500 package.json\n\u251c\u2500\u2500 .gitignore\n\u2514\u2500\u2500 README.md\n<\/code><\/pre>\n<h2>Installation<\/h2>\n<ol>\n<li>\n<p>Clone the repository:<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/github.com\/prakashm88\/mcp-todo-server.git\ncd mcp-todo-server\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Install the dependencies:<\/p>\n<pre><code class=\"language-bash\">npm install\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2>Usage<\/h2>\n<p>To start the server, run:<\/p>\n<pre><code class=\"language-bash\">npm start\n<\/code><\/pre>\n<p>The server will listen on port 3000.<\/p>\n<h2>API Endpoints<\/h2>\n<ul>\n<li><strong>POST \/mcp<\/strong>: Handles client-to-server communication for creating and managing todos.<\/li>\n<li><strong>GET \/mcp<\/strong>: Retrieves server-to-client notifications.<\/li>\n<li><strong>DELETE \/mcp<\/strong>: Terminates a session.<\/li>\n<\/ul>\n<h2>Database<\/h2>\n<p>The project uses <code>lowdb<\/code> to manage the todo items, stored in <code>db.json<\/code>.<\/p>\n<h2>Contributing<\/h2>\n<p>Contributions are welcome! Here\u2019s how you can help:<\/p>\n<ol>\n<li>Fork the repository<\/li>\n<li>Create a feature branch: <code>git checkout -b feature\/my-new-feature<\/code><\/li>\n<li>Commit your changes: <code>git commit -am 'Add new feature'<\/code><\/li>\n<li>Push to the branch: <code>git push origin feature\/my-new-feature<\/code><\/li>\n<li>Submit a pull request<\/li>\n<\/ol>\n<p>You can also:<\/p>\n<ul>\n<li>Report bugs by creating <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/issues\">issues<\/a><\/li>\n<li>Suggest improvements through <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/discussions\">discussions<\/a><\/li>\n<li>Help improve documentation<\/li>\n<\/ul>\n<p>Please read our <a href=\"https:\/\/github.com\/prakashm88\/mcp-todo-server\/blob\/main\/CONTRIBUTING.md\">Contributing Guidelines<\/a> for more details.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":5193,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"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":[115,5,16,9],"tags":[117,118,82,53,116],"class_list":["post-5177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","category-how-to","category-javascript-2","category-snippets","tag-agenticai","tag-mcp-server","tag-open-source","tag-tips-tricks","tag-vscode"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/itechgenie.com\/myblog\/wp-content\/uploads\/sites\/2\/2025\/05\/improving-vscode-using-agent-mode-1.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2HHtz-1lv","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/5177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/comments?post=5177"}],"version-history":[{"count":3,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/5177\/revisions"}],"predecessor-version":[{"id":5197,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/5177\/revisions\/5197"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/media\/5193"}],"wp:attachment":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/media?parent=5177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/categories?post=5177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/tags?post=5177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}