Skip to content

thiagocolen/mcp-server-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨ MCP Server Project ✨

Welcome to the mcp-server-project! 🚀

This project is a demonstration of a local server implementing the Model Context Protocol (MCP). It provides a simple todo server with a couple of tools that can be consumed by an MCP-compatible client, like the Gemini CLI.


🌟 Features

This server exposes two tools:

  • getFirstIncompleteTodo: Fetches a list of todos from JSONPlaceholder and returns the title of the first incomplete one. 📝
  • getFirstCompletedTodo: Fetches a list of todos from JSONPlaceholder and returns the title of the first completed one. ✅

🛠️ Prerequisites

Before you begin, ensure you have the following installed:


⚙️ Installation & Setup

  1. Navigate to the server directory:

    cd mcp-server
  2. Install dependencies:

    npm install
  3. Build the server:

    npm run build

    This will compile the TypeScript source files into JavaScript in the dist directory.


🔧 Configuration with Gemini CLI

To make the gemini-cli aware of this local MCP server, you need to register it.

  1. The mcp-server directory already contains a .mcp.json file that tells the CLI how to start the server:

    // mcp-server/.mcp.json
    {
      "mcpServers": {
        "todo-server": {
          "command": "npm",
          "args": ["run", "start"]
        }
      }
    }
  2. Now, you need to tell your Gemini CLI where to find this server. You can do this by editing the mcp.servers.json file in your Gemini configuration folder.

    This folder is typically located at:

    • Windows: C:\Users\<YourUser>\.gemini\
    • Linux/macOS: ~/.gemini/

    Create a file named mcp.servers.json in that directory if it doesn't already exist.

  3. Add the absolute path to the mcp-server directory inside the include array in mcp.servers.json.

    Example mcp.servers.json:

    {
      "include": [
        // Make sure to use the correct absolute path for your system!
        "D:\\_code-projects\\_Gemini-cli-test-folder\\mcp-server-project\\mcp-server"
      ]
    }

    ⚠️ Important: You must use an absolute path to the mcp-server folder. Relative paths may not work correctly.


🚀 Usage

Once the server is configured, you can start using the tools directly from the Gemini CLI! The CLI will automatically start the server in the background when you try to use one of its tools.

Example 1: Get the first incomplete todo

getFirstIncompleteTodo

Example 2: Get the first completed todo

getFirstCompletedTodo

And that's it! The Gemini CLI will connect to your local MCP server, execute the tool, and return the result. 🎉 Happy coding!

About

This project is a demonstration of a local server implementing the [Model Context Protocol (MCP)]

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors