@@ -61,101 +61,13 @@ Options:
61
61
62
62
- ` MCP_PORT ` : Port to listen on (overrides -addr flag port)
63
63
64
- ### Examples
65
-
66
- ``` bash
67
- # Start server with custom database and port
68
- ./sqlite-mcp -db ./mydata.db -addr :9000
69
-
70
- # Start server in read-write mode
71
- ./sqlite-mcp -db ./mydata.db -read-write
72
-
73
- # Use environment variable for port
74
- MCP_PORT=8080 ./sqlite-mcp -db ./mydata.db
75
-
76
- # Read-only mode (default)
77
- ./sqlite-mcp -db ./mydata.db
78
- ```
79
-
80
64
## Development
81
65
82
66
### Prerequisites
83
67
84
68
- Go 1.21 or later
85
69
- SQLite database file
86
70
87
- ### Building
88
-
89
- ``` bash
90
- go build -o sqlite-mcp .
91
- ```
92
-
93
- ### Testing
94
-
95
- ``` bash
96
- # Run all tests
97
- go test ./...
98
-
99
- # Run tests with verbose output
100
- go test ./... -v
101
-
102
- # Run tests for specific package
103
- go test ./internal/database -v
104
- ```
105
-
106
- ### Linting
107
-
108
- ``` bash
109
- golangci-lint run
110
- ```
111
-
112
- ## Project Structure
113
-
114
- ```
115
- sqlite-mcp/
116
- ├── main.go # Entry point and server setup
117
- ├── internal/
118
- │ ├── database/ # Database connection and operations
119
- │ │ ├── db.go
120
- │ │ └── db_test.go
121
- │ ├── tools/ # MCP tools implementation
122
- │ │ ├── query.go
123
- │ │ └── query_test.go
124
- │ ├── resources/ # MCP resources implementation
125
- │ │ ├── schema.go
126
- │ │ └── schema_test.go
127
- │ └── testutil/ # Common test utilities
128
- │ └── testdb.go
129
- ├── testdata/ # Test data files
130
- ├── go.mod
131
- ├── go.sum
132
- └── README.md
133
- ```
134
-
135
- ## API Endpoints
136
-
137
- When running, the server exposes the following endpoints:
138
-
139
- - ` GET /mcp/sse ` : Server-Sent Events endpoint for MCP communication
140
- - ` POST /mcp/message ` : Message endpoint for sending MCP requests
141
-
142
- ## Security Considerations
143
-
144
- - ** Read-Only Mode** : By default, the server runs in read-only mode to prevent accidental data modification
145
- - ** Database Validation** : The server validates that the database file exists before starting
146
- - ** Input Validation** : All SQL queries and parameters are validated before execution
147
- - ** Error Handling** : Comprehensive error handling prevents information leakage
148
-
149
- ## Dependencies
150
-
151
- - [ mark3labs/mcp-go] ( https://github.com/mark3labs/mcp-go ) : MCP protocol implementation
152
- - [ mattn/go-sqlite3] ( https://github.com/mattn/go-sqlite3 ) : SQLite driver for Go
153
- - [ stretchr/testify] ( https://github.com/stretchr/testify ) : Testing toolkit
154
-
155
- ## License
156
-
157
- This project is part of the Stacklok ecosystem.
158
-
159
71
## Contributing
160
72
161
73
1 . Fork the repository
@@ -164,20 +76,3 @@ This project is part of the Stacklok ecosystem.
164
76
4 . Add tests for new functionality
165
77
5 . Run tests and linting
166
78
6 . Submit a pull request
167
-
168
- ## Troubleshooting
169
-
170
- ### Common Issues
171
-
172
- 1 . ** Database file not found** : Ensure the database file exists and the path is correct
173
- 2 . ** Permission denied** : Check file permissions for the database file
174
- 3 . ** Port already in use** : Use a different port with ` -addr ` flag or ` MCP_PORT ` environment variable
175
-
176
- ### Debugging
177
-
178
- Enable verbose logging by checking the server output. The server logs all important events including:
179
-
180
- - Server startup and configuration
181
- - Database connection status
182
- - Available tools and resources
183
- - Error messages and stack traces
0 commit comments