**docs: update README to streamline server functionality documentation**
- Simplified explanation of server functionality (`WebSocket` and `REST`) to emphasize its exclusion from the main Brainy package for maintaining lightweight browser bundles. - Removed detailed Node.js-specific setup examples, configuration options, and cloud-wrapper deployment instructions. - Retained relevant core functionality usage details for broader accessibility. This update aligns the documentation with recent repository changes, focusing on clarity, maintainability, and providing guidance only on actively supported features.
This commit is contained in:
parent
c88e1960da
commit
a4072cf3c0
1 changed files with 1 additions and 77 deletions
|
|
@ -34,12 +34,7 @@ The `BrainyMCPService` has been refactored to separate the core functionality fr
|
|||
|
||||
1. **Core Functionality**: The core request handling functionality (`handleMCPRequest`) can run in any environment where Brainy itself runs. This is what remains in the main Brainy package.
|
||||
|
||||
2. **Server Functionality**: The WebSocket and REST server functionality has been moved to the cloud-wrapper project to avoid including Node.js-specific dependencies in the browser bundle:
|
||||
- `ws` for WebSocket server
|
||||
- `express` for REST API
|
||||
- `cors` for Cross-Origin Resource Sharing
|
||||
|
||||
This separation ensures that the browser bundle remains lightweight and doesn't include unnecessary Node.js-specific dependencies. In browser or other environments, you can still use the core functionality through the `handleMCPRequest` method.
|
||||
2. **Server Functionality**: The WebSocket and REST server functionality is not included in the main Brainy package to keep the browser bundle lightweight and avoid Node.js-specific dependencies. In browser or other environments, you can use the core functionality through the `handleMCPRequest` method.
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
@ -82,47 +77,6 @@ const toolResponse = await toolset.handleRequest({
|
|||
})
|
||||
```
|
||||
|
||||
### In Node.js Environment with Server Functionality
|
||||
|
||||
To use the MCP service with WebSocket and REST server functionality, you should use the cloud-wrapper project:
|
||||
|
||||
```typescript
|
||||
import { BrainyData } from '@soulcraft/brainy'
|
||||
import { initializeBrainy } from './services/brainyService.js'
|
||||
import { initializeMCPService } from './services/mcpService.js'
|
||||
|
||||
// Initialize Brainy
|
||||
const brainyData = await initializeBrainy()
|
||||
|
||||
// Initialize MCP service with WebSocket and REST server functionality
|
||||
const mcpService = initializeMCPService(brainyData, {
|
||||
wsPort: 8080,
|
||||
restPort: 3000,
|
||||
enableAuth: true,
|
||||
apiKeys: ['your-api-key'],
|
||||
rateLimit: {
|
||||
maxRequests: 100,
|
||||
windowMs: 60000 // 1 minute
|
||||
},
|
||||
cors: {
|
||||
origin: '*',
|
||||
credentials: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Alternatively, you can configure the MCP service using environment variables in the cloud-wrapper:
|
||||
|
||||
```
|
||||
# MCP configuration
|
||||
MCP_WS_PORT=8080
|
||||
MCP_REST_PORT=3000
|
||||
MCP_ENABLE_AUTH=true
|
||||
MCP_API_KEYS=your-api-key,another-key
|
||||
MCP_RATE_LIMIT_REQUESTS=100
|
||||
MCP_RATE_LIMIT_WINDOW_MS=60000
|
||||
MCP_ENABLE_CORS=true
|
||||
```
|
||||
|
||||
### In Browser Environment (Core Functionality Only)
|
||||
|
||||
|
|
@ -148,33 +102,3 @@ const response = await mcpService.handleMCPRequest({
|
|||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Cloud Wrapper Integration
|
||||
|
||||
The MCP service's server functionality has been integrated directly into the cloud-wrapper project. The cloud-wrapper automatically initializes the MCP service if the appropriate environment variables are set:
|
||||
|
||||
```
|
||||
# MCP configuration
|
||||
MCP_WS_PORT=8080
|
||||
MCP_REST_PORT=3000
|
||||
MCP_ENABLE_AUTH=true
|
||||
MCP_API_KEYS=your-api-key,another-key
|
||||
MCP_RATE_LIMIT_REQUESTS=100
|
||||
MCP_RATE_LIMIT_WINDOW_MS=60000
|
||||
MCP_ENABLE_CORS=true
|
||||
```
|
||||
|
||||
You can deploy the cloud wrapper to various cloud platforms using the npm scripts from the root directory:
|
||||
|
||||
```bash
|
||||
# Deploy to AWS Lambda and API Gateway
|
||||
npm run deploy:cloud:aws
|
||||
|
||||
# Deploy to Google Cloud Run
|
||||
npm run deploy:cloud:gcp
|
||||
|
||||
# Deploy to Cloudflare Workers
|
||||
npm run deploy:cloud:cloudflare
|
||||
```
|
||||
|
||||
The cloud wrapper is specifically designed for server environments and includes additional features like logging, security headers, and deployment scripts for various cloud providers. See the [Cloud Wrapper README](../../cloud-wrapper/README.md) for detailed configuration instructions and API documentation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue