Skip to content

Commit 5667275

Browse files
committed
doc: update README
Former-commit-id: 6ea7c02 Former-commit-id: 75faa073d025b1e9f9371e5078cdd2fbb0ccb218
1 parent 7ba9d91 commit 5667275

File tree

1 file changed

+108
-44
lines changed

1 file changed

+108
-44
lines changed

README.md

Lines changed: 108 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
<h3>A powerful multi-database server implementing the Model Context Protocol (MCP) to provide AI assistants with structured access to databases.</h3>
1313

1414
<div class="toc">
15-
<a href="#what-is-db-mcp-server">Overview</a> •
15+
<a href="#overview">Overview</a> •
1616
<a href="#core-concepts">Core Concepts</a> •
1717
<a href="#features">Features</a> •
18-
<a href="#quick-start">Quick Start</a> •
19-
<a href="#running-the-server">Running</a> •
18+
<a href="#supported-databases">Supported Databases</a> •
19+
<a href="#deployment-options">Deployment Options</a> •
2020
<a href="#configuration">Configuration</a> •
21-
<a href="#available-tools">Tools</a> •
21+
<a href="#available-tools">Available Tools</a> •
2222
<a href="#examples">Examples</a> •
2323
<a href="#troubleshooting">Troubleshooting</a> •
2424
<a href="#contributing">Contributing</a>
2525
</div>
2626

2727
</div>
2828

29-
## What is DB MCP Server?
29+
## Overview
3030

3131
The DB MCP Server provides a standardized way for AI models to interact with multiple databases simultaneously. Built on the [FreePeak/cortex](https://github.com/FreePeak/cortex) framework, it enables AI assistants to execute SQL queries, manage transactions, explore schemas, and analyze performance across different database systems through a unified interface.
3232

@@ -93,58 +93,42 @@ The server follows Clean Architecture principles with these layers:
9393
- **Unified Interface**: Consistent interaction patterns across different database types
9494
- **Connection Management**: Simple configuration for multiple database connections
9595

96-
## Currently Supported Databases
96+
## Supported Databases
9797

9898
| Database | Status | Features |
9999
| ---------- | ------------------------- | ------------------------------------------------------------ |
100100
| MySQL | ✅ Full Support | Queries, Transactions, Schema Analysis, Performance Insights |
101101
| PostgreSQL | ✅ Full Support (v9.6-17) | Queries, Transactions, Schema Analysis, Performance Insights |
102102
| TimescaleDB| ✅ Full Support | Hypertables, Time-Series Queries, Continuous Aggregates, Compression, Retention Policies |
103103

104-
## Quick Start
104+
## Deployment Options
105105

106-
### Using Docker
106+
The DB MCP Server can be deployed in multiple ways to suit different environments and integration needs:
107+
108+
### Docker Deployment
107109

108110
```bash
109111
# Pull the latest image
110112
docker pull freepeak/db-mcp-server:latest
111113

112-
# Run with environment variables
114+
# Run with mounted config file
113115
docker run -p 9092:9092 \
114116
-v $(pwd)/config.json:/app/my-config.json \
115117
-e TRANSPORT_MODE=sse \
116118
-e CONFIG_PATH=/app/my-config.json \
117119
freepeak/db-mcp-server
118120
```
119121

120-
> **Note**: We mount to `/app/my-config.json` because the container already has a file at `/app/config.json`.
121-
122-
### From Source
123-
124-
```bash
125-
# Clone the repository
126-
git clone https://github.com/FreePeak/db-mcp-server.git
127-
cd db-mcp-server
128-
129-
# Build the server
130-
make build
131-
132-
# Run the server in SSE mode
133-
./bin/server -t sse -c config.json
134-
```
135-
136-
## Running the Server
122+
> **Note**: Mount to `/app/my-config.json` as the container has a default file at `/app/config.json`.
137123
138-
The server supports multiple transport modes:
139-
140-
### STDIO Mode (for IDE integration)
124+
### STDIO Mode (IDE Integration)
141125

142126
```bash
143127
# Run the server in STDIO mode
144-
./server -t stdio -c config.json
128+
./bin/server -t stdio -c config.json
145129
```
146130

147-
For Cursor integration, add this to your `.cursor/mcp.json`:
131+
For Cursor IDE integration, add to `.cursor/mcp.json`:
148132

149133
```json
150134
{
@@ -160,18 +144,32 @@ For Cursor integration, add this to your `.cursor/mcp.json`:
160144
### SSE Mode (Server-Sent Events)
161145

162146
```bash
163-
# Run with default host (localhost) and port (9092)
164-
./server -t sse -c config.json
147+
# Default configuration (localhost:9092)
148+
./bin/server -t sse -c config.json
165149

166-
# Specify a custom host and port
167-
./server -t sse -host 0.0.0.0 -port 8080 -c config.json
150+
# Custom host and port
151+
./bin/server -t sse -host 0.0.0.0 -port 8080 -c config.json
168152
```
169153

170-
Connect your client to `http://localhost:9092/sse` for the event stream.
154+
Client connection endpoint: `http://localhost:9092/sse`
155+
156+
### Source Code Installation
157+
158+
```bash
159+
# Clone the repository
160+
git clone https://github.com/FreePeak/db-mcp-server.git
161+
cd db-mcp-server
162+
163+
# Build the server
164+
make build
165+
166+
# Run the server
167+
./bin/server -t sse -c config.json
168+
```
171169

172170
## Configuration
173171

174-
### Database Configuration
172+
### Database Configuration File
175173

176174
Create a `config.json` file with your database connections:
177175

@@ -208,19 +206,18 @@ Create a `config.json` file with your database connections:
208206
### Command-Line Options
209207

210208
```bash
211-
make build
212-
# Basic options
209+
# Basic syntax
213210
./bin/server -t <transport> -c <config-file>
214211

215-
# For SSE transport, additional options:
212+
# SSE transport options
216213
./bin/server -t sse -host <hostname> -port <port> -c <config-file>
217214

218-
# Direct database configuration:
215+
# Inline database configuration
219216
./bin/server -t stdio -db-config '{"connections":[...]}'
220217

221-
# Environment variable configuration:
218+
# Environment variable configuration
222219
export DB_CONFIG='{"connections":[...]}'
223-
./server -t stdio
220+
./bin/server -t stdio
224221
```
225222

226223
## Available Tools
@@ -268,4 +265,71 @@ For detailed documentation on TimescaleDB tools, see [TIMESCALEDB_TOOLS.md](docs
268265

269266
### Querying Multiple Databases
270267

271-
```
268+
```sql
269+
-- Query the first database
270+
query_mysql1("SELECT * FROM users LIMIT 10")
271+
272+
-- Query the second database in the same context
273+
query_postgres1("SELECT * FROM products WHERE price > 100")
274+
```
275+
276+
### Managing Transactions
277+
278+
```sql
279+
-- Start a transaction
280+
transaction_mysql1("BEGIN")
281+
282+
-- Execute statements within the transaction
283+
execute_mysql1("INSERT INTO orders (customer_id, product_id) VALUES (1, 2)")
284+
execute_mysql1("UPDATE inventory SET stock = stock - 1 WHERE product_id = 2")
285+
286+
-- Commit or rollback
287+
transaction_mysql1("COMMIT")
288+
-- OR
289+
transaction_mysql1("ROLLBACK")
290+
```
291+
292+
### Exploring Database Schema
293+
294+
```sql
295+
-- Get all tables in the database
296+
schema_mysql1("tables")
297+
298+
-- Get columns for a specific table
299+
schema_mysql1("columns", "users")
300+
301+
-- Get constraints
302+
schema_mysql1("constraints", "orders")
303+
```
304+
305+
## Troubleshooting
306+
307+
### Common Issues
308+
309+
- **Connection Failures**: Verify network connectivity and database credentials
310+
- **Permission Errors**: Ensure the database user has appropriate permissions
311+
- **Timeout Issues**: Check the `query_timeout` setting in your configuration
312+
313+
### Logs
314+
315+
Enable verbose logging for troubleshooting:
316+
317+
```bash
318+
./bin/server -t sse -c config.json -v
319+
```
320+
321+
## Contributing
322+
323+
We welcome contributions to the DB MCP Server project! To contribute:
324+
325+
1. Fork the repository
326+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
327+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
328+
4. Push to the branch (`git push origin feature/amazing-feature`)
329+
5. Open a Pull Request
330+
331+
Please see our [CONTRIBUTING.md](docs/CONTRIBUTING.md) file for detailed guidelines.
332+
333+
## License
334+
335+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)