Skip to content

Commit f9e9d54

Browse files
authored
fix: improve MCP resources disabling (#32)
Handle additional cases which caused Cursor to not work.
1 parent da1af7c commit f9e9d54

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ To set up MCP in Cursor, follow their guide:
149149

150150
👉 [Cursor Documentation on Model Context Protocol](https://docs.cursor.com/context/model-context-protocol)
151151

152+
> [!IMPORTANT]
153+
> Cursor **does not support MCP resources** yet.
154+
This MCP server uses resources heavily, so **it will not work in Cursor** unless you explicitly disable resource usage.
155+
156+
To make it work, you **must** set the following environment variable:
157+
158+
```
159+
FIREBOLT_MCP_DISABLE_RESOURCES=true
160+
```
161+
152162
#### Using SSE Transport
153163
154164
By default, the MCP Server uses STDIO as the transport mechanism.

pkg/server/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func NewServer(
8989
"tool call finished",
9090
slog.Any("id", id),
9191
slog.String("tool", message.Params.Name),
92-
slog.Any("any", result.Result),
9392
)
9493
})
9594
hooks.AddOnError(func(ctx context.Context, id any, method mcp.MCPMethod, message any, err error) {

pkg/tools/docs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ func (t *Docs) Handler(ctx context.Context, request mcp.CallToolRequest) (*mcp.C
7575
val, ok := request.GetArguments()["articles"]
7676
if ok && val != nil {
7777
articleIDs = val.([]any)
78-
} else {
79-
// Default articles to return if none specified
78+
}
79+
80+
// Default articles to return if none specified
81+
if len(articleIDs) == 0 {
8082
articleIDs = append(
8183
articleIDs,
8284
resources.DocsArticleOverview, // General Firebolt overview

pkg/tools/tools.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package tools
22

3-
import "github.com/mark3labs/mcp-go/mcp"
3+
import (
4+
"github.com/mark3labs/mcp-go/mcp"
5+
)
46

57
// textOrResourceContent returns a text content if disableResources is true, otherwise returns an embedded resource.
68
func textOrResourceContent(disableResources bool, i mcp.ResourceContents) mcp.Content {
79

810
if disableResources {
9-
textResource, ok := i.(mcp.TextResourceContents)
10-
if ok {
11-
return mcp.NewTextContent(textResource.Text)
11+
switch resource := i.(type) {
12+
case mcp.TextResourceContents:
13+
return mcp.NewTextContent(resource.Text)
14+
case *mcp.TextResourceContents:
15+
return mcp.NewTextContent(resource.Text)
1216
}
1317
}
1418

0 commit comments

Comments
 (0)