Problem
get_wiki_page returns 404 for wiki pages when the caller passes the page title (as displayed in list_wiki_pages output) instead of the sub_url slug.
Steps to reproduce
- Create a wiki page with title
architecture/signal-processing-strategies
- Call
list_wiki_pages — returns the page with title: "architecture/signal-processing-strategies" and sub_url: "architecture%2Fsignal-processing-strategies.-"
- Call
get_wiki_page(pageName="architecture/signal-processing-strategies") — 404
- Call
get_wiki_page(pageName="architecture%2Fsignal-processing-strategies.-") — 200 OK
Root cause
In tools/client_wiki.go, MyGetWikiPage constructs the URL as:
endpoint := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/page/%s", owner, repo, pageName)
The pageName is passed through verbatim — no URL encoding, no slug transformation. But the Gitea API expects the sub_url slug at this endpoint, not the display title.
Impact
This makes get_wiki_page effectively unusable in MCP client workflows where the agent:
- Lists pages via
list_wiki_pages
- Sees a title like
architecture/foo
- Naturally passes that title to
get_wiki_page
- Gets a 404
The agent has no way to know it needs the sub_url format unless it parses the raw API response (which the MCP tool abstracts away).
Suggested fixes (either would work)
Option A: Accept title, convert to slug internally
- In
get_wiki_page, convert the input pageName to a slug using Gitea's NameToSubURL logic (URL-encode slashes, handle space↔hyphen conversion)
- This is the most user-friendly approach
Option B: Expose sub_url in list output and document the requirement
- When
list_wiki_pages renders its markdown output, include the sub_url for each page
- Document that
get_wiki_page requires sub_url, not title
- Less ideal since it requires the caller to always list first
Option C: Try both
- First try the pageName as-is
- If 404, URL-encode slashes and retry
- Graceful fallback
Environment
- Gitea 1.25.4
- forgejo-mcp v0.0.7
- MCP client: Claude Code
Problem
get_wiki_pagereturns 404 for wiki pages when the caller passes the page title (as displayed inlist_wiki_pagesoutput) instead of the sub_url slug.Steps to reproduce
architecture/signal-processing-strategieslist_wiki_pages— returns the page withtitle: "architecture/signal-processing-strategies"andsub_url: "architecture%2Fsignal-processing-strategies.-"get_wiki_page(pageName="architecture/signal-processing-strategies")— 404get_wiki_page(pageName="architecture%2Fsignal-processing-strategies.-")— 200 OKRoot cause
In
tools/client_wiki.go,MyGetWikiPageconstructs the URL as:The
pageNameis passed through verbatim — no URL encoding, no slug transformation. But the Gitea API expects thesub_urlslug at this endpoint, not the display title.Impact
This makes
get_wiki_pageeffectively unusable in MCP client workflows where the agent:list_wiki_pagesarchitecture/fooget_wiki_pageThe agent has no way to know it needs the
sub_urlformat unless it parses the raw API response (which the MCP tool abstracts away).Suggested fixes (either would work)
Option A: Accept title, convert to slug internally
get_wiki_page, convert the inputpageNameto a slug using Gitea'sNameToSubURLlogic (URL-encode slashes, handle space↔hyphen conversion)Option B: Expose sub_url in list output and document the requirement
list_wiki_pagesrenders its markdown output, include thesub_urlfor each pageget_wiki_pagerequiressub_url, not titleOption C: Try both
Environment