Skip to content

Commit abd6845

Browse files
committed
fix: disable resource templates for now
Signed-off-by: Liam Stanley <[email protected]>
1 parent f79e351 commit abd6845

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ This allows you to utilize the MCP server from anywhere, without installing anyt
8888
- Provides `resolve-library-uri` and `search-library-docs` tools for finding libraries, and searching their documentation.
8989
- Provides multiple resources, including:
9090
- `context7://libraries` - returns high-level information about all libraries.
91-
- `context7://libraries/<project>`
91+
- `context7://libraries/<project>` (**TODO**: not fully functional in upstream SDK)
9292
- `context7://libraries/top/<n>` - returns the top `n` libraries, sorted by trust score (if available), otherwise by stars.
93-
93+
- Currently utilizing [mcp-go](https://github.com/mark3labs/mcp-go), however, will be replaced with the official Go MCP sdk in the future.
9494
---
9595

9696
## :gear: Usage
@@ -101,8 +101,8 @@ If you'd like to run context7-http yourself, use the following:
101101
$ context7-http \
102102
--debug \
103103
--bind-addr "0.0.0.0:8080" \
104-
--base-url https://context7.liam.sh \ # only needed if using sse, http streamable doesn't need this
105-
--trusted-proxies "x-forwarded-for,10.0.0.0/8 \ # if behind a reverse proxy
104+
--base-url https://context7.your-domain.com \ # only needed if using sse, http streamable doesn't need this
105+
--trusted-proxies "x-forwarded-for,10.0.0.0/8" \ # if behind a reverse proxy
106106
--heartbeat-interval 55s # for those with spotty networks or annoying network proxies
107107
```
108108

internal/mcpserver/resource_libraries.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import (
1717
func (s *Server) resourceLibrariesAll() (resource mcp.Resource, handler server.ResourceHandlerFunc) {
1818
resource = mcp.NewResource(
1919
"context7://libraries",
20-
"Retrieves all known and tracked libraries.",
20+
"get-libraries-all",
2121
mcp.WithMIMEType("application/json"),
22+
mcp.WithResourceDescription("Lists all known and tracked libraries."),
2223
)
2324

2425
return resource, func(ctx context.Context, _ mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {
@@ -33,8 +34,9 @@ func (s *Server) resourceLibrariesAll() (resource mcp.Resource, handler server.R
3334
func (s *Server) resourceLibrariesTop(top int) (resource mcp.Resource, handler server.ResourceHandlerFunc) {
3435
resource = mcp.NewResource(
3536
"context7://libraries/top/"+strconv.Itoa(top),
36-
"Lists top "+strconv.Itoa(top)+" libraries, sorted by trust score (if available), otherwise by stars.",
37+
"get-libraries-top-"+strconv.Itoa(top),
3738
mcp.WithMIMEType("application/json"),
39+
mcp.WithResourceDescription("Lists top "+strconv.Itoa(top)+" libraries, sorted by trust score (if available), otherwise by stars."),
3840
)
3941

4042
return resource, func(ctx context.Context, _ mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {
@@ -49,7 +51,9 @@ func (s *Server) resourceLibrariesTop(top int) (resource mcp.Resource, handler s
4951
func (s *Server) resourceLibrary() (template mcp.ResourceTemplate, handler server.ResourceTemplateHandlerFunc) {
5052
template = mcp.NewResourceTemplate(
5153
"context7://libraries/{project}",
52-
"Retrieves information about a specific library.",
54+
"get-library-info",
55+
mcp.WithTemplateMIMEType("application/json"),
56+
mcp.WithTemplateDescription("Retrieves information about a specific library."),
5357
)
5458

5559
return template, func(ctx context.Context, request mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {

internal/mcpserver/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ func New(_ context.Context, version string, client *api.Client) (*Server, error)
2424
MCPServer: server.NewMCPServer(
2525
name,
2626
version,
27-
// server.WithInstructions(),
2827
server.WithRecovery(),
2928
server.WithToolCapabilities(false),
3029
server.WithHooks(loggingHooks(nil)),
@@ -37,7 +36,8 @@ func New(_ context.Context, version string, client *api.Client) (*Server, error)
3736
srv.AddResource(srv.resourceLibrariesAll())
3837
srv.AddResource(srv.resourceLibrariesTop(500))
3938
srv.AddResource(srv.resourceLibrariesTop(1000))
40-
srv.AddResourceTemplate(srv.resourceLibrary()) // TODO: is this just for searching?
39+
// Non-functional at this time.
40+
// srv.AddResourceTemplate(srv.resourceLibrary())
4141

4242
srv.baseVariables = map[string]any{
4343
"ServerName": name,

0 commit comments

Comments
 (0)