|
15 | 15 | [](https://www.python.org/downloads/)
|
16 | 16 | 
|
17 | 17 |
|
| 18 | +## Table of Contents |
| 19 | + |
| 20 | +- [Features](#features) |
| 21 | +- [Requirements](#requirements) |
| 22 | +- [Installation](#installation) |
| 23 | + - [Quick Start](#quick-start) |
| 24 | + - [Or, install from PyPI with pip](#or-install-from-pypi-with-pip) |
| 25 | + - [Or, install from source](#or-install-from-source) |
| 26 | +- [How It Works](#how-it-works) |
| 27 | +- [Configuration](#configuration) |
| 28 | + - [MCP Servers Configuration](#mcp-servers-configuration) |
| 29 | + - [CORS Configuration](#cors-configuration) |
| 30 | +- [Usage](#usage) |
| 31 | + - [Start the Server](#start-the-server) |
| 32 | + - [CLI Options](#cli-options) |
| 33 | + - [API Usage](#api-usage) |
| 34 | + - [Example: Chat](#example-chat) |
| 35 | +- [Development](#development) |
| 36 | + - [Key Dependencies](#key-dependencies) |
| 37 | + - [Testing](#testing) |
| 38 | +- [Inspiration and Credits](#inspiration-and-credits) |
18 | 39 |
|
19 | 40 | ## Features
|
20 | 41 |
|
@@ -97,6 +118,8 @@ ollama-mcp-bridge
|
97 | 118 |
|
98 | 119 | ## Configuration
|
99 | 120 |
|
| 121 | +### MCP Servers Configuration |
| 122 | + |
100 | 123 | Create an MCP configuration file at `mcp-servers-config/mcp-config.json` with your servers:
|
101 | 124 |
|
102 | 125 | ```json
|
@@ -126,6 +149,34 @@ Create an MCP configuration file at `mcp-servers-config/mcp-config.json` with yo
|
126 | 149 | }
|
127 | 150 | ```
|
128 | 151 |
|
| 152 | +### CORS Configuration |
| 153 | + |
| 154 | +Configure Cross-Origin Resource Sharing (CORS) to allow requests from your frontend applications: |
| 155 | + |
| 156 | +```bash |
| 157 | +# Allow all origins (default, not recommended for production) |
| 158 | +ollama-mcp-bridge |
| 159 | + |
| 160 | +# Allow specific origins |
| 161 | +CORS_ORIGINS="http://localhost:3000,https://myapp.com" ollama-mcp-bridge |
| 162 | + |
| 163 | +# Allow multiple origins with different ports |
| 164 | +CORS_ORIGINS="http://localhost:3000,http://localhost:8080,https://app.example.com" ollama-mcp-bridge |
| 165 | +``` |
| 166 | + |
| 167 | +**Environment Variables:** |
| 168 | +- `CORS_ORIGINS`: Comma-separated list of allowed origins (default: `*`) |
| 169 | + - `*` allows all origins (shows warning in logs) |
| 170 | + - Specific origins like `http://localhost:3000,https://myapp.com` for production |
| 171 | + |
| 172 | +**CORS Logging:** |
| 173 | +- The bridge logs CORS configuration at startup |
| 174 | +- Shows warning when using `*` (all origins) |
| 175 | +- Shows allowed origins when properly configured |
| 176 | + |
| 177 | +> [!WARNING] |
| 178 | +> Using `CORS_ORIGINS="*"` allows all origins and is not recommended for production. Always specify exact origins for security. |
| 179 | +
|
129 | 180 | > [!NOTE]
|
130 | 181 | > An example MCP server script is provided at `mcp-servers-config/mock-weather-mcp-server.py`.
|
131 | 182 |
|
|
0 commit comments