MCP cover image
See in Github
2025-04-11

通用MCP服务器操纵SQLITE

1

Github Watches

1

Github Forks

0

Github Stars

MCP SQLite Server

MCP SQLite Server is a Go-based MCP server implementation that wraps an SQLite database, allowing MCP clients (e.g., Claude Desktop) to interact with SQLite via a standardized JSON‑RPC protocol.

Features

  • MCP Compliance: Provides a JSON‑RPC based interface for tool execution according to the MCP specification.
  • SQLite Operations: Supports operations such as creating tables, describing table schemas, listing tables, and executing both read and write queries.

Requirements

  • Docker (recommended)

For local development:

  • Go 1.24 or later
  • SQLite (the database file will be created if it does not exist)
  • GCC and development tools (for CGO compilation)

Using with Docker (Recommended)

docker pull cnosuke/mcp-sqlite:latest

# Run with default SQLite database
docker run -i --rm cnosuke/mcp-sqlite:latest

# Run with a mounted SQLite database
docker run -i --rm -v /path/to/your/db:/app/sqlite.db cnosuke/mcp-sqlite:latest

Using with Claude Desktop (Docker)

To integrate with Claude Desktop using Docker, add an entry to your claude_desktop_config.json file:

{
  "mcpServers": {
    "sqlite": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "cnosuke/mcp-sqlite:latest"]
    }
  }
}

For persistent storage with a volume mount:

{
  "mcpServers": {
    "sqlite": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", "/path/to/your/db:/app/sqlite.db", "cnosuke/mcp-sqlite:latest"]
    }
  }
}

Building and Running (Go Binary)

Alternatively, you can build and run the Go binary directly:

# Build the server
make bin/mcp-sqlite

# Run the server
./bin/mcp-sqlite server --config=config.yml

Using with Claude Desktop (Go Binary)

To integrate with Claude Desktop using the Go binary, add an entry to your claude_desktop_config.json file:

{
  "mcpServers": {
    "sqlite": {
      "command": "./bin/mcp-sqlite",
      "args": ["server", "--config", "config.yml"],
      "env": {
        "LOG_PATH": "",
        "SQLITE_PATH": "/path/to/your/sqlite.db"
      }
    }
  }
}

This configuration registers the MCP SQLite Server with Claude Desktop. By setting LOG_PATH to an empty string, the server will only output fatal errors, ensuring that non-critical logs do not interfere with the MCP protocol messages transmitted over stdio.

Configuration

The server is configured via a YAML file (default: config.yml). For example:

log: 'mcp-sqlite.log'
debug: false

sqlite:
  path: './sqlite.db'

Configuration options can also be specified via environment variables:

  • LOG_PATH: Path to log file (empty string disables file logging)
  • DEBUG: Enable debug logging (true/false)
  • SQLITE_PATH: Path to SQLite database file

Logging

Logs are directed to the file specified by the log config option or LOG_PATH environment variable. When this value is empty, only fatal errors will be output to stderr and all other logs are suppressed.

Important: When using the MCP server with a stdio transport, logging must not be directed to standard output because it would interfere with the MCP protocol communication. For Claude Desktop usage, it's recommended to set LOG_PATH to an empty string.

Note for Docker: The Docker image disables file logging by default, as container logs are typically collected from stdout/stderr.

MCP Server Usage

MCP clients interact with the server by sending JSON‑RPC requests to execute various tools. The following MCP tools are supported:

  • create_table: Executes a CREATE TABLE statement.
  • describe_table: Retrieves schema details for a specific table.
  • list_tables: Returns a list of all tables in the SQLite database.
  • read_query: Executes SELECT queries and returns the result in JSON format.
  • write_query: Executes write queries (such as INSERT, UPDATE, or DELETE).

Command-Line Parameters

When starting the server, you can specify various settings:

./bin/mcp-sqlite server [options]

Options:

  • --config, -c: Path to the configuration file (default: "config.yml").

Contributing

Contributions are welcome! Please fork the repository and submit pull requests for improvements or bug fixes. For major changes, open an issue first to discuss your ideas.

License

This project is licensed under the MIT License.

Author: cnosuke ( x.com/cnosuke )

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • modelcontextprotocol
  • 模型上下文协议服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

    Reviews

    4 (1)
    Avatar
    user_RnPXUkNp
    2025-04-16

    As a dedicated user of mcp-sqlite, I am thoroughly impressed by this tool created by cnosuke. It simplifies database management with its intuitive interface and robust performance. The integration with existing systems is seamless, making it a valuable asset for developers. Highly recommended for anyone in need of an efficient and reliable SQLite management solution!