repowise-server

June 22, 2026 · View on GitHub

FastAPI REST API, webhook handlers, MCP server, and background job scheduler for repowise. This package powers the repowise serve command and the Next.js web UI backend.

Python >= 3.11 · Apache-2.0


What's in this package

ComponentDescription
REST APIFastAPI application with full CRUD for repos, pages (with version history), symbols, jobs, git analytics, dead code, decisions, graph intelligence, blast radius, costs, knowledge map, security findings, providers, chat, CLAUDE.md generation, and multi-repo workspace
MCP Server16 MCP tools for AI coding assistants (Claude Code, Cursor, Cline)
WebhooksGitHub and GitLab push event handlers — trigger sync jobs automatically on push
SchedulerAPScheduler background jobs — polling fallback (auto-syncs diverged repos), stale page detection

Installation

pip install repowise-server

# Recommended: use uv
uv pip install repowise-server

Installs fastapi, uvicorn[standard], mcp, apscheduler, cryptography, and repowise-core automatically.


Running the Server

# Via the CLI (recommended)
repowise serve                             # localhost:7337
repowise serve --host 0.0.0.0 --port 8080

# Directly with uvicorn
uvicorn repowise.server.app:create_app --factory --port 7337

# With hot reload (development)
uvicorn repowise.server.app:create_app --factory --reload --port 7337

Interactive API docs are available at http://localhost:7337/docs once the server is running.


Configuration

All configuration is via environment variables:

VariableDefaultDescription
REPOWISE_DB_URLsqlite+aiosqlite:///.repowise/wiki.dbDatabase URL (SQLite or PostgreSQL)
REPOWISE_API_KEY(none)Bearer token required on all API requests (leave unset to disable auth)
REPOWISE_EMBEDDERmockEmbedder backend: mock (FTS only) or gemini (real semantic search)
REPOWISE_WEBHOOK_SECRET(none)HMAC-SHA256 secret for verifying GitHub/GitLab webhook signatures
ANTHROPIC_API_KEY(none)Anthropic API key (required for Anthropic provider jobs)
OPENAI_API_KEY(none)OpenAI API key (required for OpenAI provider jobs)

REST API

All endpoints are prefixed with /api/. When REPOWISE_API_KEY is set, every request must include an Authorization: Bearer <key> header.

Repositories

MethodPathDescription
GET/api/reposList all registered repositories
POST/api/reposRegister a new repository
GET/api/repos/{id}Get repository details and sync state
PATCH/api/repos/{id}Update repository settings (name, branch, provider)
POST/api/repos/{id}/syncRe-index and regenerate only affected pages (graph, git, dead code, decisions + incremental page regen)
POST/api/repos/{id}/full-resyncFull re-generation of all pages from scratch (equivalent to repowise init)

Pages

MethodPathDescription
GET/api/pagesList wiki pages, with optional repo_id and page_type filters
GET/api/pages/lookupLook up a page by repo_id + page_id query params
POST/api/pages/lookup/regenerateRegenerate a single page on demand
GET/api/pages/{id}/versionsFull version history for a page

Jobs

MethodPathDescription
GET/api/jobsList generation jobs (supports repo_id filter)
GET/api/jobs/{id}Get job status and progress
GET/api/jobs/{id}/streamSSE stream of real-time job progress events

Job progress events (JobProgressEvent) carry: event type, file currently being processed, level in the generation hierarchy, completed and total counts, elapsed time, and a final summary on completion.

Symbols

MethodPathDescription
GET/api/symbolsList/search symbols with repo_id, kind, language, query filters
GET/api/symbols/{id}Get symbol details including signature and source location

Graph

MethodPathDescription
GET/api/graph/{repo_id}Export dependency graph as nodes + edges (supports language and test filters)
GET/api/graph/{repo_id}/pathShortest dependency path between two modules
GET/api/graph/{repo_id}/modulesCollapsed directory-level module graph with doc coverage
GET/api/graph/{repo_id}/egoN-hop neighborhood of a given node with git metadata
GET/api/graph/{repo_id}/entry-pointsSubgraph reachable within 3 hops from entry-point nodes
GET/api/graph/{repo_id}/dead-nodesHigh-confidence unreachable files with 1-hop neighbors
GET/api/graph/{repo_id}/hot-filesMost-committed files with 1-hop outgoing neighbors
GET/api/graph/{repo_id}/nodes/searchFull-text search over node IDs
GET/api/graph/{repo_id}/communitiesList all communities with labels, cohesion scores, member counts
GET/api/graph/{repo_id}/communities/{id}Community detail: members, neighboring communities, cross-edge counts
GET/api/graph/{repo_id}/metricsGraph metrics with percentile ranks for any file or symbol
GET/api/graph/{repo_id}/callers-calleesCallers and callees for a symbol, with heritage support
GET/api/graph/{repo_id}/execution-flowsTop entry points with BFS call-path traces

Git Analytics

MethodPathDescription
GET/api/git/{repo_id}/metadataPer-file git metadata (ownership, commit count, co-change partners)
GET/api/git/{repo_id}/hotspotsFiles ranked by churn rate (most frequently changed)
GET/api/git/{repo_id}/ownershipCode ownership breakdown by file or module granularity
GET/api/git/{repo_id}/co-changesFiles that frequently change together (temporal coupling)
GET/api/git/{repo_id}/summaryRecent commit activity summary

Dead Code

MethodPathDescription
GET/api/dead-code/{repo_id}List dead code findings (supports kind and safe_only filters)
POST/api/dead-code/{repo_id}/analyzeTrigger dead code analysis
GET/api/dead-code/{repo_id}/summarySummary stats (total findings, deletable lines, by kind)
PATCH/api/dead-code/{id}Update a finding's status: resolved, acknowledged, or dismissed

Decisions

MethodPathDescription
GET/api/repos/{id}/decisionsList decision records (supports status, source, tag, module filters)
GET/api/repos/{id}/decisions/healthDecision health summary — active, proposed, stale counts, ungoverned hotspots
GET/api/repos/{id}/decisions/{decisionId}Get a single decision record with full context
POST/api/repos/{id}/decisionsCreate a decision record manually
PATCH/api/repos/{id}/decisions/{decisionId}Update decision status (active, deprecated, superseded)
MethodPathDescription
POST/api/searchSearch wiki pages. Body: `{"query": "...", "repo_id": "...", "mode": "fts

Blast Radius

MethodPathDescription
POST/api/repos/{repo_id}/blast-radiusEstimate PR impact for a list of changed files — returns overall risk score, direct/transitive risks, co-change warnings, recommended reviewers, and test gaps

Costs

MethodPathDescription
GET/api/repos/{repo_id}/costs/summaryAll-time totals: cost (USD), call count, input/output token counts
GET/api/repos/{repo_id}/costsPer-group breakdown of LLM usage with `by=day

Knowledge Map

MethodPathDescription
GET/api/repos/{repo_id}/knowledge-mapBus-factor / silo / freshness intelligence — files owned by single contributors, knowledge concentration risk

Security

MethodPathDescription
GET/api/repos/{repo_id}/securityList security findings (filterable by kind/severity)

Chat

MethodPathDescription
POST/api/repos/{repo_id}/chat/messagesSend a chat message; SSE streams the assistant reply with tool calls and source citations
GET/api/repos/{repo_id}/chat/conversationsList saved conversations for a repo
GET/api/repos/{repo_id}/chat/conversations/{conversation_id}Fetch a full conversation with its messages
DELETE/api/repos/{repo_id}/chat/conversations/{conversation_id}Delete a conversation

CLAUDE.md Generation

MethodPathDescription
GET/api/repos/{repo_id}/claude-mdFetch the latest generated CLAUDE.md content for the repo
POST/api/repos/{repo_id}/claude-md/generateTrigger a fresh CLAUDE.md generation job (returns 202 with job id)

Providers

MethodPathDescription
GET/api/providersList available LLM providers and which one is active
PATCH/api/providers/activeSwitch the active provider
POST/api/providers/{provider_id}/keyStore an encrypted API key for the provider
DELETE/api/providers/{provider_id}/keyRemove the stored API key

Workspace (Multi-Repo)

MethodPathDescription
GET/api/workspaceWorkspace summary — registered repos with per-repo stats, cross-repo and contract summaries
GET/api/workspace/co-changesCross-repo co-change pairs (files in different repos that frequently change together)
GET/api/workspace/contractsDetected API contracts (HTTP/gRPC/topic) and their provider/consumer file links

Webhooks

MethodPathDescription
POST/api/webhooks/githubGitHub push event handler
POST/api/webhooks/gitlabGitLab push event handler

Health

MethodPathDescription
GET/api/healthServer health — db connectivity, embedder info, scheduler status

MCP Server

repowise exposes 10 MCP tools for AI coding assistants. Start the MCP server via:

repowise mcp                          # stdio transport (Claude Code, Cursor, Cline)
repowise mcp --transport streamable-http  # HTTP transport on port 7338
repowise mcp --transport sse          # legacy SSE transport on port 7338
ToolWhat It AnswersWhen to Call
get_overviewArchitecture summary, module map, entry points, community summaryFirst call when exploring an unfamiliar codebase
get_context(targets)Docs, ownership, history, decisions, freshness for files/modules/symbolsWhen you need to understand specific code before reading or modifying it
get_risk(targets)Hotspot score, dependents, co-change partners, risk summaryBefore modifying files — assess what could break
get_why(query?)Architectural decisions, rationale, constraintsBefore making architectural changes — understand existing intent
search_codebase(query, mode?)Hybrid symbol / path / concept search (auto-routes by query shape)When locating a symbol, a file, or code by topic
get_dependency_path(from, to)Connection path between two files/modulesWhen you need to understand how two things are connected
get_dead_codeUnused/unreachable code sorted by cleanup impactBefore cleanup tasks
get_answer(question)One-call RAG with confidence gating and cachingFirst call on any code question
get_symbol(symbol_id)Source body, signature, docstring for a qualified symbolWhen the question names a specific function or class
get_execution_flows(top_n?)Entry point scoring with BFS call-path tracesUnderstanding how the codebase executes

Claude Code / Cursor / Cline setup — add to your MCP config:

{
  "mcpServers": {
    "repowise": {
      "command": "repowise",
      "args": ["mcp", "/absolute/path/to/your/repo"]
    }
  }
}

Webhooks

Register the webhook URL with GitHub or GitLab so repowise update runs automatically on every push.

GitHub setup:

  1. Go to Settings → Webhooks → Add webhook in your GitHub repository
  2. Set Payload URL to https://your-server.example.com/api/webhooks/github
  3. Set Content type to application/json
  4. Set Secret to the value of REPOWISE_WEBHOOK_SECRET
  5. Select Just the push event

GitLab setup:

  1. Go to Settings → Webhooks in your GitLab project
  2. Set URL to https://your-server.example.com/api/webhooks/gitlab
  3. Set Secret token to the value of REPOWISE_WEBHOOK_SECRET
  4. Enable Push events

The server verifies HMAC-SHA256 signatures, deduplicates events (stored in the webhook_events table), and launches a background sync job that re-indexes the repo and regenerates only affected wiki pages.


Background Jobs

The APScheduler instance manages the following recurring tasks:

JobScheduleDescription
Staleness checkEvery 15 minutesFinds stale/expired wiki pages and logs them for monitoring
Polling fallbackEvery 15 minutesCompares git HEAD against state.json for all repos; enqueues and launches sync jobs for any that have diverged (catches missed webhooks)

Development

# Install for development (from repo root)
uv pip install -e packages/server -e packages/core

# Start with hot reload
uvicorn repowise.server.app:create_app --factory --reload --port 7337

# Run tests
pytest tests/unit/server/ tests/integration/