Connecting Your Own MCP Tools — How to Use Local Files and Databases with Claude and Cursor

Haram

@haram

MCP 나만의 도구 연결 — Claude와 Cursor에서 로컬 파일·DB 쓰는 법

Connecting Your Own MCP Tools — How to Use Local Files and Databases with Claude and Cursor

How convenient would it be if AI could directly read and analyze files on your computer? The Model Context Protocol (MCP) is the standard technology that connects your local data to AI with just a word, eliminating the hassle of copying and pasting code into a chat window. In this post, we’ll show you how to easily link your computer's folders and databases to Claude Desktop, Cursor, and Claude Code.

What is MCP? A 1-minute summary for beginners

Setting aside the technical jargon, let’s compare MCP to a 'power strip' in your room.

In the past, to connect an AI to your notepad, database, or internet search, you had to code complex, dedicated programs every single time. It was like having different types of wall outlets for every device, requiring a custom adapter for each one.

However, thanks to the standard specification led by Anthropic, all that hassle has vanished. Now, you just plug into the standard interface. The folders or programs on your computer can act as the eyes and ears of your AI, exchanging information as if you were having a real-time conversation.

Connecting Your Folders to AI: Filesystem Server Configuration

The first and most useful tool to try is the Filesystem server. By connecting this, your AI can directly read and write files within a folder you specify, completely eliminating the tedium of manual copy-pasting.

A quick safety note here: for security reasons, you should absolutely avoid connecting your entire drive (like your C: drive or root directory). Instead, create a dedicated folder for your work and set a physical boundary that limits the AI to accessing only that specific directory—it’s much safer.

To complete the setup, you need to add the following code to your configuration file. Note that macOS and Windows handle file paths slightly differently.

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/ai-workspace"
      ]
    }
  }
}

On macOS, you can use standard forward slashes (/) like /Users/username/ai-workspace. However, Windows users should note that paths use backslashes (\), so within the JSON config file, you must double them up like C:\\Users\\username\\ai-workspace to ensure the syntax is parsed correctly. Once you follow these simple rules, your AI is ready to freely analyze your local files.

Connecting Databases and Adding Real-time Search

Once you've connected your data folders, let's take it a step further. We can give the AI the ability to analyze databases or perform real-time web searches.

Let’s start by connecting SQLite, a lightweight and widely used local database. Once configured, the AI can understand your table structures and write SQL queries to analyze your data for you. Simply add this configuration to the mcpServers section of your config file.

json
{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sqlite",
        "/absolute/path/to/your/database.db"
      ]
    }
  }
}

Note: You must change the database path on the last line to the actual absolute path of the SQLite file on your computer for it to work correctly.

Adding a Brave Search server to explore the latest information is the icing on the cake. Once you get a Brave Search API key and add it to your configuration file, the AI can browse the web whenever it needs to provide up-to-date answers.

Important security tip: Never upload configuration files containing sensitive information, like API keys, to public repositories like GitHub. Make it a habit to store these files only on your local computer to keep your personal data and keys safe from leaks.

Connection Guide for Your Preferred Client

Now it's time to find out where to put those MCP settings. I've organized clear instructions for three popular AI tools. Choose the one that fits your workflow and apply it right away.

1. Claude Desktop

This is the most popular desktop app. Depending on your OS, open the claude_desktop_config.json file in a text editor like Notepad, and paste the JSON configuration you prepared earlier.

  • macOS path: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows path: %APPDATA%\Claude\claude_desktop_config.json

If you have trouble finding these folders, you can paste the paths directly into the 'Go to Folder' menu in Finder or the Windows Run dialog (Win + R) to go straight there.

2. Cursor

If you use the coding editor Cursor, there's no need to hunt for file paths. It offers a convenient interface that lets you finish setup with a few mouse clicks.

  1. Click the gear icon in the top right corner of the Cursor app to open the settings window.
  2. Features menu, look for MCP.
  3. + Add New MCP Server button, enter a name, and set the Type to command.
  4. Enter the command and arguments in the Command field, then save to connect instantly.

3. Claude Code

In Claude Code, a terminal-based dev tool, you can register a server with a single command line without editing files. Open your terminal and try running the following.

bash
claude mcp add <서버이름> -- <실행명령어> [인자값]

For example, if you want to connect a filesystem server, you can quickly add it by entering claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/folder.

Your own local AI agent, start small

Once you've finished the setup, it’s time to say hello. Start with simple questions like, "What files are in this folder?" or "Summarize the database table structure." You'll immediately experience the convenience of the AI reading and responding to your computer's actual data.

However, since you are connecting local tools, always double-check your security boundaries to ensure the AI doesn't access anything outside of your work folders. With the simple setup introduced today, you can start your own highly personalized, smart AI workflow right now!

No comments yet.