Migrate to package

This commit is contained in:
2026-03-02 17:44:18 +00:00
parent 3e2386b9b6
commit 8dfd2048a5
13 changed files with 356 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ An MCP (Model Context Protocol) server that exposes a `knowledge_search` tool fo
## Configuration
Create a `.env` file (see `Settings` in `main.py` for all options):
Create a `config.yaml` file or `.env` file (see `Settings` in `src/knowledge_search_mcp/config.py` for all options):
```env
PROJECT_ID=my-gcp-project
@@ -42,16 +42,25 @@ SEARCH_LIMIT=10
uv sync
```
### Run the MCP server (stdio)
### Run the MCP server
**Using the installed command (recommended):**
```bash
uv run python main.py
# stdio transport (default)
uv run knowledge-search-mcp
# SSE transport for remote clients
uv run knowledge-search-mcp --transport sse --port 8080
# streamable-http transport
uv run knowledge-search-mcp --transport streamable-http --port 8080
```
### Run the MCP server (SSE, e.g. for remote clients)
**Or run directly:**
```bash
uv run python main.py --transport sse --port 8080
uv run python -m knowledge_search_mcp.main
```
### Run the interactive agent (ADK)
@@ -68,6 +77,12 @@ Or connect to an already-running SSE server:
uv run python agent.py --remote http://localhost:8080/sse
```
### Run tests
```bash
uv run pytest
```
## Docker
```bash
@@ -80,8 +95,12 @@ The container starts the server in SSE mode on the port specified by `PORT` (def
## Project structure
```
main.py MCP server, vector search client, and GCS storage helper
agent.py Interactive ADK agent that consumes the MCP server
Dockerfile Multi-stage build for Cloud Run / containerized deployment
pyproject.toml Project metadata and dependencies
src/knowledge_search_mcp/
├── __init__.py Package initialization
├── config.py Configuration management (Settings, args parsing)
├── logging.py Cloud Logging setup
└── main.py MCP server, vector search client, and GCS storage helper
agent.py Interactive ADK agent that consumes the MCP server
tests/ Test suite
pyproject.toml Project metadata, dependencies, and entry points
```