Small Business MCP Server
Enables LLMs to interact with small business data systems through tools for document processing, data queries, and report generation, using MCP primitives for structured context.
README
Small Business MCP Server
A Model Context Protocol (MCP) server that connects language models with small business data systems. This server implements the MCP paradigm to create a structured, context-aware interface between LLMs and business information, providing tools for data manipulation, contextual resources, and interactive prompt templates.
MCP Primitives
This server implements all three core MCP primitives:
| Primitive | Control | Description | Implementation |
|---|---|---|---|
| Tools | Model-controlled | Functions for LLMs to take actions on data | Document processing, data queries |
| Resources | Application-controlled | Contextual data for LLM context | Business documents, database schema |
| Prompts | User-controlled | Interactive templates for common operations | Report generation, data analysis |
Features
-
Structured Model Context
- Exposes business data through MCP resources
- Provides contextual information to improve model reasoning
- Maintains consistent representation of business concepts
- Enables precise knowledge retrieval
-
AI-Powered Operations
- Model-controlled tools for data manipulation
- File content extraction and categorization
- Automated relationship mapping between entities
- Version-controlled document management
-
Interactive Business Intelligence
- Natural language querying of business data
- Templated prompts for common business tasks
- Customizable report generation
- Contextual analysis of business metrics
Requirements
- Python 3.8+
- PostgreSQL 12+
- Required Python packages:
mcp(Model Context Protocol SDK)psycopg2(PostgreSQL adapter)PyPDF2(PDF processing)Pillow(Image processing)python-magic(File type detection)langchain(NLP processing)
Installation
-
Clone the repository:
git clone https://github.com/yourusername/small-business-mcp.git cd small-business-mcp -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies:
pip install -r requirements.txt -
Set up PostgreSQL:
# Create database createdb small_business_db # Set environment variables export DB_HOST=localhost export DB_PORT=5432 export DB_NAME=small_business_db export DB_USER=your_username export DB_PASSWORD=your_password
Usage
The MCP server acts as a bridge between language models and your business systems, structured around the three core MCP primitives (tools, resources, and prompts). This architecture allows LLMs to:
- Retrieve contextual information about your business via resources
- Take actions on your business data via tools
- Leverage specialized templates for common tasks via prompts
Starting the Server
You can start the MCP server using either of these methods:
# Method 1: Direct Python execution
python -m MCPServer.server
# Method 2: Using MCP CLI
mcp run MCPServer/server/server.py
The server uses FastMCP to expose tools, resources, and prompts to LLMs.
Connecting with a Client
Connect to the server using the MCP client SDK:
import asyncio
from mcp import ClientSession, StdioServerParameters
async def main():
# Create server parameters for connecting to the MCP server
server_params = StdioServerParameters(
command="python",
args=["-m", "MCPServer.server"],
env=None, # Optional environment variables
)
async with ClientSession(server_params) as session:
# Initialize connection
await session.initialize()
# List available tools
tools = await session.list_tools()
print(f"Available tools: {[tool.name for tool in tools]}")
# Process a directory
result = await session.call_tool(
"process_business_directory",
arguments={"directory_path": "/path/to/business/files"}
)
print(f"Directory processing result: {result}")
# Query business data
query_result = await session.call_tool(
"query_business_data",
arguments={"query": "Show me all PDF documents from 2023"}
)
print(f"Query result: {query_result}")
if __name__ == "__main__":
asyncio.run(main())
Mounting to an Existing ASGI Server
You can integrate the MCP server with existing ASGI applications:
from starlette.applications import Starlette
from starlette.routing import Mount
from MCPServer.server.server import mcp # Import the FastMCP instance
# Mount the MCP server to an existing ASGI server
app = Starlette(
routes=[
Mount('/mcp', app=mcp.sse_app()),
]
)
Available MCP Primitives
MCP defines a structured way for LLMs to interact with external systems through three core primitives, each with a distinct control model and purpose. This server implements:
Tools
Models can use these tools to interact with business data:
process_business_directory: Import and organize files from a directoryanalyze_document: Process a specific document and extract its content/metadataquery_business_data: Natural language query interface for business datastore_chat_history: Record conversation history in the databasecreate_business_report: Generate reports based on stored data
Resources
Resources provide contextual information to LLMs, exposing data that helps models reason about business objects. Unlike tools, resources are passively accessed rather than executed:
schema://database: Database schema for reasoning about data structuredoc://{document_id}: Access to specific document contentstats://business: Business statistics and metrics
Prompts
Prompts are user-controlled templates that guide how LLMs approach specific tasks, providing a standardized way to frame common business operations:
generate_report: Template for creating various business reportsanalyze_data: Template for analyzing business data patternssetup_assistant: Template for configuring a business data assistant
Server Capabilities
The server declares these capabilities during initialization:
| Capability | Feature Flag | Description |
|---|---|---|
| tools | listChanged | Business data tools |
| resources | subscribelistChanged | Document and schema access |
| prompts | listChanged | Business report templates |
| logging | - | Server logging configuration |
| completion | - | Argument completion suggestions |
Security
- All database credentials and API keys are managed through environment variables
- File access is restricted to specified directories
- Data encryption for sensitive information
- Regular backup procedures
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。