
小型企业MCP
小型企业的模型上下文协议服务器
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
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 directory -
analyze_document
: Process a specific document and extract its content/metadata -
query_business_data
: Natural language query interface for business data -
store_chat_history
: Record conversation history in the database -
create_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 structure -
doc://{document_id}
: Access to specific document content -
stats://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 reports -
analyze_data
: Template for analyzing business data patterns -
setup_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.
相关推荐
😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack
Reviews

user_SZGDeqW7
As a dedicated user of small-business-mcp by Joe Spencer, I can confidently say this tool has been indispensable for my small business. Its intuitive interface and comprehensive features have streamlined our operations, making our workflow more efficient. Whether you're managing finances, tracking sales, or organizing tasks, this application covers it all. Highly recommended for anyone looking to enhance their business productivity!

user_I2dBqcXV
Small-business-mcp by Joe-Spencer is a game-changer for small business owners. The application is user-friendly and incredibly efficient, helping streamline operations and manage tasks effortlessly. It's clear that a lot of thought and expertise went into its development. Highly recommend for anyone looking to boost productivity and organization in their small business!

user_uvgWRpe1
I've been using the small-business-mcp, created by Joe Spencer, for a few weeks now, and it has completely transformed how I operate my small business. The user-friendly interface and comprehensive features are incredibly helpful. Best tool for small businesses looking to streamline their operations! Highly recommend!

user_wKfQXU6V
As a loyal user of small-business-mcp, I can confidently say that this product has revolutionized my business operations. Joe Spencer has done an incredible job in creating a tool that is both intuitive and highly effective. The interface is user-friendly, and the features cater perfectly to small business needs, making management easier and more efficient. Highly recommended!

user_N2wQf9Ko
I've been using the small-business-mcp by Joe-Spencer and it's a fantastic tool for managing my small business. It simplifies complex processes and has increased my productivity. Highly recommend it for any small business owner looking for efficient management solutions!

user_iNDDHTQb
As a dedicated user of the small-business-mcp by Joe-Spencer, I can confidently say it's a game-changer for managing small business operations. The tool is user-friendly, efficient, and seamlessly integrates into our daily workflow. Its intuitive interface and comprehensive features have significantly streamlined our processes, saving us time and effort. Highly recommended for any small business owner!

user_JeBz87FJ
As a devoted user of the Small-Business-MCP by Joe Spencer, I can confidently say that this tool has significantly streamlined our business processes. It's intuitive and user-friendly, making it accessible for all team members. The efficiency and productivity in our small business have noticeably increased since adopting this application. Highly recommended!

user_f9qwr3rx
As a dedicated user of small-business-mcp by Joe-Spencer, I find it incredibly useful for managing and optimizing my business operations. The comprehensive features and user-friendly interface have simplified many of our processes, allowing us to focus more on growth and customer satisfaction. It's an essential tool for any small business owner looking to streamline their management activities effectively. Highly recommend!

user_YkJ3CVNH
As a loyal user of the small-business-mcp, I must say Joe-Spencer has done an incredible job. This tool has revolutionized the way I manage my small business operations. It's user-friendly, efficient, and has significantly improved our productivity. I highly recommend it to fellow entrepreneurs looking to streamline their processes.

user_5k88dU4m
As a dedicated user of the small-business-mcp, I can confidently say that Joe-Spencer has crafted a phenomenal product. It's incredibly user-friendly and has significantly streamlined our business processes. The seamless integration and comprehensive features have truly enhanced our efficiency and productivity. Highly recommend it to any small business looking for reliable and effective management solutions!

user_3MEw5QPx
As a dedicated user of small-business-mcp by Joe Spencer, I can confidently say this tool has transformed the way I manage my business operations. It's user-friendly, efficient, and incredibly reliable. The support from the creator is top-notch, and the continuous updates make it even better. Highly recommend for any small business owner!

user_uCASR1j2
As a devoted user of small-business-mcp, I must say it has transformed the way I manage my business operations. Created by Joe-Spencer, this resource is incredibly user-friendly and efficient, perfect for small businesses. Its seamless integration and powerful features help streamline my workflow, making everyday tasks a breeze. Highly recommended for any small business owner looking to enhance productivity!