
AnyDB MCP Server
Enables natural language database operations and semantic document search through SQLite and vector database integration. Converts plain English instructions into SQL queries and provides RAG capabilities for uploaded documents.
README
AnyDB MCP Server
A Model Context Protocol (MCP) server that provides intelligent database operations through natural language processing. This server integrates SQLite databases with Ollama for AI-powered SQL generation and execution.
Features
Core Database Operations
- Natural Language to SQL: Convert plain English instructions into SQL queries using Ollama
- Universal Database Operations: Works with any SQLite table/entity without predefined schemas
- MCP Integration: Seamlessly integrates with Claude Desktop and other MCP-compatible clients
- Async Operations: Built on modern Python async/await for high performance
- Safety First: Separate tools for read and write operations
Vector Database & RAG (NEW!)
- File Embedding: Automatically convert files into vector embeddings for semantic search
- Semantic Search: Find relevant content using natural language queries instead of exact keyword matching
- RAG Support: Enable Claude Desktop to answer questions about uploaded documents with context
- Smart Chunking: Intelligently splits large documents into overlapping chunks for better retrieval
- Persistent Storage: ChromaDB-powered vector database with automatic embedding generation
Available Tools
Database Tools
1. query_entity
Query any table with natural language instructions.
Parameters:
entity_name
(required): Name of the table to queryinstruction
(optional): Natural language query instruction (default: "SELECT all records")
Example: Query users table for active accounts
2. insert_entity
Insert records into any table using natural language descriptions.
Parameters:
entity_name
(required): Name of the tabledata
(required): Data to insert (JSON or natural description)
Example: Insert a new user with email and name
3. update_entity
Update records in any table with conditions.
Parameters:
entity_name
(required): Name of the tableinstruction
(required): Update instructionconditions
(optional): WHERE conditions
Example: Update user status to active where email matches
4. delete_entity
Delete records from any table with optional conditions.
Parameters:
entity_name
(required): Name of the tableconditions
(optional): WHERE conditions for deletion
Example: Delete inactive users older than 30 days
5. create_table
Create new tables with AI-generated schemas.
Parameters:
entity_name
(required): Name of the new tableschema_description
(required): Description of table schema
Example: Create a products table with name, price, and category
6. sql_query
Execute raw SQL SELECT queries directly.
Parameters:
query
(required): SQL query to execute
Example: Direct SQL for complex joins and analytics
7. sql_execute
Execute raw SQL modification queries (INSERT, UPDATE, DELETE, CREATE, etc.).
Parameters:
query
(required): SQL query to execute
Example: Direct SQL for complex data modifications
Vector Database Tools (NEW!)
8. add_file_to_vector_db
Add a file to the vector database for semantic search and RAG (Retrieval Augmented Generation).
Parameters:
filename
(required): Name of the filecontent
(required): Content of the file (text)metadata
(optional): Optional metadata for the file
Example: Add a document about machine learning for later semantic search
9. search_vector_db
Search the vector database for relevant file content using semantic similarity.
Parameters:
query
(required): Search query for semantic similaritymax_results
(optional): Maximum number of results to return (default: 5)
Example: Find documents related to "neural networks and AI"
10. list_vector_files
List all files stored in the vector database.
Parameters: None
Example: View all documents available for search
11. remove_file_from_vector_db
Remove a file from the vector database.
Parameters:
filename
(required): Name of the file to remove
Example: Delete outdated documents from the knowledge base
Installation
Prerequisites
- Python 3.8+
- Ollama running locally
- Claude Desktop (for MCP integration)
Setup
- Clone the repository:
git clone https://github.com/iamayuppie/AnyDbApp.git
cd AnyDbApp
- Install dependencies:
pip install -r requirements.txt
- Start Ollama:
ollama serve --port 1434
ollama pull llama3.1 # or your preferred model
- Run the server:
python main.py
Claude Desktop Integration
Add this server to Claude Desktop by editing your config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"anydb": {
"command": "python",
"args": ["C:\\Path\\To\\AnyDbApp\\mcp_server_stdio.py"],
"env": {
"PYTHONPATH": "C:\\Path\\To\\AnyDbApp"
}
}
}
}
Restart Claude Desktop to connect the server.
Configuration
Ollama Settings
Default configuration in mcp_server.py
:
- Host: localhost
- Port: 1434
- Model: llama3.1
Database Settings
- Default DB:
anydb.sqlite
(created automatically) - Location: Same directory as the server
- Type: SQLite with foreign key constraints enabled
Usage Examples
Once integrated with Claude Desktop, you can use natural language:
Database Operations
- "Create a users table with id, name, email, and created_at fields"
- "Show me all active users from the last 30 days"
- "Insert a new product: iPhone 15, price $999, category Electronics"
- "Update all pending orders to processed where amount > 100"
- "Delete test users where email contains 'test'"
Vector Database & File Operations
- "Add this document to the knowledge base" (when attaching a file in Claude Desktop)
- "Search for information about machine learning algorithms"
- "Find documents related to user authentication and security"
- "What does the uploaded contract say about payment terms?"
- "Show me all documents I've added to the database"
- "Remove the old privacy policy document"
Architecture
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Claude │────│ MCP Server │────│ Ollama │
│ Desktop │ │ (stdio) │ │ (localhost) │
│ + File Upload │ │ │ │ │
└─────────────────┘ └──────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ Dual Storage │
│ │
│ ┌──────────────┐ │
│ │ SQLite │ │ ← Structured Data
│ │ Database │ │
│ └──────────────┘ │
│ │
│ ┌──────────────┐ │
│ │ ChromaDB │ │ ← Document Embeddings
│ │ Vector Store │ │ & Semantic Search
│ └──────────────┘ │
└──────────────────┘
Development
Project Structure
AnyDbApp/
├── main.py # Clean entry point with startup info
├── mcp_server.py # MCP server setup and tool routing
├── dbtool.py # Database operations and SQL tools
├── filetool.py # Vector database and file operations
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata
└── README.md # This file
Key Components
Core Modules:
- main.py: Entry point with dependency checking and startup information
- mcp_server.py: MCP protocol implementation, tool registration, and request routing
- dbtool.py: Database operations, SQL generation, and data management
- filetool.py: Vector database operations, file processing, and semantic search
Business Logic Classes:
- DatabaseManager: Handles async SQLite operations and database connections
- DatabaseTools: High-level database operations with natural language support
- OllamaClient: Manages AI model communication for SQL generation
- VectorDatabaseManager: Manages ChromaDB operations and document embeddings
- FileTools: High-level file operations and semantic search functionality
Troubleshooting
Common Issues
- Server won't start: Check if Ollama is running on port 1434
- No tools showing in Claude: Verify MCP config path and restart Claude Desktop
- SQL errors: Check table names and ensure proper natural language descriptions
- Ollama connection failed: Confirm Ollama model is installed and accessible
Debug Mode
Run with Python's verbose mode for detailed logs:
python -v main.py
License
This project is open source. See LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
For issues and questions:
- Check the troubleshooting section
- Review Ollama and MCP documentation
- Open an issue on the repository
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。