Closes:#6
Adds dynamic repository resources, providing the following templates:
repo://{owner}/{repo}/contents{/path*}repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}repo://{owner}/{repo}/sha/{sha}/contents{/path*}repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}repo://{owner}/{repo}/refs/pull/{pr_number}/head/contents{/path*}
Also the file mime type is not provided so we are using a best effort from the file extension, and using that to decide whether to send text or blob data to the consumer.
Another quirk of this, is that if you get a directory, you get the directory listing... I'm not sure if that's correct, but I have no other way to provide discovery, short of requesting all the files and returning them all too - and that seems way to greedy, even if paginated so that might need some thinking if we aren't ok with the folders returning the list of their content, rather than the actual content itself:

Also open to feedback regarding every part of this so far.
resources/templates/list
Request
echo '{"jsonrpc":"2.0","id":3,"params":{},"method":"resources/templates/list"}' | go run cmd/server/main.go stdio | jq .
Response
GitHub MCP Server running on stdio{ "jsonrpc": "2.0", "id": 3, "result": { "resourceTemplates": [ { "uriTemplate": "repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}", "name": "Repository Content for specific branch" }, { "uriTemplate": "repo://{owner}/{repo}/sha/{sha}/contents{/path*}", "name": "Repository Content for specific commit" }, { "uriTemplate": "repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}", "name": "Repository Content for specific tag" }, { "uriTemplate": "repo://{owner}/{repo}/refs/pull/{pr_number}/head/contents{/path*}", "name": "Repository Content for specific pull request" }, { "uriTemplate": "repo://{owner}/{repo}/contents{/path*}", "name": "Repository Content" } ] }}
resources/read
Request Folder
echo '{"jsonrpc":"2.0","id":3,"params":{"uri": "repo://mark3labs/mcp-go/contents/server"},"method":"resources/read"}' | go run cmd/server/main.go stdio | jq .
Response Folder
GitHub MCP Server running on stdio{ "jsonrpc": "2.0", "id": 3, "result": { "contents": [ { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/server.go", "mimeType": "file", "text": "server.go" }, { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/server_test.go", "mimeType": "file", "text": "server_test.go" }, { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/sse.go", "mimeType": "file", "text": "sse.go" }, { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/sse_test.go", "mimeType": "file", "text": "sse_test.go" }, { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/stdio.go", "mimeType": "file", "text": "stdio.go" }, { "uri": "https://github.com/mark3labs/mcp-go/blob/main/server/stdio_test.go", "mimeType": "file", "text": "stdio_test.go" } ] }}
Request File
echo '{"jsonrpc":"2.0","id":3,"params":{"uri": "repo://mark3labs/mcp-go/contents/README.md"},"method":"resources/read"}' | go run cmd/server/main.go stdio | jq .echo '{"jsonrpc":"2.0","id":3,"params":{"uri": "repo://mark3labs/mcp-go/contents/README.md"},"method":"resources/read"}' | go run cmd/server/main.go stdio | jq .
Response File
GitHub MCP Server running on stdio{ "jsonrpc": "2.0", "id": 3, "result": { "contents": [ { "uri": "repo://mark3labs/mcp-go/contents/README.md", "mimeType": "file", "text": "<!-- omit in toc -->\n# MCP Go 🚀\n[](https://github.com/mark3labs/mcp-go/actions/workflows/ci.yml)\n[](https://goreportcard.com/report/github.com/mark3labs/mcp-go)\n[](https://pkg.go.dev/github.com/mark3labs/mcp-go)\n\n<div align=\"center\">\n\n<strong>A Go implementation of the Model Context Protocol (MCP)..." } ] }}
Uh oh!
There was an error while loading.Please reload this page.
Closes:#6
Adds dynamic repository resources, providing the following templates:
Also the file mime type is not provided so we are using a best effort from the file extension, and using that to decide whether to send text or blob data to the consumer.
Another quirk of this, is that if you get a directory, you get the directory listing... I'm not sure if that's correct, but I have no other way to provide discovery, short of requesting all the files and returning them all too - and that seems way to greedy, even if paginated so that might need some thinking if we aren't ok with the folders returning the list of their content, rather than the actual content itself:
Also open to feedback regarding every part of this so far.
resources/templates/list
Request
Response
resources/read
Request Folder
Response Folder
Request File
Response File