MCPSERV.CLUB
Patrick7241

Go Mcp Demo

MCP Server

Local LLM-powered SQL tool via MCP

Stale(55)
4stars
2views
Updated 27 days ago

About

A demo server that uses the MCP framework to let natural language queries run against a local MySQL database or read .sql files, powered by an Ollama-hosted large language model.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Go MCP Demo – A Practical Model Context Protocol Server

The Go MCP Demo demonstrates how an MCP server can act as a bridge between a local large‑language model (LLM) and external resources, in this case a MySQL database. By combining the mcp-go framework with Ollama, developers can turn natural‑language prompts into actionable database queries without writing any custom middleware. This solves the common pain point of integrating LLMs with existing data stores: the need for a secure, typed API that translates conversational commands into SQL and returns results in a structured form.

At its core, the server exposes two tools that an AI assistant can invoke:

  • – reads the contents of a specified file and returns it as plain text.
  • – accepts an arbitrary SQL statement, executes it against a configured MySQL instance, and streams the result set back to the client.

These tools are automatically registered when the MCP server starts, allowing any compliant AI client to discover and use them via the standard schema. The server itself runs on a local port () while the client component listens on another (). The LLM, hosted by Ollama (default ), performs all natural‑language understanding and instruction generation, delegating concrete actions to the MCP tools. This separation of concerns keeps the LLM lightweight and focused on language, while the MCP layer handles safety, type checking, and database connectivity.

Key features of this demo include:

  • Zero‑code integration – developers can point the server at any MySQL database and an SQL file, then simply send prompts to the LLM.
  • Secure execution – all database interactions are wrapped in the MCP protocol, ensuring that only pre‑approved tools can be called.
  • Extensibility – the same framework can host additional tools (e.g., file uploads, external API calls) with minimal effort.
  • Local deployment – both the LLM and MCP server run locally, eliminating latency and privacy concerns associated with cloud services.

Real‑world scenarios that benefit from this architecture are abundant. For example, a data analyst could ask the AI to “list all customers who made purchases in the last month” and receive a live query result without writing SQL. A developer could quickly prototype database‑driven features by simply describing the desired data operation in natural language. In a support environment, an AI bot could fetch configuration files or run diagnostic queries on demand, all while maintaining a consistent security posture.

In summary, the Go MCP Demo showcases how Model Context Protocol can turn an LLM into a powerful, secure tool‑driven assistant. By exposing typed resources and actions through MCP, developers gain a robust foundation for building conversational interfaces that interact safely with databases, files, and other external systems.