cd /news/developer-tools/mcp-protocol-guide-generative-ai-com… · home topics developer-tools article
[ARTICLE · art-95697] src=promptcube3.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

MCP protocol guide, Generative AI Community, how t

A developer built a Model Context Protocol (MCP) server to let Claude Desktop query a local SQLite database directly, eliminating the need to export CSVs for analysis. The server, written in TypeScript using the official MCP SDK and sqlite3, exposes a single 'query_db' tool and is configured via the Claude Desktop JSON config file. The guide provides step-by-step setup instructions, including installing Node.js v20.11.0, initializing the project, and wiring the server into Claude Desktop on macOS and Windows.

read5 min views1 publishedAug 13, 2026
MCP protocol guide, Generative AI Community, how t
Image: Promptcube3 (auto-discovered)

Claudeto Read Local SQLite Data

Most people treat Claude like a chat box. They copy-paste code, get a fix, and paste it back. It's tedious. The real power comes when the LLM can actually reach out and touch your data. That's where the Model Context Protocol (MCP) comes in. It's basically a standardized way to give Claude "skills" by letting it call tools on your local machine or a remote server.

I spent last Friday afternoon fighting with a local SQLite database and realized I was wasting ten minutes every hour exporting CSVs just so Claude could analyze my schema. I decided to build a small MCP server to stop the madness.

The architecture of an MCP server #

MCP works on a client-server model. Claude (the client) connects to an MCP server via stdio or HTTP. The server tells Claude, "Hey, I have these tools available," and Claude decides when to call them based on your prompt.

If you're using the Claude Desktop app, you configure these servers in a JSON file. The app spawns the server as a child process.

| Component | Role | Example |

| :--- | :--- | :--- |

| Client | The LLM Interface | Claude Desktop |

| Server | The Logic Provider | A Node.js or Python script |

| Transport | The Communication Pipe | stdio (standard input/output) |

| Tool | The Executable Action | query_database(sql)

|

Setting up the environment #

You'll need Node.js installed. I'm using v20.11.0. We'll use the official MCP SDK because writing the JSON-RPC layer by hand is a nightmare you don't want.

Run this in your terminal to start a fresh project:

mkdir claude-sqlite-mcp
cd claude-sqlite-mcp
npm init -y
npm install @modelcontextprotocol/sdk sqlite3
npm install -D typescript @types/node
npx tsc --init

Coding the SQLite tool #

Here is the actual implementation. This script creates a server that exposes one tool: query_db

. It takes a SQL string, runs it against a local file, and returns the result.

Create a file named index.ts

:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
import sqlite3 from "sqlite3";
import { promisify } from "util";

const db = new sqlite3.Database("./my_data.db");
const dbAll = promisify(db.all).bind(db);

const server = new Server({
  name: "sqlite-explorer",
  version: "1.0.0",
}, {
  capabilities: {
    tools: {},
  },
});

// Tell Claude what this server can actually do
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: "query_db",
    description: "Execute a read-only SQL query on the local SQLite database",
    inputSchema: {
      type: "object",
      properties: {
        sql: { type: "string", description: "The SQL query to run" },
      },
      required: ["sql"],
    },
  }],
}));

// Handle the actual tool execution
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name !== "query_db") {
    throw new Error("Tool not found");
  }

  const sql = request.params.arguments?.sql as string;
  
  try {
    const results = await dbAll(sql);
    return {
      content: [{ type: "text", text: JSON.stringify(results) }],
    };
  } catch (err: any) {
    return {
      content: [{ type: "text", text: `Error: ${err.message}` }],
    };
  }
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
}

main().catch(console.error);

Build it:

npx tsc

Wiring it into Claude Desktop #

This is where most people trip up. Claude doesn't just "find" your server. You have to tell it where the executable is.

Open your Claude Desktop config file.

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add your server configuration:

{
  "mcpServers": {
    "my-sqlite-server": {
      "command": "node",
      "args": ["/absolute/path/to/your/claude-sqlite-mcp/index.js"]
    }
  }
}

Restart Claude Desktop completely. If you see a small hammer icon in the input box, you've won.

Testing the connection #

Try asking Claude: "What are the first 5 rows in my users table?"

Claude will now:

  1. Recognize the intent.

  2. Call the query_db

tool with SELECT * FROM users LIMIT 5

.

  1. Receive the JSON response from your Node script.

  2. Formulate a natural language answer.

It's a far cry from the old way of manually exporting data.

Why this beats generic plugins #

The beauty of an MCP protocol guide is realizing that the "intelligence" isn't just in the model—it's in the context you provide. By building your own server, you aren't relying on some third-party company to build an integration for your specific database schema. You control the permissions. You control the data.

If you get stuck on the TypeScript types or the JSON-RPC handshake, looking through Resources can save you a few hours of debugging.

Refining the "skills" #

Once you have a basic connection, you can expand. I found that adding a list_tables

tool was essential because Claude doesn't know your schema by default. Without it, the LLM just guesses table names and throws errors.

Add this to your ListToolsRequestSchema

handler:

{
  name: "list_tables",
  description: "List all tables in the database to understand the schema",
  inputSchema: { type: "object", properties: {} }
}

And handle it in the CallToolRequestSchema

using SELECT name FROM sqlite_master WHERE type='table'

.

Scaling your workflow with a community #

Building these tools in a vacuum is slow. The wild part is how many people are already creating specialized MCP servers for everything from Jira API wrappers to local filesystem indexers. Instead of rewriting the wheel for every project, you can find pre-made configurations through Prompt Sharing to see how others structure their tool definitions to get better LLM reasoning.

Joining a Generative AI Community like PromptCube is basically a shortcut for this. Instead of guessing why your server is crashing on startup, you can find a dev who already solved that specific stdio

hang-up.

The real shift happens when you stop treating the AI as a consultant and start treating it as an operator with a set of tools. Once you move from "Tell me how to write this SQL" to "Analyze this data for me," your productivity doesn't just increase—it changes shape.

Next AWS Bedrock gives you three times more notice than Anthropic for →

a guide to making money with AI, with plenty of directly applicable cases.

All Replies (0) #

No replies yet — be the first!

── more in #developer-tools 4 stories · sorted by recency
── more on @claude 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/mcp-protocol-guide-g…] indexed:0 read:5min 2026-08-13 ·