vector_mcp 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +281 -0
- data/README.md +302 -373
- data/lib/vector_mcp/definitions.rb +3 -1
- data/lib/vector_mcp/errors.rb +24 -0
- data/lib/vector_mcp/handlers/core.rb +132 -6
- data/lib/vector_mcp/logging/component.rb +131 -0
- data/lib/vector_mcp/logging/configuration.rb +156 -0
- data/lib/vector_mcp/logging/constants.rb +21 -0
- data/lib/vector_mcp/logging/core.rb +175 -0
- data/lib/vector_mcp/logging/filters/component.rb +69 -0
- data/lib/vector_mcp/logging/filters/level.rb +23 -0
- data/lib/vector_mcp/logging/formatters/base.rb +52 -0
- data/lib/vector_mcp/logging/formatters/json.rb +83 -0
- data/lib/vector_mcp/logging/formatters/text.rb +72 -0
- data/lib/vector_mcp/logging/outputs/base.rb +64 -0
- data/lib/vector_mcp/logging/outputs/console.rb +35 -0
- data/lib/vector_mcp/logging/outputs/file.rb +157 -0
- data/lib/vector_mcp/logging.rb +71 -0
- data/lib/vector_mcp/security/auth_manager.rb +79 -0
- data/lib/vector_mcp/security/authorization.rb +96 -0
- data/lib/vector_mcp/security/middleware.rb +172 -0
- data/lib/vector_mcp/security/session_context.rb +147 -0
- data/lib/vector_mcp/security/strategies/api_key.rb +167 -0
- data/lib/vector_mcp/security/strategies/custom.rb +71 -0
- data/lib/vector_mcp/security/strategies/jwt_token.rb +118 -0
- data/lib/vector_mcp/security.rb +46 -0
- data/lib/vector_mcp/server/registry.rb +24 -0
- data/lib/vector_mcp/server.rb +141 -1
- data/lib/vector_mcp/transport/sse/client_connection.rb +113 -0
- data/lib/vector_mcp/transport/sse/message_handler.rb +166 -0
- data/lib/vector_mcp/transport/sse/puma_config.rb +77 -0
- data/lib/vector_mcp/transport/sse/stream_manager.rb +92 -0
- data/lib/vector_mcp/transport/sse.rb +119 -460
- data/lib/vector_mcp/version.rb +1 -1
- data/lib/vector_mcp.rb +35 -2
- metadata +63 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c251e50dd9545c58cb748a420426193de3d8b2ccc5c110b340f79ff305ad769
|
4
|
+
data.tar.gz: d19ebc22fe53066a8113eea7e7219093fc0fe546a960aa392add005ae5bb1fa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7e6d56309c8e30ef4cdc20d2db4c9a74750508ea6c035dfe2ac64ae3759174d4c6c8b20b8726037318b5f5a14dee59e1a81097160c8df6b43a1d302f7e05f33
|
7
|
+
data.tar.gz: f8a32dbeadb7d17459745edefd7ebbdf784e7d9dc646a3362fe3ddd2ae3ae8d3c20f9d2374e6905d31a0bfcddbc369d5cb1ef583c544cffadc37fb6ed38ae8d1
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,281 @@
|
|
1
|
+
## [0.3.1] – 2025-06-25
|
2
|
+
|
3
|
+
### Added
|
4
|
+
* **Enhanced Structured Logging System**: Production-ready logging framework with comprehensive observability features
|
5
|
+
- **Component-Based Logging**: Hierarchical logger system with component-specific configuration (`server`, `transport.stdio`, `security.auth`)
|
6
|
+
- **Multiple Output Formats**: Text (with colors) and JSON formatters for different deployment needs
|
7
|
+
- **Flexible Configuration**: Support for environment variables, YAML files, and programmatic configuration
|
8
|
+
- **Context Management**: Structured context passing with `with_context` blocks and persistent context addition
|
9
|
+
- **Performance Measurement**: Built-in `measure` method for operation timing and performance monitoring
|
10
|
+
- **Log Level Management**: Component-specific log levels with runtime configuration changes
|
11
|
+
- **Legacy Compatibility**: Seamless backward compatibility with existing `VectorMCP.logger` usage
|
12
|
+
- **Thread Safety**: Concurrent logging support with proper synchronization
|
13
|
+
- **Security Logging**: Dedicated security log level for authentication and authorization events
|
14
|
+
|
15
|
+
* **Comprehensive Security Framework**: Production-ready authentication and authorization system
|
16
|
+
- **Authentication Strategies**: Multiple authentication methods with pluggable architecture
|
17
|
+
- **API Key Authentication**: Header and query parameter support with multiple key management
|
18
|
+
- **JWT Token Authentication**: JSON Web Token validation with configurable algorithms and secret management
|
19
|
+
- **Custom Authentication**: Flexible handler-based authentication for complex integration scenarios
|
20
|
+
- **Authorization System**: Fine-grained access control with policy-based permissions
|
21
|
+
- **Resource-Level Authorization**: Separate policies for tools, resources, prompts, and roots
|
22
|
+
- **Role-Based Access Control**: User role and permission management with session context
|
23
|
+
- **Action-Based Permissions**: Granular control over read, write, execute, and administrative actions
|
24
|
+
- **Security Middleware**: Comprehensive request processing pipeline
|
25
|
+
- **Request Normalization**: Consistent security processing across stdio and SSE transports
|
26
|
+
- **Session Context Management**: Secure user session tracking with authentication state
|
27
|
+
- **Error Handling**: Secure error responses without information leakage
|
28
|
+
- **Transport Integration**: Seamless security across all transport layers
|
29
|
+
- **SSE Transport Security**: Full HTTP header and query parameter authentication support
|
30
|
+
- **Stdio Transport Security**: Header simulation for desktop application authentication
|
31
|
+
- **Rack Environment Processing**: Native HTTP request processing with proper header extraction
|
32
|
+
|
33
|
+
* **Enhanced Core Handlers**: Security-aware request processing
|
34
|
+
- **Tool Execution Security**: Authentication and authorization checks for tool calls
|
35
|
+
- **Resource Access Security**: Protected resource reading with access control policies
|
36
|
+
- **Backward Compatibility**: Automatic detection of security-aware vs legacy tool handlers
|
37
|
+
- **Session Context Injection**: Optional session context parameter for security-aware handlers
|
38
|
+
|
39
|
+
* **New Security Error Types**: Proper MCP error codes for security scenarios
|
40
|
+
- **UnauthorizedError (-32401)**: Authentication required error with proper MCP formatting
|
41
|
+
- **ForbiddenError (-32403)**: Authorization failed error for access control violations
|
42
|
+
|
43
|
+
* **Security Examples and Documentation**
|
44
|
+
- **Authentication Example Server** (`examples/auth_server.rb`): Complete demonstration of all security features
|
45
|
+
- **Comprehensive Security Guide** (`security/README.md`): 400+ line documentation covering all security aspects
|
46
|
+
- **Updated Main Documentation**: Enhanced README with security feature overview and quick start examples
|
47
|
+
- **CLAUDE.md Integration**: Updated project documentation with security architecture details
|
48
|
+
|
49
|
+
### Fixed
|
50
|
+
* Added missing runtime dependencies to gemspec for proper gem installation
|
51
|
+
- Added `jwt` gem dependency (~> 2.7) for JWT authentication strategy
|
52
|
+
- Added `rack` gem dependency (~> 3.0) for SSE transport
|
53
|
+
- Fixed JWT exception handling for compatibility with jwt gem 2.7+
|
54
|
+
|
55
|
+
### Changed
|
56
|
+
* Enhanced gemspec description for better gem discovery
|
57
|
+
* Added CHANGELOG.md to packaged gem files
|
58
|
+
* Improved gemspec metadata for RubyGems.org listing
|
59
|
+
|
60
|
+
* **Opt-In Security Design**: Security features are disabled by default for maximum compatibility
|
61
|
+
* Existing servers continue working without modification
|
62
|
+
* Security features enabled explicitly via `enable_authentication!` and `enable_authorization!`
|
63
|
+
* Zero-configuration default maintains backward compatibility
|
64
|
+
|
65
|
+
* **Server Architecture Enhancement**: Security integration into core server functionality
|
66
|
+
* **Security Middleware Integration**: Built-in security processing pipeline
|
67
|
+
* **Strategy Management**: Centralized authentication strategy switching and cleanup
|
68
|
+
* **Session Context Tracking**: Per-request security state management
|
69
|
+
|
70
|
+
* **Enhanced Error Handling**: Security-aware error processing throughout the stack
|
71
|
+
* Proper MCP error codes for authentication and authorization failures
|
72
|
+
* Secure error messages that don't leak sensitive information
|
73
|
+
* Graceful degradation with detailed logging for debugging
|
74
|
+
|
75
|
+
### Security
|
76
|
+
|
77
|
+
* **Defense in Depth**: Multiple security layers following enterprise security principles
|
78
|
+
* **Authentication Layer**: Verify user identity before granting access
|
79
|
+
* **Authorization Layer**: Fine-grained permission checking for all resources
|
80
|
+
* **Transport Security**: Secure communication across all transport mechanisms
|
81
|
+
* **Input Validation**: Continued protection against injection attacks via existing schema validation
|
82
|
+
|
83
|
+
* **Secure Defaults**: Security-first configuration options
|
84
|
+
* Authentication disabled by default (explicit opt-in required)
|
85
|
+
* Authorization uses allowlist approach (deny by default, explicit permissions required)
|
86
|
+
* Secure error handling without information disclosure
|
87
|
+
* Automatic session isolation and cleanup
|
88
|
+
|
89
|
+
* **Enterprise Security Features**: Production-ready security controls
|
90
|
+
* **Session Management**: Secure user session tracking with authentication state
|
91
|
+
* **Permission Framework**: Flexible role-based and resource-based access control
|
92
|
+
* **Error Recovery**: Graceful handling of authentication failures, timeouts, and edge cases
|
93
|
+
* **Audit Trail**: Comprehensive logging of authentication and authorization events
|
94
|
+
|
95
|
+
### Testing
|
96
|
+
|
97
|
+
* **Comprehensive Security Test Suite**: 68+ tests covering all security scenarios
|
98
|
+
* **Authentication Strategy Tests**: Complete coverage of API key, JWT, and custom authentication
|
99
|
+
* **Authorization Policy Tests**: Fine-grained permission testing with edge cases
|
100
|
+
* **Transport Security Integration**: End-to-end security testing across stdio and SSE transports
|
101
|
+
* **Error Handling Tests**: Security failure scenarios and attack vector validation
|
102
|
+
* **Concurrency Tests**: Thread safety and concurrent access security validation
|
103
|
+
* **Performance Tests**: Memory management and resource cleanup under load
|
104
|
+
|
105
|
+
### Technical Details
|
106
|
+
|
107
|
+
* **Dependencies**: Optional JWT gem support for JWT authentication strategy
|
108
|
+
* **API Compatibility**: All security features maintain full backward compatibility
|
109
|
+
* **Performance**: Minimal overhead when security is disabled, efficient processing when enabled
|
110
|
+
* **Documentation**: Extensive security documentation with real-world examples and best practices
|
111
|
+
|
112
|
+
## [0.3.0] – 2025-06-20
|
113
|
+
|
114
|
+
### Added
|
115
|
+
* **Comprehensive Input Schema Validation**: Two-layer validation system for enhanced security and developer experience
|
116
|
+
- **Schema Validation**: Validates JSON Schema format during tool registration using `json-schema` gem
|
117
|
+
- **Input Validation**: Validates user arguments against defined schemas during tool execution
|
118
|
+
- Automatic validation for all tools with `input_schema` defined
|
119
|
+
- Detailed error messages with specific validation failure details
|
120
|
+
- Full backward compatibility - tools without schemas continue working unchanged
|
121
|
+
- New `validate_schema_format!` method for registration-time validation
|
122
|
+
- Renamed `validate_tool_arguments!` to `validate_input_arguments!` for clarity
|
123
|
+
|
124
|
+
* **Enhanced Documentation and Examples**
|
125
|
+
- Comprehensive README section on automatic input validation with security benefits
|
126
|
+
- New `examples/validation_demo.rb` showcasing both validation types
|
127
|
+
- Complete `examples/README.md` with descriptions of all example files
|
128
|
+
- Updated documentation emphasizing security best practices
|
129
|
+
|
130
|
+
### Changed
|
131
|
+
* **Method Naming Improvements**: Clarified validation method names
|
132
|
+
- `validate_tool_arguments!` → `validate_input_arguments!` (runtime validation)
|
133
|
+
- Added `validate_schema_format!` (registration-time validation)
|
134
|
+
|
135
|
+
### Security
|
136
|
+
* **Injection Attack Prevention**: Centralized validation prevents malformed input from reaching tool handlers
|
137
|
+
* **Type Safety**: Ensures all arguments match expected JSON Schema types and constraints
|
138
|
+
* **Early Error Detection**: Invalid schemas caught during development, not runtime
|
139
|
+
|
140
|
+
* **SSE Transport Implementation**: Complete HTTP/Server-Sent Events transport
|
141
|
+
- New `VectorMCP::Transport::SSE` class with HTTP server capabilities
|
142
|
+
- Puma-based HTTP server with concurrent request handling
|
143
|
+
- Bi-directional communication: SSE for server-to-client, HTTP POST for client-to-server
|
144
|
+
- Session management with unique session IDs and connection tracking
|
145
|
+
- Support for web browsers and HTTP-based MCP clients
|
146
|
+
- Configurable host, port, and path prefix options
|
147
|
+
|
148
|
+
## [0.3.0] – 2025-06-20
|
149
|
+
|
150
|
+
### Added
|
151
|
+
|
152
|
+
* **Comprehensive Input Schema Validation**: Two-layer validation system for enhanced security and developer experience
|
153
|
+
* **Schema Validation**: Validates JSON Schema format during tool registration using `json-schema` gem
|
154
|
+
* **Input Validation**: Validates user arguments against defined schemas during tool execution
|
155
|
+
* Automatic validation for all tools with `input_schema` defined
|
156
|
+
* Detailed error messages with specific validation failure details
|
157
|
+
* Full backward compatibility - tools without schemas continue working unchanged
|
158
|
+
* New `validate_schema_format!` method for registration-time validation
|
159
|
+
* Renamed `validate_tool_arguments!` to `validate_input_arguments!` for clarity
|
160
|
+
|
161
|
+
* **Enhanced Documentation and Examples**
|
162
|
+
* Comprehensive README section on automatic input validation with security benefits
|
163
|
+
* New `examples/validation_demo.rb` showcasing both validation types
|
164
|
+
* Complete `examples/README.md` with descriptions of all example files
|
165
|
+
* Updated documentation emphasizing security best practices
|
166
|
+
|
167
|
+
### Changed
|
168
|
+
|
169
|
+
* **Method Naming Improvements**: Clarified validation method names
|
170
|
+
* `validate_tool_arguments!` → `validate_input_arguments!` (runtime validation)
|
171
|
+
* Added `validate_schema_format!` (registration-time validation)
|
172
|
+
|
173
|
+
### Security
|
174
|
+
|
175
|
+
* **Injection Attack Prevention**: Centralized validation prevents malformed input from reaching tool handlers
|
176
|
+
* **Type Safety**: Ensures all arguments match expected JSON Schema types and constraints
|
177
|
+
* **Early Error Detection**: Invalid schemas caught during development, not runtime
|
178
|
+
|
179
|
+
* **SSE Transport Implementation**: Complete HTTP/Server-Sent Events transport
|
180
|
+
* New `VectorMCP::Transport::SSE` class with HTTP server capabilities
|
181
|
+
* Puma-based HTTP server with concurrent request handling
|
182
|
+
* Bi-directional communication: SSE for server-to-client, HTTP POST for client-to-server
|
183
|
+
* Session management with unique session IDs and connection tracking
|
184
|
+
* Support for web browsers and HTTP-based MCP clients
|
185
|
+
* Configurable host, port, and path prefix options
|
186
|
+
|
187
|
+
## [0.2.0] – 2025-05-26
|
188
|
+
|
189
|
+
### Added
|
190
|
+
|
191
|
+
* **MCP Sampling Support**: Full implementation of Model Context Protocol sampling capabilities
|
192
|
+
* New `VectorMCP::Sampling::Request` and `VectorMCP::Sampling::Result` classes
|
193
|
+
* Session-based sampling with `Session#sample` method
|
194
|
+
* Configurable sampling capabilities (methods, features, limits, context inclusion)
|
195
|
+
* Support for streaming, tool calls, images, and model preferences
|
196
|
+
* Timeout and error handling for sampling requests
|
197
|
+
|
198
|
+
* **Image Processing Utilities**: Comprehensive image handling capabilities
|
199
|
+
* New `VectorMCP::ImageUtil` module with format detection, validation, and conversion
|
200
|
+
* Support for JPEG, PNG, GIF, WebP, BMP, and TIFF formats
|
201
|
+
* Base64 encoding/decoding with validation
|
202
|
+
* Image metadata extraction (dimensions, format, size)
|
203
|
+
* MCP-compliant image content generation
|
204
|
+
* File-based and binary data image processing
|
205
|
+
|
206
|
+
* **Enhanced Definitions**: Extended tool, resource, and prompt definitions
|
207
|
+
* Image support detection for tools (`Tool#supports_image_input?`)
|
208
|
+
* Image resource creation (`Resource.from_image_file`, `Resource.from_image_data`)
|
209
|
+
* Image-aware prompts (`Prompt#supports_image_arguments?`, `Prompt.with_image_support`)
|
210
|
+
* Enhanced validation and MCP definition generation
|
211
|
+
|
212
|
+
* **Roots Support**: New MCP roots functionality
|
213
|
+
* `VectorMCP::Definitions::Root` class for filesystem root definitions
|
214
|
+
* Root registration and validation (`Server#register_root`, `Server#register_root_from_path`)
|
215
|
+
* Automatic path validation and security checks
|
216
|
+
* List change notifications for roots
|
217
|
+
|
218
|
+
* **Enhanced Content Utilities**: Improved content processing in `VectorMCP::Util`
|
219
|
+
* Automatic image file path detection and processing
|
220
|
+
* Binary image data detection and conversion
|
221
|
+
* Mixed content array processing with image support
|
222
|
+
* Enhanced JSON-RPC ID extraction from malformed messages
|
223
|
+
|
224
|
+
### Changed
|
225
|
+
|
226
|
+
* **Server Architecture Refactoring**: Major code organization improvements
|
227
|
+
* Extracted server functionality into focused modules:
|
228
|
+
* `VectorMCP::Server::Registry` for tool/resource/prompt management
|
229
|
+
* `VectorMCP::Server::Capabilities` for capability negotiation
|
230
|
+
* `VectorMCP::Server::MessageHandling` for request/notification processing
|
231
|
+
* Reduced main `Server` class from 392 to 159 lines
|
232
|
+
* Improved separation of concerns and maintainability
|
233
|
+
|
234
|
+
* **Enhanced Session Management**: Improved session initialization and state handling
|
235
|
+
* Better session lifecycle management
|
236
|
+
* Enhanced sampling capabilities integration
|
237
|
+
* Improved error handling for uninitialized sessions
|
238
|
+
|
239
|
+
* **Transport Layer Improvements**: Enhanced stdio transport reliability
|
240
|
+
* Better request/response correlation for server-initiated requests
|
241
|
+
* Improved error handling and timeout management
|
242
|
+
* Enhanced thread safety and resource cleanup
|
243
|
+
* Fixed session initialization race conditions
|
244
|
+
|
245
|
+
* **Error Handling Enhancements**: More robust error management
|
246
|
+
* Additional error types for sampling operations
|
247
|
+
* Better error context and details
|
248
|
+
* Improved protocol error handling
|
249
|
+
|
250
|
+
### Fixed
|
251
|
+
|
252
|
+
* **Code Quality Improvements**: Resolved all Ruby linting violations
|
253
|
+
* Fixed method length violations through strategic refactoring
|
254
|
+
* Resolved perceived complexity issues by extracting helper methods
|
255
|
+
* Eliminated duplicate attribute declarations
|
256
|
+
* Fixed parameter list length violations
|
257
|
+
* Corrected naming convention violations
|
258
|
+
* Removed unused variable assignments
|
259
|
+
|
260
|
+
* **Session Initialization**: Fixed double initialization bug in stdio transport
|
261
|
+
* Resolved race condition causing "Session already initialized" errors
|
262
|
+
* Improved session state management across transport layer
|
263
|
+
* Fixed integration test failures related to session handling
|
264
|
+
|
265
|
+
* **Test Suite Stability**: Enhanced test reliability and coverage
|
266
|
+
* Fixed integration test failures
|
267
|
+
* Improved test isolation and cleanup
|
268
|
+
* Enhanced error scenario testing
|
269
|
+
* Added comprehensive image processing tests
|
270
|
+
|
271
|
+
### Technical Details
|
272
|
+
|
273
|
+
* **Dependencies**: Added `base64` gem requirement for image processing
|
274
|
+
* **API Compatibility**: All changes maintain backward compatibility with existing MCP clients
|
275
|
+
* **Performance**: Improved memory usage through better resource management
|
276
|
+
* **Security**: Enhanced path validation and traversal protection for roots
|
277
|
+
* **Documentation**: Updated README with new features and examples
|
278
|
+
|
279
|
+
## [0.1.0] – 2025-05-08
|
280
|
+
### Added
|
281
|
+
* First public release: stdio transport, tool/resource registration, JSON-RPC layer…
|