Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ func handleMyTool(ctx context.Context, req *mcp.CallToolRequest, args MyToolArgs

**Key differences:**

| Feature | Server Logging | MCP Client Logging |
|---------|---------------|-------------------|
| Audience | Server operators | Client users/developers |
| Output | stdout/stderr | MCP protocol notifications |
| Control | `-debug` flag | Client's `SetLoggingLevel` |
| Format | JSON to files | JSON over protocol |
| Use case | Debugging server | Debugging tool execution |
| Feature | Server Logging | MCP Client Logging |
|----------|------------------|----------------------------|
| Audience | Server operators | Client users/developers |
| Output | stdout/stderr | MCP protocol notifications |
| Control | `-debug` flag | Client's `SetLoggingLevel` |
| Format | JSON to files | JSON over protocol |
| Use case | Debugging server | Debugging tool execution |

### Server Log Structure

Expand Down Expand Up @@ -232,9 +232,9 @@ The MCP Go SDK provides a simple pattern for adding tools. Tools are implemented

Two scope constants are defined in `internal/tools/scopes.go`:

| Constant | Value | Used for |
|----------|-------|----------|
| `ScopeRead` | `read:all` | Tools with `ReadOnlyHint: true` |
| Constant | Value | Used for |
|---------------|--------------|-----------------------------------------------------|
| `ScopeRead` | `read:all` | Tools with `ReadOnlyHint: true` |
| `ScopeManage` | `manage:all` | Tools where `ReadOnlyHint` is `false` (the default) |

Use the helper functions `ReadScopes()` and `WriteScopes()` when registering tools.
Expand Down Expand Up @@ -488,27 +488,27 @@ The server supports configuration via environment variables with the `LFXMCP_` p

**Configuration Precedence:** Environment variables **override** command-line flags. This allows command-line flags to provide defaults while environment variables can override them in containerized deployments.

| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `LFXMCP_MODE` | Transport mode (`stdio` or `http`) | stdio | No |
| `LFXMCP_HTTP_HOST` | HTTP server host | 127.0.0.1 | No |
| `LFXMCP_HTTP_PORT` | HTTP server port | 8080 | No |
| `LFXMCP_HTTP_PUBLIC_URL` | Public URL for HTTP transport | - | No |
| `LFXMCP_DEBUG` | Enable debug logging | false | No |
| `LFXMCP_DEBUG_TRAFFIC` | Enable HTTP request/response wire logging for outbound LFX API calls | false | No |
| `LFXMCP_TOOLS` | Comma-separated list of tools to enable | - | No |
| `LFXMCP_MCP_API_AUTH_SERVERS` | Comma-separated list of authorization server URLs | - | No |
| `LFXMCP_MCP_API_PUBLIC_URL` | Public URL for MCP API (for OAuth PRM) | - | No |
| `LFXMCP_MCP_API_SCOPES` | OAuth scopes as comma-separated list | - | No |
| `LFXMCP_CLIENT_ID` | OAuth client ID for authentication | - | No |
| `LFXMCP_CLIENT_SECRET` | OAuth client secret | - | No |
| `LFXMCP_CLIENT_ASSERTION_SIGNING_KEY` | PEM-encoded RSA private key for client assertion | - | No |
| `LFXMCP_TOKEN_ENDPOINT` | OAuth2 token endpoint URL for token exchange | - | No |
| `LFXMCP_LFX_API_URL` | LFX API URL (used as token exchange audience) | - | No |
| `LFXMCP_ONBOARDING_API_URL` | Base URL of the member onboarding service | - | No |
| `LFXMCP_ONBOARDING_API_AUDIENCE` | Auth0 resource server audience for the member onboarding API | - | No |
| `LFXMCP_LENS_API_URL` | Base URL of the LFX Lens service | - | No |
| `LFXMCP_LENS_API_AUDIENCE` | Auth0 resource server audience for the LFX Lens API | - | No |
| Variable | Description | Default | Required |
|---------------------------------------|----------------------------------------------------------------------|-----------|----------|
| `LFXMCP_MODE` | Transport mode (`stdio` or `http`) | stdio | No |
| `LFXMCP_HTTP_HOST` | HTTP server host | 127.0.0.1 | No |
| `LFXMCP_HTTP_PORT` | HTTP server port | 8080 | No |
| `LFXMCP_HTTP_PUBLIC_URL` | Public URL for HTTP transport | - | No |
| `LFXMCP_DEBUG` | Enable debug logging | false | No |
| `LFXMCP_DEBUG_TRAFFIC` | Enable HTTP request/response wire logging for outbound LFX API calls | false | No |
| `LFXMCP_TOOLS` | Comma-separated list of tools to enable | - | No |
| `LFXMCP_MCP_API_AUTH_SERVERS` | Comma-separated list of authorization server URLs | - | No |
| `LFXMCP_MCP_API_PUBLIC_URL` | Public URL for MCP API (for OAuth PRM) | - | No |
| `LFXMCP_MCP_API_SCOPES` | OAuth scopes as comma-separated list | - | No |
| `LFXMCP_CLIENT_ID` | OAuth client ID for authentication | - | No |
| `LFXMCP_CLIENT_SECRET` | OAuth client secret | - | No |
| `LFXMCP_CLIENT_ASSERTION_SIGNING_KEY` | PEM-encoded RSA private key for client assertion | - | No |
| `LFXMCP_TOKEN_ENDPOINT` | OAuth2 token endpoint URL for token exchange | - | No |
| `LFXMCP_LFX_API_URL` | LFX API URL (used as token exchange audience) | - | No |
| `LFXMCP_ONBOARDING_API_URL` | Base URL of the member onboarding service | - | No |
| `LFXMCP_ONBOARDING_API_AUDIENCE` | Auth0 resource server audience for the member onboarding API | - | No |
| `LFXMCP_LENS_API_URL` | Base URL of the LFX Lens service | - | No |
| `LFXMCP_LENS_API_AUDIENCE` | Auth0 resource server audience for the LFX Lens API | - | No |

**Example:**

Expand Down
62 changes: 31 additions & 31 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ The HTTP server listens at `http://localhost:8080/mcp` by default.

Environment variables use the `LFXMCP_` prefix and **override** their corresponding flags.

| Flag | Env Var | Default | Description |
|------|---------|---------|-------------|
| `-mode` | `LFXMCP_MODE` | `stdio` | Transport mode: `stdio` or `http` |
| `-http.host` | `LFXMCP_HTTP_HOST` | `127.0.0.1` | HTTP server bind address |
| `-http.port` | `LFXMCP_HTTP_PORT` | `8080` | HTTP server port |
| `-http.public_url` | `LFXMCP_HTTP_PUBLIC_URL` | — | Public URL for HTTP transport (reverse proxies) |
| `-debug` | `LFXMCP_DEBUG` | `false` | Enable debug logging with source locations |
| `-debug_traffic` | `LFXMCP_DEBUG_TRAFFIC` | `false` | Log outbound LFX API request/response bodies |
| `-tools` | `LFXMCP_TOOLS` | — | Comma-separated list of tools to enable |
| `-mcp_api.auth_servers` | `LFXMCP_MCP_API_AUTH_SERVERS` | — | OAuth authorization server URLs (comma-separated) |
| `-mcp_api.public_url` | `LFXMCP_MCP_API_PUBLIC_URL` | — | Public URL for MCP API (OAuth PRM) |
| `-mcp_api.scopes` | `LFXMCP_MCP_API_SCOPES` | — | OAuth scopes (comma-separated) |
| `-client_id` | `LFXMCP_CLIENT_ID` | — | OAuth client ID for token exchange |
| `-client_secret` | `LFXMCP_CLIENT_SECRET` | — | OAuth client secret |
| `-client_assertion_signing_key` | `LFXMCP_CLIENT_ASSERTION_SIGNING_KEY` | — | PEM-encoded RSA private key for client assertion (RFC 7523) |
| `-token_endpoint` | `LFXMCP_TOKEN_ENDPOINT` | — | OAuth2 token endpoint URL (RFC 8693) |
| `-lfx_api_url` | `LFXMCP_LFX_API_URL` | — | LFX API base URL (token exchange audience) |
| Flag | Env Var | Default | Description |
|---------------------------------|---------------------------------------|-------------|-------------------------------------------------------------|
| `-mode` | `LFXMCP_MODE` | `stdio` | Transport mode: `stdio` or `http` |
| `-http.host` | `LFXMCP_HTTP_HOST` | `127.0.0.1` | HTTP server bind address |
| `-http.port` | `LFXMCP_HTTP_PORT` | `8080` | HTTP server port |
| `-http.public_url` | `LFXMCP_HTTP_PUBLIC_URL` | — | Public URL for HTTP transport (reverse proxies) |
| `-debug` | `LFXMCP_DEBUG` | `false` | Enable debug logging with source locations |
| `-debug_traffic` | `LFXMCP_DEBUG_TRAFFIC` | `false` | Log outbound LFX API request/response bodies |
| `-tools` | `LFXMCP_TOOLS` | — | Comma-separated list of tools to enable |
| `-mcp_api.auth_servers` | `LFXMCP_MCP_API_AUTH_SERVERS` | — | OAuth authorization server URLs (comma-separated) |
| `-mcp_api.public_url` | `LFXMCP_MCP_API_PUBLIC_URL` | — | Public URL for MCP API (OAuth PRM) |
| `-mcp_api.scopes` | `LFXMCP_MCP_API_SCOPES` | — | OAuth scopes (comma-separated) |
| `-client_id` | `LFXMCP_CLIENT_ID` | — | OAuth client ID for token exchange |
| `-client_secret` | `LFXMCP_CLIENT_SECRET` | — | OAuth client secret |
| `-client_assertion_signing_key` | `LFXMCP_CLIENT_ASSERTION_SIGNING_KEY` | — | PEM-encoded RSA private key for client assertion (RFC 7523) |
| `-token_endpoint` | `LFXMCP_TOKEN_ENDPOINT` | — | OAuth2 token endpoint URL (RFC 8693) |
| `-lfx_api_url` | `LFXMCP_LFX_API_URL` | — | LFX API base URL (token exchange audience) |

## Code Quality

Expand Down Expand Up @@ -208,17 +208,17 @@ For more detail on tool annotations, JSON schema tags, content types, and the MC

## Build System

| Target | Description |
|--------|-------------|
| `all` | Clean, check, and build (default) |
| `build` | Compile the binary |
| `clean` | Remove build artifacts |
| `fmt` | Format Go code |
| `vet` | Run go vet |
| `lint` | Run golangci-lint |
| `check` | Run fmt, vet, and lint |
| `run` | Build and run in stdio mode |
| `test` | Run Go tests |
| `test-coverage` | Run tests with coverage |
| `deps` | Download and tidy dependencies |
| `install-tools` | Install development tools |
| Target | Description |
|-----------------|-----------------------------------|
| `all` | Clean, check, and build (default) |
| `build` | Compile the binary |
| `clean` | Remove build artifacts |
| `fmt` | Format Go code |
| `vet` | Run go vet |
| `lint` | Run golangci-lint |
| `check` | Run fmt, vet, and lint |
| `run` | Build and run in stdio mode |
| `test` | Run Go tests |
| `test-coverage` | Run tests with coverage |
| `deps` | Download and tidy dependencies |
| `install-tools` | Install development tools |
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT

.PHONY: all build clean check fmt vet lint test test-coverage run help deps install-tools docker-build ko-build
.PHONY: all build clean check fmt vet lint test test-coverage run help deps install-tools docker-build ko-build megalinter

# Build variables
BINARY_NAME=lfx-mcp-server
Expand Down Expand Up @@ -107,6 +107,11 @@ ko-build:
@echo "Building ko image..."
KO_DOCKER_REPO=$(DOCKER_IMAGE) VERSION=$(VERSION) ko build -L --bare --tags local ./cmd/lfx-mcp-server

# Run MegaLinter locally via Docker (matches CI Go flavor at v9).
megalinter:
docker pull oxsecurity/megalinter-go:v9
docker run --rm --platform linux/amd64 -v '$(CURDIR):/tmp/lint:rw' oxsecurity/megalinter-go:v9

# Show help
help:
@echo "Available targets:"
Expand All @@ -124,4 +129,5 @@ help:
@echo " install-tools - Install development tools"
@echo " docker-build - Build Docker image"
@echo " ko-build - Build ko image locally with :local tag"
@echo " megalinter - Run MegaLinter locally via Docker"
@echo " help - Show this help message"
Loading
Loading