146 Commits
Author SHA1 Message Date
gitea-mcp-bot 052827320a test(file_write_branch): cover POST-on-create and PUT-on-update routing
CD / Lint / Test / Vet (pull_request) Successful in 6s
CD / Build & Import (pull_request) Has been skipped
CD / Deploy via GitOps (pull_request) Has been skipped
2026-05-06 14:05:23 +00:00
gitea-mcp-bot c85197ea5e fix(files): route UpsertFile to POST when sha is empty so new files can be created 2026-05-06 14:04:36 +00:00
mathias c345025221 fix(lint): staticcheck S1030, QF1002 and remove unused _ctx stub
CD / Lint / Test / Vet (push) Successful in 4s
CD / Build & Import (push) Successful in 12s
CD / Deploy via GitOps (push) Has been skipped
v0.1.2
2026-05-05 09:02:39 +02:00
mathias 64559f0250 fix(lint): check Body.Close error return in http client
CD / Lint / Test / Vet (push) Failing after 2s
CD / Build & Import (push) Has been skipped
CD / Deploy via GitOps (push) Has been skipped
v0.1.1
2026-05-05 08:55:31 +02:00
mathias b8463d66a0 chore: drop environment: staging (no-op for solo homelab)
CD / Lint / Test / Vet (push) Failing after 2s
CD / Build & Import (push) Has been skipped
CD / Deploy via GitOps (push) Has been skipped
v0.1.0
2026-05-05 08:51:17 +02:00
mathias d261a9f3fe feat: gitea actions cd.yml (cobalt-dingo pattern) 2026-05-05 07:52:45 +02:00
mathias 09b3f25211 chore: add check task for CI 2026-05-05 07:52:39 +02:00
mathias a8d04242d9 feat: dockerfile 2026-05-05 07:52:29 +02:00
mathias 1f9934349b chore(tools): centralize pagination cap helper 2026-05-04 23:06:38 +02:00
mathias 4274b48ea5 feat(gitea): default-branch lru cache
Shared LRU avoids repeated Gitea calls for default-branch resolution;
the simple stdlib map alternative would race on concurrent access without
a mutex per entry, which is more code than the LRU.
2026-05-04 23:06:06 +02:00
mathias fb473262ba feat(gitea): read retry once on 5xx GET 2026-05-04 23:04:55 +02:00
mathiasandClaude Sonnet 4.6 39dc22ec3a feat(tools): create_project_from_template
Generates a new repo from mathias/template-go-web via Gitea's generate
API, then substitutes __PROJECT_NAME__ and __MODULE_PATH__ placeholders
in six known files (best-effort, partial failure surfaced in result).

Validates name regex, allowlist, template flag, and destination
non-existence before generating. Adds Template field to gitea.Repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 23:02:21 +02:00
mathiasandClaude Sonnet 4.6 e95e87e8e3 feat(tools): pr_files_diff with caps
Returns per-file unified diff for a PR, capped at 20KB/file and 200KB
total response. Files exceeding per-file cap report truncated+omitted_lines;
files that would push the response over 200KB go to omitted_files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:57:11 +02:00
mathiasandClaude Sonnet 4.6 d3d0fed6b1 feat(tools): pr_comment with identity footer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:53:14 +02:00
mathiasandClaude Sonnet 4.6 c8a353aa35 feat(tools): issue_comment with identity footer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:52:24 +02:00
mathiasandClaude Sonnet 4.6 6f43ff216f feat(tools): issue_create with identity footer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:51:40 +02:00
mathiasandClaude Sonnet 4.6 2c6b9986e4 feat(tools): code_search (org-wide fan-out)
When repo is omitted, lists owner's repos then concurrently searches
each one (semaphore cap 5, 5s per-repo timeout). Merges and sorts
hits by score desc with deterministic tiebreak. Partial failures
tracked in partial_repos without aborting the whole fan-out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:48:39 +02:00
mathiasandClaude Sonnet 4.6 e4a9d058f0 feat(tools): code_search (single-repo)
Adds SearchCode to gitea.Client and code_search MCP tool for single-repo
code search via GET /api/v1/repos/{owner}/{repo}/search?type=code.
Fan-out placeholder returns ErrValidation (lands in 7.3).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:47:33 +02:00
mathiasandClaude Sonnet 4.6 61cce37ff5 feat(tools): repo_search with allowlist post-filter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:44:44 +02:00
mathias 43e016e8fa feat(tools): workflow_run_status 2026-05-04 22:25:23 +02:00
mathias ba172e3db8 feat(tools): workflow_run_trigger 2026-05-04 22:25:10 +02:00
mathias c4874ae8d1 feat(tools): pr_get 2026-05-04 22:21:20 +02:00
mathias 9972dcd94e feat(tools): pr_create with identity footer 2026-05-04 22:20:33 +02:00
mathiasandClaude Sonnet 4.6 5af8addc26 feat(tools): file_write_branch
Add BranchExists/CreateBranch/UpsertFile gitea client methods and the
file_write_branch MCP tool. Branch is auto-created from base (or repo
default_branch) when it doesn't exist; file is upserted via PUT contents.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:15:39 +02:00
mathiasandClaude Sonnet 4.6 044086b067 feat(tools): file_read with default-branch resolution
Adds GetFileContents to the gitea client and a file_read MCP tool.
When ref is omitted, the tool resolves the repo default_branch via
GetRepo before fetching contents. Decoded content capped at 1 MiB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 22:11:50 +02:00
mathias f10cc9ac4b feat(tools): repo_get 2026-05-04 22:08:24 +02:00
mathias 33ad02d369 feat(tools): repo_list 2026-05-04 22:07:44 +02:00
Mathias Bergqvist 18eadc0ae9 feat(tools): tool interface + helpers 2026-05-04 21:27:50 +02:00
mathias 4ebb1eef6d feat(allowlist): owner allowlist enforcement 2026-05-04 21:26:50 +02:00
mathias d564cdcae3 feat(gitea): typed error mapping from http status 2026-05-04 21:26:29 +02:00
mathias 2ecffd1b7a feat(gitea): base http client with token auth 2026-05-04 21:26:03 +02:00
mathias 4dba4ca192 feat(main): wire caller middleware into /mcp 2026-05-04 21:20:37 +02:00
mathias 3613c36afb feat(identity): created-content footer 2026-05-04 21:05:42 +02:00
mathias 0b5daca198 feat(auth): X-Auth-Request-User context middleware 2026-05-04 21:05:16 +02:00
mathiasandClaude Sonnet 4.6 c6c328e517 fix(mcp): map tool-not-found to CodeNotFound via registry sentinel
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:59:15 +02:00
mathiasandClaude Sonnet 4.6 93c5a6934b feat(mcp): cap inbound request body at 1 MiB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:58:36 +02:00
mathiasandClaude Sonnet 4.6 ba5068648b refactor(mcp): compose origin allowlist as middleware, remove duplication
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:58:08 +02:00
mathiasandClaude Sonnet 4.6 36765b8360 feat(mcp): streamable HTTP transport with session, init, and dispatch
Implements the Streamable HTTP transport: POST routing handles initialize
(issues session ID), tools/list, tools/call, and unknown methods; GET SSE
emits a keepalive comment then blocks on context cancellation. A minimal
registry stub is introduced so the server compiles and tools/list returns
an empty array until Phase 6+ registers real tools.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:49:54 +02:00
mathiasandClaude Sonnet 4.6 50a3b27825 test(mcp): pin session concurrency, document error codes, assert id round-trip
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:46:07 +02:00
mathias ea19516109 feat(mcp): origin allowlist middleware 2026-05-04 20:41:21 +02:00
mathias cf2017e687 feat(mcp): session id store 2026-05-04 20:40:53 +02:00
mathias abaf5e8b1d feat(mcp): jsonrpc envelope types and error codes 2026-05-04 20:40:29 +02:00
mathias 87cbce27a1 test(config): pin splitCSV whitespace and empty-entry handling 2026-05-04 20:25:28 +02:00
mathiasandClaude Sonnet 4.6 d399a216c1 feat(config): env-var loading
Add internal/config package with Config struct and Load() function.
Reads GITEA_BASE_URL, GITEA_API_TOKEN, GITEA_MCP_ALLOWED_OWNERS,
GITEA_MCP_ORIGIN_ALLOWLIST, GITEA_MCP_PORT with sensible defaults.
Wire cfg.Port into main.go. TDD: tests written first, then impl.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:19:31 +02:00
mathiasandClaude Sonnet 4.6 a77fa7506b feat: initial scaffold with /healthz
Go module gitea.d-ma.be/mathias/gitea-mcp, minimal HTTP server with a
/healthz probe, Taskfile build targets, and .gitignore/README updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:13:41 +02:00
mathias 1eabd5982f Initial commit 2026-05-04 17:17:17 +00:00