The Model Context Protocol (MCP) is a standard for organizing contextual data used by Large Language Models (LLMs). Instead of relying only on plain prompts, MCP structures key information — like user identity, goals, memory, and tools — so models can act more consistently across sessions, apps, and environments. This guide walks through running a sample MCP server built with FastMCP, backed by an SQLite database, and bridging it to your local Claude Desktop application using a local mcp-proxy. By the end, you'll have a remote MCP server exposing natural-language-powered database endpoints that Claude Desktop can query directly.
1. Get Started Right Away
The code for the MCP server and the sample SQLite database is available in this GitHub repository. To set up the server remotely, follow the steps below in your system terminal.
1. Deploy an Ubuntu server.
2. Clone the GitHub repository:
$ git clone https://github.com/vultr-marketing/code-samples.git
3. Navigate into the mcp_sqlite_sse directory:
$ cd code-samples/mcp/mcp_sqlite_sse
4. Create a .env file:
$ nano .env
5. Add the following variables to the file:
DB_PATH=sample.db
MCP_PORT=8080
READ_ONLY=true
-
DB_PATH: Path to your SQLite database file. -
MCP_PORT: Port used by the MCP server (not used in stdio mode, but good to define). -
READ_ONLY: Set to true to block insert/update/delete queries for safety.
Save and close the file.
6. Install dependencies:
$ pip3 install -r requirements.txt
7. Allow incoming connections to port 8080:
$ ufw allow 8080
8. Run the MCP server:
$ python3 server.py
2. Understand the Sample MCP Server
The server script launches a Model Context Protocol (MCP) server using FastMCP and connects it to a local SQLite database. It enables structured interaction with the database using natural language, typically via an LLM interface.
Transport Layer http with Server-Sent Events (SSE)
The server uses the http transport layer to communicate over standard web protocols, which is ideal for remote deployment on any cloud instance. It supports Server-Sent Events (SSE), a feature that enables real-time, streamed responses from the server to your local Claude Desktop app via mcp-proxy.
SSE is a core part of live interaction between Claude and your remote MCP server. It ensures that streamed responses (like query results or multi-step outputs) arrive smoothly and in real-time. This design allows Claude Desktop to interact with your database seamlessly, as if the server were running locally. The SSE implementation is lightweight and handled within the FastAPI-based backend exposed by FastMCP.
3. Use Claude Desktop to Interact
Download the Claude Desktop application. It automatically detects MCP servers defined in its configuration file and makes them accessible for use within any conversation.
1. Install the mcp-proxy dependency on your local system:
$ uv tool install mcp-proxy
2. Get the path to the installed dependency:
$ where mcp-proxy
Copy the path to be used later.
3. Start the Claude Desktop application.
4. Locate the settings option in the application.
5. Select Developer settings.
6. Click Edit Config.
7. Add the following configuration snippet to your Claude Desktop config file:
{
"mcpServers": {
"remote-fastmcp": {
"command": "<MCP_PROXY_PATH>",
"args": [
"http://<SERVER_IP>:8080/sse"
],
"env": {
"API_ACCESS_TOKEN": ""
}
}
}
}
8. Once the new configuration is in place, restart the Claude Desktop application.
9. To confirm the server is running, go to the Developer settings in Claude Desktop and check if the status next to the JSON file shows as running.
10. Confirm the MCP server tools are available to the application.
Ask Questions and Perform Operations
You can run interactive queries by chatting naturally. Using the available tools, the LLM translates your requests into SQL queries, executes them on the sample database, and responds in plain language.
The data returned is sample data used for demonstration purposes and may differ from actual data. The LLM also displays the database queries it is executing and the tools it is using to retrieve the data.
Next Steps
- Switch
READ_ONLYtofalseonce you're comfortable letting the LLM run write queries, and add stricter input validation first. - Front the MCP server with TLS and authentication before exposing it beyond local testing.
- Swap the SQLite backend for a networked database if multiple clients need concurrent access.
- Explore chaining additional MCP tools to build multi-step, multi-agent workflows.
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)