MCP ExplorerExplorer

Model Context Protocol Demo

@Resources-cskworkon 3 days ago
0 MIT
FreeCommunity
AI Systems

Overview

What is Model Context Protocol Demo

The Model Context Protocol (MCP) is a framework designed to facilitate communication between various applications and data sources, specifically focusing on integrating with SQLite databases. It streamlines the use of data models in applications, enabling easy access and manipulation of contextual information.

Use cases

MCP can be applied in various scenarios such as building intelligent applications that require data from SQLite databases, enhancing chatbots with database querying capabilities, or integrating machine learning models that use real-time data to improve user interactions. It’s especially useful in environments where data-driven decisions are crucial.

How to use

To utilize MCP, users must first install the required prerequisites, including the uv library and SQLite. Next, they set up an SQLite database and configure Claude Desktop to recognize the MCP server by editing the configuration files. After restarting Claude Desktop, users can interact with the model context protocol through input queries to retrieve and manipulate data from their databases.

Key features

Key features of MCP include seamless integration with SQLite databases, the ability to handle multiple data types, and support for dynamic querying in conversational interfaces. It promotes modularity and reusability of code, making it easier to build applications that require consistent context handling across different platforms.

Where to use

MCP is particularly beneficial in software development projects that involve data storage and retrieval, such as e-commerce applications, customer relationship management systems, or any software that requires intelligence and context-aware features. It can be deployed on various platforms and is compatible with both Windows and macOS environments.

Content

Model Context Protocol Demo

This is a demo project showcasing the Model Context Protocol (MCP) with a SQLite database integration.

Prerequisites

  • macOS or Windows
  • The latest version of Claude Desktop installed
  • uv 0.4.18 or higher (uv --version to check)
  • Git (git --version to check)
  • SQLite (sqlite3 --version to check)

Installing prerequisites (Windows)

# Using winget
winget install --id=astral-sh.uv -e
winget install git.git sqlite.sqlite

# Or download directly:
# uv: https://docs.astral.sh/uv/
# Git: https://git-scm.com
# SQLite: https://www.sqlite.org/download.html

Installing prerequisites (macOS)

# Using Homebrew
brew install uv git sqlite3

Setup

  1. Install prerequisites:

    pip install uv
    uv pip install -r requirements.txt
    
  2. Create the SQLite database:

    python create_db.py
    
  3. Configure Claude Desktop:

    • Open %APPDATA%\Claude\claude_desktop_config.json
    • Add the following configuration:

    db

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "FULL_PATH_TO_YOUR_test.db"
      ]
    }
  }
}

Replace FULL_PATH_TO_YOUR_test.db with the actual path to your test.db file.

desktop

{
  "mcpServers": {
    "filesystem": {
      "command": "C:\\Program Files\\nodejs\\node.exe",
      "args": [
        "D:\\Projects\\model-context-protocol-demo\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
        "C:/test/"
      ],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}
  1. Restart Claude Desktop

Testing

  1. Open Claude Desktop
  2. Click the 🔌 icon next to the chat box
  3. Expand “Installed MCP Servers” to verify the SQLite server is listed
  4. Try asking Claude: “Can you connect to my SQLite database and tell me what products are available, and their prices?”

Database Schema

The database contains a products table with the following structure:

  • id: INTEGER PRIMARY KEY
  • name: TEXT
  • price: REAL

Sample data includes various tech products with their prices.

Tools

No tools

Comments