Content
# ChatData MCP Server
The ChatData MCP Server is a service application based on the Model Control Protocol (MCP), providing a rich toolkit and prompt system to enhance the capabilities of large language models.
## Project Overview
This project offers a flexible server framework that allows interaction with large language models via the MCP protocol. The server can:
- Execute various tool functions to extend the model's capabilities
- Provide preset prompt templates to simplify common tasks
- Support communication via standard input/output or SSE
- Automatically discover and register newly added tools and prompts
## Core Components
### Tool System (`tools/`)
The tools module provides various functional extensions that enable the language model to perform specific tasks:
- **Network Tools**:
- `web_scraper.py` - Web content scraping tool
- `ip_info.py` - IP address information query tool
- `http_client.py` - HTTP request client
- `fetch.py` - Simple web fetching tool
- `browser_use.py` - Network information retrieval based on browser_use
- **Data Processing Tools**:
- `data_converter.py` - Data format conversion tool (JSON/YAML/XML)
- `text_summary.py` - Text summarization tool
- `calculator.py` - Advanced mathematical calculation tool
- **Development Utility Tools**:
- `code_formatter.py` - Code formatting tool
- `postgres.py` - PostgreSQL database query tool
- **Multimedia Tools**:
- `image_gen.py` - Image generation tool
- **Other Utility Tools**:
- `translator.py` - Text translation tool
- `weather.py` - Weather query tool
- `echo.py` - Simple echo tool
### Prompt System (`prompts/`)
The prompts module provides various preset prompt templates for quickly generating high-quality responses:
- `simple.py` - Basic prompt template
- `content_generator.py` - Content generation prompt
- `code_review.py` - Code review prompt
- `utils.py` - Prompt utility functions
### Server Component (`server/`)
The server module handles client requests and responses, supporting multiple communication methods:
- Standard input/output (stdio) mode
- Server-Sent Events (SSE) mode
## Installation and Usage
```
uv venv --python 3.12
```
### Install Dependencies
```bash
pip install -e .
```
Or use `uv`:
```bash
uv pip install -e .
```
Install playwright
```bash
playwright install
```
### Start the Server
#### stdio Mode (Default)
```bash
server
```
#### SSE Mode
```bash
server --transport sse --port 8000
```
## Development Guide
### Adding New Tools
1. Create a new Python file in the `tools/` directory
2. Implement a main function and a tool invocation function
3. Provide a `get_tools()` function to return tool definitions
Example:
```python
import mcp.types as types
async def my_function(param1, param2):
# Implement functionality
return [types.TextContent(type="text", text="Result")]
async def my_tool(name: str, arguments: dict):
if name != "my_tool":
raise ValueError(f"Unknown tool: {name}")
# Extract parameters
param1 = arguments.get("param1")
param2 = arguments.get("param2")
return await my_function(param1, param2)
def get_tools():
return [
types.Tool(
name="my_tool",
description="Tool description",
inputSchema={
"type": "object",
"required": ["param1"],
"properties": {
"param1": {
"type": "string",
"description": "Parameter 1 description",
},
"param2": {
"type": "string",
"description": "Parameter 2 description",
}
},
},
)
]
```
### Adding New Prompts
1. Create a new Python file in the `prompts/` directory
2. Implement a prompt generation function
3. Provide a `get_prompts()` function to return prompt definitions
Example:
```python
import mcp.types as types
from .utils import create_messages
def my_prompt(context=None, topic=None):
messages = create_messages(context, topic)
return types.GetPromptResult(
messages=messages,
description="Prompt description"
)
def get_prompts():
return [
types.Prompt(
name="my_prompt",
description="Prompt description",
func=my_prompt,
args={
"context": {
"type": "string",
"description": "Context information"
},
"topic": {
"type": "string",
"description": "Topic"
}
}
)
]
```
## License
MIT
Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
continue
Continue is an open-source project for seamless server management.
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
semantic-kernel
Build and deploy intelligent AI agents with Semantic Kernel's orchestration...