测试 SingleStore 的 MCP 服务器

  • Model Context Protocol (MCP): Gained traction since 2024. SingleStore released an official MCP Server. MCP is an open standard to enable seamless interaction between LLMs and external tools/data sources. Introduced by Anthropic in 2024, it defines a structured way for LLMs to call functions, access APIs, and retrieve real-time data. It supports multiple model providers and tool hosts, promoting interoperability.
  • Create Environment:

    • For SingleStore test environment, follow instructions in a previous article to create a SingleStore Cloud account and create database tables. Need an API Key generated from Configuration > API Keys in the SingleStore web portal.
    • Set up a Python virtual environment using venv. Install the SingleStore MCP Server with pip install singlestore-mcp-server==0.1.3. Create a JSON file ~/.mcp.json with the server configuration.
  • Install MCPHost: Use the freely available tool MCPHost, a CLI application. Install Go (e.g., on Apple Mac with Homebrew: brew install go). Install MCPHost with go install github.com/mark3labs/mcphost@latest. By default, it creates mcphost in ~/go/bin.
  • Run MCPHost: Can work with different LLMs. Test with OpenAI by providing an OpenAI API Key (e.g., export OPENAI_API_KEY="<OpenAI API Key>"). Run MCPHost with ~/go/bin/mcphost -m openai:gpt-4o-mini. It shows loading and initialization information. Can enter various commands like /help, /tools, /servers, /history, and /quit. Complete set of SingleStore MCP Server commands on GitHub.
  • Example Queries: Tested MCP Server with different queries. E.g., asking about available database tables, calculating volatility for a stock symbol, counting rows in a table, and calculating grand total value using multiple tables. Results agreed with a previous article.
  • Security Considerations: Stored <username>, <password>, and <api-key> in plain text on a local machine for small-scale testing (using Free Shared Tier with non-sensitive data). SingleStore MCP Server is evolving with security improvements for production environments.
  • Summary: Saw how to install, configure, and run the SingleStore MCP Server using MCPHost. Launched with OpenAI model, but MCPHost also supports alternative providers and models.
阅读 9
0 条评论