Skip to content

More comprehensive docs #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 7, 2025
Merged

More comprehensive docs #374

merged 25 commits into from
Jun 7, 2025

Conversation

ezynda3
Copy link
Contributor

@ezynda3 ezynda3 commented Jun 7, 2025

Description

Fixes #<issue_number> (if applicable)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • MCP spec compatibility implementation
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Tests only (no functional changes)
  • Other (please describe):

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly

MCP Spec Compliance

  • This PR implements a feature defined in the MCP specification
  • Link to relevant spec section: Link text
  • Implementation follows the specification exactly

Additional Information

Summary by CodeRabbit

  • New Features

    • Comprehensive MCP-Go documentation added, including quick start guides, core concepts, detailed server and client development, transport options (STDIO, HTTP, SSE, In-Process), and advanced features.
    • Extensive client guides covering lifecycle management, error handling, retry strategies, context and timeout usage, connection health monitoring, and resilient client implementations.
    • In-depth transport documentation with configuration, usage examples, authentication, session management, and client integration.
    • Sidebar navigation reorganized with detailed, structured links for easier access to server, client, and transport topics.
  • Documentation

    • Expanded with practical examples, concurrency and error handling patterns, middleware, hooks, and integration scenarios.
    • Added troubleshooting, performance tuning, security best practices, and debugging instructions.
    • Removed the previous example page to unify content into comprehensive new documentation.

Copy link
Contributor

coderabbitai bot commented Jun 7, 2025

Warning

Rate limit exceeded

@ezynda3 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1db5bf1 and 29def34.

📒 Files selected for processing (2)
  • www/docs/pages/servers/prompts.mdx (1 hunks)
  • www/docs/pages/transports/stdio.mdx (1 hunks)

Walkthrough

This update introduces a comprehensive suite of documentation files for MCP-Go, covering client and server basics, advanced features, resources, tools, prompts, and all supported transports (STDIO, HTTP, SSE, In-Process). It adds detailed guides, code examples, error handling, lifecycle management, retry logic, health monitoring, and navigation improvements, while removing the previous example page.

Changes

Files/Paths Change Summary
www/docs/pages/clients/basics.mdx
www/docs/pages/clients/index.mdx
www/docs/pages/clients/operations.mdx
www/docs/pages/clients/transports.mdx
Added comprehensive documentation for MCP client creation, lifecycle, error handling, retry logic, health monitoring, transport-specific implementations, and usage patterns. Introduces new types and functions for managed clients, retry, health monitoring, and resilient clients.
www/docs/pages/core-concepts.mdx Added new documentation page explaining MCP core concepts, SDK architecture, and session management with code examples.
www/docs/pages/getting-started.mdx Expanded introduction, added detailed MCP/MCP-Go explanation, improved example code with idiomatic error handling.
www/docs/pages/quick-start.mdx Added a quick start guide for MCP-Go server/client creation, usage, testing, troubleshooting, and further resources.
www/docs/pages/servers/advanced.mdx
www/docs/pages/servers/basics.mdx
www/docs/pages/servers/index.mdx
www/docs/pages/servers/prompts.mdx
www/docs/pages/servers/resources.mdx
www/docs/pages/servers/tools.mdx
Added extensive documentation for MCP server basics, advanced features (typed tools, session management, middleware, hooks, notifications), implementing prompts, resources, and tools with code examples and patterns.
www/docs/pages/transports/http.mdx
www/docs/pages/transports/index.mdx
www/docs/pages/transports/inprocess.mdx
www/docs/pages/transports/sse.mdx
www/docs/pages/transports/stdio.mdx
Added detailed documentation on all supported transports (HTTP, STDIO, SSE, In-Process), including implementation, configuration, error handling, performance, security, and integration examples.
www/vocs.config.ts Major sidebar/navigation overhaul: removed "Example", added structured navigation for quick start, core concepts, servers, transports, and clients.
www/docs/pages/example.mdx Deleted obsolete example page.

Possibly related PRs

  • mark3labs/mcp-go#287: Refactors CallToolRequest argument handling, introducing accessor methods used in the new client documentation and abstractions.
  • mark3labs/mcp-go#265: Adds a simple example client demonstrating basic client usage with stdio and SSE transports, complementing the new client concepts and documentation.
  • mark3labs/mcp-go#114: Refactors core MCP client implementation with a pluggable transport interface, foundational to the client abstractions documented here.

Suggested labels

documentation

Suggested reviewers

  • robert-jackson-glean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 23

🧹 Nitpick comments (24)
www/vocs.config.ts (2)

21-48: Sidebar depth: consider collapsing long sections
The "Building MCP Servers" menu is extensive and displayed by default (collapsed: false). Consider setting it to collapsed: true to improve initial sidebar readability.


51-74: Sidebar depth: consider collapsing long sections
Similarly, the "Transport Options" section has multiple nested items and may overwhelm the sidebar. Collapsing it by default could improve navigation.

www/docs/pages/getting-started.mdx (1)

78-81: Clearer error handling in example
Using RequireString is a good improvement. Consider adding a brief note explaining why returning a ToolResultError (and a nil error) is preferred over a raw error return.

www/docs/pages/transports/index.mdx (1)

16-22: Transport comparison table formatting
The markdown table renders correctly; consider adding a trailing pipe (|) on each row for consistency, though it’s not strictly required.

www/docs/pages/clients/index.mdx (5)

196-204: Inconsistent NewStdioClient signature usage.
The quick-start passes multiple args ("go","run",…), but the manager uses only one parameter. Align these to match the actual NewStdioClient signature or clarify optional args.


237-266: Add reconnection example.
The placeholder // Implement reconnection logic should either be replaced with a minimal reconnect snippet or accompanied by a TODO so readers know how to proceed.


271-303: Enhance backoff with jitter.
Consider adding a small random jitter to the exponential backoff (time.Duration(rand.Intn(100))*time.Millisecond) to avoid synchronized retries across clients.


309-363: Provide cleanup method for LLMApplication.
LLMApplication holds an mcpClient but offers no Close or Shutdown. Add a method to properly close the client and free resources.


379-387: Expand transport support in AddServer.
Currently only HTTP and SSE are handled. To match the full client suite, include cases for STDIO and In-Process transports (or document why they're omitted).

Also applies to: 392-396

www/docs/pages/quick-start.mdx (1)

15-16: Remove unused import.
The "errors" package is imported but not used in the Hello World server snippet—delete it to keep the example clean.

www/docs/pages/servers/resources.mdx (2)

154-162: Validate URI parsing edge cases.
extractUserID silently returns "" on malformed URIs. Consider returning an error to highlight invalid input.


235-262: Add missing imports and status check.
Ensure url, os, http, and io are imported. Also verify resp.StatusCode before reading the body to handle non-2xx responses.

www/docs/pages/servers/tools.mdx (2)

225-231: Improve path validation.
Using strings.Contains(path, "..") is brittle. Prefer filepath.Clean and verify the cleaned path is within an allowed base directory.


351-360: Check HTTP response status code.
Before reading the body, verify resp.StatusCode is 2xx and handle non-OK responses explicitly.

www/docs/pages/servers/advanced.mdx (2)

346-347: Hyphenate compound adjective.

Consider using "Rate-Limiting Middleware" instead of "Rate Limiting Middleware" for clarity.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~346-~346: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... return result, err } } ### Rate Limiting Middleware go type RateLimitMiddlew...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


405-413: Clarify placeholder functions.

The AuthMiddleware example calls extractToken(ctx, req) without defining it. Add a note or link to a helper implementation for extractToken.

www/docs/pages/clients/transports.mdx (2)

25-39: Remove unused imports in the STDIO client example.
The basic STDIO snippet imports packages (crypto/tls, net/http, os, sync, time) that aren’t used here. Trimming imports improves clarity.

Example diff:

-import (
-    "context"
-    "crypto/tls"
-    "errors"
-    "fmt"
-    "log"
-    "net/http"
-    "os"
-    "sync"
-    "time"
-
-    "github.com/mark3labs/mcp-go/client"
-    "github.com/mark3labs/mcp-go/mcp"
-    "github.com/mark3labs/mcp-go/server"
-)
+import (
+    "context"
+    "log"
+
+    "github.com/mark3labs/mcp-go/client"
+)  

975-1013: Add “Next Steps” section to link related client docs.
This page covers transport implementations—consider adding a footer that points readers to the client basics and operations guides for a smooth learning path.

Example addition at the end:

## Next Steps

- [Client Basics](/clients/basics) – Lifecycle, retry logic, error handling  
- [Client Operations](/clients/operations) – Tool invocation, resource management  
www/docs/pages/transports/inprocess.mdx (2)

148-157: Ensure concurrent safety for memoryCache.
The global memoryCache map is accessed without synchronization, leading to potential data races in concurrent server scenarios. Guard it with a sync.RWMutex or use a thread-safe map.

Example:

var (
    memoryCache = make(map[string]interface{})
    cacheMu     sync.RWMutex
)
// ...
cacheMu.RLock()
value, exists := memoryCache[key]
cacheMu.RUnlock()
// ...
cacheMu.Lock()
memoryCache[key] = newValue
cacheMu.Unlock()

760-762: Refine “Next Steps” links for in-process transport.
The link to Client Development is broad—consider pointing directly to the “Client Transports” overview (/clients/transports). Also verify that /testing and /performance slugs exist.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~762-~762: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: .../clients)** - Build MCP clients for all transports - Testing - Comprehensi...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

www/docs/pages/clients/operations.mdx (2)

13-21: Remove unused imports in resource listing example.
The reflect import isn’t used in listResources. Cleaning up imports sharpens focus.

Example diff:

-import (
-    "base64"
-    "context"
-    "encoding/json"
-    "fmt"
-    "log"
-    "reflect"
-    "regexp"
-    "strings"
-    "sync"
-    "time"
-
-    "github.com/mark3labs/mcp-go/client"
-    "github.com/mark3labs/mcp-go/mcp"
-)
+import (
+    "context"
+    "fmt"
+    "log"
+    "regexp"
+    "strings"
+
+    "github.com/mark3labs/mcp-go/client"
+    "github.com/mark3labs/mcp-go/mcp"
+)  

70-78: Precompile regex for pattern-based filtering.
Calling regexp.Compile inside listResourcesByPattern each time is inefficient if used repeatedly. Move compilation out of the loop or cache the *regexp.Regexp.

www/docs/pages/transports/http.mdx (2)

157-161: Strengthen email validation.
The simple strings.Contains check in isValidEmail may allow malformed addresses. Recommend a regex or production-ready validation library.


841-896: Clarify placeholder tokens in cURL examples.
Readers may not realize Bearer your-token is a placeholder. Add a note to replace <YOUR_TOKEN> with a valid token.

Example:

# Replace <YOUR_TOKEN> with your actual JWT or API key
curl -H "Authorization: Bearer <YOUR_TOKEN>" ...
🧰 Tools
🪛 Gitleaks (8.26.0)

842-844: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


857-859: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


868-870: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


885-887: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 774b17b and bfbc228.

📒 Files selected for processing (20)
  • www/docs/pages/clients/basics.mdx (1 hunks)
  • www/docs/pages/clients/index.mdx (1 hunks)
  • www/docs/pages/clients/operations.mdx (1 hunks)
  • www/docs/pages/clients/transports.mdx (1 hunks)
  • www/docs/pages/core-concepts.mdx (1 hunks)
  • www/docs/pages/example.mdx (0 hunks)
  • www/docs/pages/getting-started.mdx (2 hunks)
  • www/docs/pages/quick-start.mdx (1 hunks)
  • www/docs/pages/servers/advanced.mdx (1 hunks)
  • www/docs/pages/servers/basics.mdx (1 hunks)
  • www/docs/pages/servers/index.mdx (1 hunks)
  • www/docs/pages/servers/prompts.mdx (1 hunks)
  • www/docs/pages/servers/resources.mdx (1 hunks)
  • www/docs/pages/servers/tools.mdx (1 hunks)
  • www/docs/pages/transports/http.mdx (1 hunks)
  • www/docs/pages/transports/index.mdx (1 hunks)
  • www/docs/pages/transports/inprocess.mdx (1 hunks)
  • www/docs/pages/transports/sse.mdx (1 hunks)
  • www/docs/pages/transports/stdio.mdx (1 hunks)
  • www/vocs.config.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • www/docs/pages/example.mdx
🧰 Additional context used
🪛 LanguageTool
www/docs/pages/transports/index.mdx

[uncategorized] ~10-~10: A punctuation mark might be missing here.
Context: ...nput/output for command-line tools - SSE - Server-Sent Events for web app...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


[grammar] ~237-~237: A determiner may be missing.
Context: ...t practices**: Validate all inputs, use least privilege ### Network Transports (SSE/...

(THE_SUPERLATIVE)


[grammar] ~241-~241: In this context, “per-request” forms an adjective and is spelled with a hyphen.
Context: ...Authorization: Validate permissions per request - Rate limiting: Prevent abuse and ...

(PER_USER_BASIS_HYPHEN)

www/docs/pages/core-concepts.mdx

[uncategorized] ~123-~123: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...rent deployment scenarios. Available transports: 1. Stdio - Standard input/outpu...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

www/docs/pages/servers/advanced.mdx

[uncategorized] ~346-~346: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... return result, err } } ### Rate Limiting Middleware go type RateLimitMiddlew...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

www/docs/pages/transports/inprocess.mdx

[uncategorized] ~762-~762: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: .../clients)** - Build MCP clients for all transports - Testing - Comprehensi...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

🪛 Gitleaks (8.26.0)
www/docs/pages/transports/http.mdx

842-844: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


857-859: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


868-870: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


885-887: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🔇 Additional comments (61)
www/vocs.config.ts (3)

13-15: Verify Quick Start page existence
Ensure that the /quick-start path corresponds to an actual MDX file (quick-start.mdx) to prevent dead links in the sidebar.


17-19: Verify Core Concepts page existence
Confirm that core-concepts.mdx exists and the link /core-concepts correctly maps to it.


77-96: Verify client docs paths
Check that all client documentation pages (/clients, /clients/basics, /clients/operations, /clients/transports) are present and correctly named.

www/docs/pages/getting-started.mdx (1)

3-21: Excellent introductory content and structure
The new Introduction, "What is MCP?", and "Why MCP Go?" sections provide clear context and flow well into the feature overview.

www/docs/pages/servers/basics.mdx (9)

1-6: Section header and description
The "Server Basics" header and opening sentence succinctly introduce the content.


11-28: First code example is clear
The basic server creation snippet is accurate and easy to follow.


35-43: Advanced server options example
The example for server options correctly demonstrates configuration capabilities.


81-87: Recovery middleware usage
The panic recovery example is correct and demonstrates best practices.


96-101: Custom metadata snippet
Adding instructions via WithInstructions is clear and accurate.


112-119: Stdio transport example
The stdio startup code properly handles errors and is consistent with other examples.


133-142: HTTP transport example
The HTTP server setup looks correct and the comments clarify its use cases.


157-166: SSE transport example
The SSE server configuration is accurate and easy to follow.


53-61: ⚠️ Potential issue

Invalid API usage in code snippet
server.WithResourceCapabilities(false, true) passes two booleans, but the method signature accepts a single bool. Adjust to two separate calls or correct the parameter list:

-server.WithResourceCapabilities(false, true),
+server.WithResourceCapabilities(false),
+server.WithPromptCapabilities(true),

Likely an incorrect or invalid review comment.

www/docs/pages/servers/index.mdx (1)

1-16: Overview and learning objectives
The introduction and "What You'll Learn" section effectively orient readers to the new "Building MCP Servers" guide.

www/docs/pages/transports/index.mdx (3)

1-13: High-level transport overview
The new "Transport Options" landing page gives a concise summary of all supported transports.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~10-~10: A punctuation mark might be missing here.
Context: ...nput/output for command-line tools - SSE - Server-Sent Events for web app...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


141-164: Parameterized transport startup
The startServer helper function demonstrates clean environment-based transport selection and error propagation.


169-213: Concurrent transport example
The multi-transport pattern using goroutines and an error channel is well-structured and illustrates best practices.

www/docs/pages/clients/index.mdx (5)

19-117: Approve quick example implementation.
The full demonstrateClientOperations snippet is clear, handles errors appropriately, and follows typical Go idioms.


129-132: Approve STDIO client snippet.
This concise example correctly illustrates how to instantiate an STDIO client.


141-144: Approve HTTP client snippet.
The HTTP client example is accurate and aligns with expected usage.


153-156: Approve SSE client snippet.
Clean and correct illustration of SSE client creation.


165-168: Approve In-Process client snippet.
The in-process client example is straightforward and correctly shows embedding a server.

www/docs/pages/quick-start.mdx (7)

9-55: Approve Hello World server example.
Clear, minimal, and demonstrates the core server setup and tool registration.


59-64: Approve setup commands.
The go mod init and go get instructions are accurate.


77-87: Approve Claude Desktop config example.
The JSON snippet is correctly formatted for both macOS and Windows.


96-103: Approve MCP Inspector usage snippet.
Concise and accurate instructions for installing and invoking the inspector.


110-171: Approve basic client example.
Illustrates client creation, initialization, tool listing, and invocation clearly.


174-215: Approve HTTP client example.
Accurately demonstrates HTTP transport usage.


227-242: Approve common issues section.
Covers key troubleshooting steps succinctly.

www/docs/pages/servers/resources.mdx (7)

11-19: Approve basic resource structure example.
The mcp.NewResource call and parameters are clear and correct.


29-43: Approve static file resource definition.
Good demonstration of adding a static file resource.


271-283: Approve text content handler example.
Simple and correct demonstration of returning plain text.


315-333: Approve binary content handler.
Correctly reads and encodes binary data.


340-369: Approve multi-format resource example.
Well-structured demonstration of multiple representations.


450-480: Approve resource listing example.
Clear example of batch registration of resources.


487-524: Approve caching resource handler.
Well-implemented thread-safe caching with TTL semantics.

www/docs/pages/core-concepts.mdx (9)

25-41: Approve resource concept example.
Accurately illustrates static vs dynamic resources.


60-78: Approve tool concept example.
Correctly depicts tool creation with typed parameters.


96-117: Approve prompt concept example.
Clear demonstration of prompt definitions.


140-149: Approve transport concept example.
Good summary of supported transports.


168-174: Approve SDK server architecture snippet.
Correctly shows server creation and usage.


185-190: Approve SDK client architecture snippet.
Simple and accurate client usage example.


203-215: Approve transport layer abstraction example.
Demonstrates switching transports at runtime well.


233-244: Approve session lifecycle example.
Clearly outlines session hooks and lifecycle.


249-263: Approve per-session state pattern.
Good illustration of session-scoped data management.

www/docs/pages/servers/tools.mdx (14)

11-23: Approve basic tool structure example.
The mcp.NewTool usage and parameter constraints are accurately shown.


32-76: Approve parameter types example.
Covers all schema types and validation options clearly.


81-102: Approve enums and constraints example.
Illustrates enums, regex, and numeric boundaries well.


113-138: Approve parameter extraction methods.
Helper methods and binding examples are comprehensive.


144-182: Approve basic handler pattern.
Shows robust error-handling and switch-based logic.


187-224: Approve file operations tool example.
Good demonstration of encoding variants and file I/O.


386-446: Approve argument validation examples.
Comprehensive coverage of required, optional, and structured binding.


452-472: Approve custom validation functions.
Well-defined regex and URL validation utilities.


479-483: Approve text result example.
Simple and correct.


488-504: Approve JSON result example.
Accurate JSON marshaling demonstration.


510-529: Approve multi-content tool example.
Proper use of multiple Content entries.


534-562: Approve error result handling.
Distinguishes between validation, business, and system errors appropriately.


606-635: Approve streaming tool example.
Shows cancellation handling and progress updates properly.


643-659: Approve conditional tool registration.
Correct illustration of admin-only vs. user tools.

www/docs/pages/clients/basics.mdx (1)

1-780: Comprehensive and accurate client basics documentation.

All example constructors, lifecycle patterns, error handling, retry logic, and monitoring code are clear and correct.

www/docs/pages/clients/operations.mdx (1)

469-487: Limit concurrency in batch operations.
Spawning a goroutine per call can overwhelm resources for large calls. Consider a bounded worker pool or using errgroup with a concurrency limit.

Can you verify typical batch sizes and whether a concurrency cap is needed?

@rwjblue-glean
Copy link
Collaborator

This is looking great!!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

♻️ Duplicate comments (4)
www/docs/pages/transports/stdio.mdx (2)

204-215: Misplaced import block.
The import statement appears after the main function definition. Move the entire import (...) block above all function declarations to comply with Go syntax.


126-156: Review path validation example.
The isValidPath function restricts absolute paths to predefined directories, which may reject valid paths in other environments. Consider guiding users to adjust safeBaseDirs for their use case or implement a more flexible validation strategy.

www/docs/pages/transports/sse.mdx (1)

239-259: Duplicate addCollaborativeTools definitions.
There are two functions named addCollaborativeTools in the advanced SSE example. Rename one (e.g., addCollaborativeToolsPlaceholder) to avoid shadowing and compilation errors.

www/docs/pages/transports/index.mdx (1)

76-82: Safe parameter extraction implemented.
The handleEcho function now correctly uses req.RequireString with error handling instead of unsafe assertions, addressing prior feedback.

🧹 Nitpick comments (7)
www/docs/pages/transports/http.mdx (3)

618-626: Missing JWT import and library note
AuthMiddleware uses jwt.ParseWithClaims but the snippet doesn’t import the JWT library. Add:

import "github.com/golang-jwt/jwt"

and note that a real JWT package should be used.


351-365: Undefined cache helper functions
The resource middleware example calls getFromCache and setCache, which aren’t defined. Provide stubs or link to their implementations to make the example self-contained.


556-564: Cleanup goroutine leak in HTTPSessionManager
NewHTTPSessionManager starts a ticker-based cleanup goroutine but never stops the ticker. Consider adding a Close() method to stop the ticker and terminate the loop.

www/docs/pages/servers/basics.mdx (2)

25-27: Handle errors in basic server startup example.
The minimal “Basic Server Creation” snippet omits error handling for ServeStdio, which actually returns an error. For consistency with later examples, consider capturing and handling that error:

-   // Start the server (stdio transport)
-   server.ServeStdio(s)
+   // Start the server (stdio transport) and handle errors
+   if err := server.ServeStdio(s); err != nil {
+       log.Fatal(err)
+   }

301-304: Consistent punctuation in “Next Steps” list.
Add a period at the end of each bullet for consistency with other lists:

- - **[Resources](/servers/resources)** - Expose data to LLMs
+ - **[Resources](/servers/resources)** - Expose data to LLMs.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~302-~302: A punctuation mark might be missing here.
Context: ...tools)** - Provide functionality to LLMs - Prompts - Create re...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

www/docs/pages/transports/index.mdx (2)

9-12: Remove trailing spaces & unify bullet punctuation.
Line 10 contains extra spaces after “web applications”. Also consider adding periods to all bullet descriptions to maintain a consistent style:

- - **[SSE](/transports/sse)** - Server-Sent Events for web applications  
+ - **[SSE](/transports/sse)** - Server-Sent Events for web applications.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~10-~10: A punctuation mark might be missing here.
Context: ...nput/output for command-line tools - SSE - Server-Sent Events for web app...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


173-179: Make multi-transport example self-contained.
The “Multi-Transport Server” snippet omits the package and import block. For clarity, include:

package main

import (
    "log"
    "fmt"
    "github.com/mark3labs/mcp-go/server"
)

before func main().

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfbc228 and cbb0960.

📒 Files selected for processing (9)
  • www/docs/pages/clients/transports.mdx (1 hunks)
  • www/docs/pages/servers/basics.mdx (1 hunks)
  • www/docs/pages/servers/index.mdx (1 hunks)
  • www/docs/pages/servers/resources.mdx (1 hunks)
  • www/docs/pages/transports/http.mdx (1 hunks)
  • www/docs/pages/transports/index.mdx (1 hunks)
  • www/docs/pages/transports/inprocess.mdx (1 hunks)
  • www/docs/pages/transports/sse.mdx (1 hunks)
  • www/docs/pages/transports/stdio.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • www/docs/pages/servers/resources.mdx
  • www/docs/pages/servers/index.mdx
🧰 Additional context used
🪛 LanguageTool
www/docs/pages/transports/inprocess.mdx

[uncategorized] ~792-~792: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: .../clients)** - Build MCP clients for all transports - Testing - Comprehensi...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

www/docs/pages/servers/basics.mdx

[uncategorized] ~302-~302: A punctuation mark might be missing here.
Context: ...tools)** - Provide functionality to LLMs - Prompts - Create re...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

www/docs/pages/transports/index.mdx

[uncategorized] ~10-~10: A punctuation mark might be missing here.
Context: ...nput/output for command-line tools - SSE - Server-Sent Events for web app...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


[grammar] ~240-~240: A determiner may be missing.
Context: ...t practices**: Validate all inputs, use least privilege ### Network Transports (SSE/...

(THE_SUPERLATIVE)


[grammar] ~244-~244: In this context, “per-request” forms an adjective and is spelled with a hyphen.
Context: ...Authorization: Validate permissions per request - Rate limiting: Prevent abuse and ...

(PER_USER_BASIS_HYPHEN)

🪛 Gitleaks (8.26.0)
www/docs/pages/transports/http.mdx

842-844: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


857-859: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


868-870: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


885-887: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🔇 Additional comments (2)
www/docs/pages/transports/inprocess.mdx (2)

407-412: getSharedBuffer implementation is correct
The context-based buffer retrieval now returns the shared buffer as intended, resolving the previous stub that always returned nil.


227-247: Initialize in-process client before use
In NewApplication, the InProcessClient is created but not initialized. Either call app.mcpClient.Initialize(ctx) or document that initialization is implicit.

ezynda3 and others added 6 commits June 7, 2025 15:39
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
www/docs/pages/transports/inprocess.mdx (3)

154-162: Demonstrate population of memoryCache.

The handleMemoryCache example reads from memoryCache, but there’s no snippet showing how entries are written. Consider adding an example or explanatory note on populating memoryCache (e.g., in a resource-write handler) to clarify its intended use.


378-384: Update or remove unused offset field in SharedBuffer.

The offset field is never updated after writes, so every Write always starts at the same position. Either:

  • Increment offset after copying the data, or
  • Remove offset and describe the fixed-buffer usage pattern.

434-436: Handle write errors on shared buffer.

The call buffer.Write([]byte("example data")) may return an error (e.g., buffer overflow), but the example ignores it. Capture and handle the error to prevent silent failures in real-world usage.

www/docs/pages/transports/http.mdx (1)

927-935: Add import for rate-limiting package.

The RateLimiter example uses rate.Limiter and rate.NewLimiter, but the rate package (e.g., golang.org/x/time/rate) isn’t imported in the snippet. Include the appropriate import so the example compiles as shown.

www/docs/pages/servers/basics.mdx (1)

302-304: Remove extra trailing spaces in bullet list.

In the “Next Steps” section, the second bullet ends with two spaces. Clean up the trailing whitespace for consistency with other items.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~302-~302: A punctuation mark might be missing here.
Context: ...tools)** - Provide functionality to LLMs - Prompts - Create re...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbb0960 and d066c97.

📒 Files selected for processing (4)
  • www/docs/pages/clients/transports.mdx (1 hunks)
  • www/docs/pages/servers/basics.mdx (1 hunks)
  • www/docs/pages/transports/http.mdx (1 hunks)
  • www/docs/pages/transports/inprocess.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
www/docs/pages/transports/inprocess.mdx

[uncategorized] ~799-~799: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: .../clients)** - Build MCP clients for all transports - Testing - Comprehensi...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

www/docs/pages/servers/basics.mdx

[uncategorized] ~302-~302: A punctuation mark might be missing here.
Context: ...tools)** - Provide functionality to LLMs - Prompts - Create re...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

🪛 Gitleaks (8.26.0)
www/docs/pages/transports/http.mdx

842-844: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


857-859: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


868-870: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


885-887: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
www/docs/pages/transports/stdio.mdx (1)

126-152: Make safe base directories configurable
The hard-coded safeBaseDirs list in isValidPath may not cover all deployment environments. Consider externalizing these paths (via constants or config) and documenting them so users can adjust the validation scope as needed.

www/docs/pages/servers/advanced.mdx (1)

108-122: Undefined User type and db variable
The handler references &User{…} and calls db.Create(user) without showing their declarations or initialization. Either include an example User struct and db setup, or annotate that these are placeholders.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d066c97 and ec7f2ab.

📒 Files selected for processing (6)
  • www/docs/pages/servers/advanced.mdx (1 hunks)
  • www/docs/pages/servers/prompts.mdx (1 hunks)
  • www/docs/pages/servers/resources.mdx (1 hunks)
  • www/docs/pages/servers/tools.mdx (1 hunks)
  • www/docs/pages/transports/http.mdx (1 hunks)
  • www/docs/pages/transports/stdio.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • www/docs/pages/transports/http.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • www/docs/pages/servers/resources.mdx
🧰 Additional context used
🪛 LanguageTool
www/docs/pages/servers/advanced.mdx

[uncategorized] ~350-~350: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... return result, err } } ### Rate Limiting Middleware go type RateLimitMiddlew...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (1)
www/docs/pages/servers/tools.mdx (1)

1-600: No issues detected in the added tool implementation examples; they are clear and consistent.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
www/docs/pages/servers/prompts.mdx (1)

110-168: Missing import statements in data analysis snippet
The handleDataAnalysis example uses fmt, strings.Builder, and strings.Join but omits an import block. Add, for example:

import (
    "context"
    "fmt"
    "strings"
    "github.com/mark3labs/mcp-go/mcp"
)
🧹 Nitpick comments (5)
www/docs/pages/servers/prompts.mdx (1)

488-561: Consider using Go's text/template for templated prompts
Manually replacing placeholders with strings.ReplaceAll is brittle. A text/template based approach would be more robust and support built-in escaping.

www/docs/pages/transports/stdio.mdx (1)

360-360: Hyphenate compound adjective in heading
Change “### Rate Limiting Middleware” to “### Rate-Limiting Middleware” to follow English style for compound modifiers.

www/docs/pages/servers/advanced.mdx (3)

55-83: Return JSON with the correct helper
handleCalculateTyped currently does JSON marshalling but wraps it in NewToolResultText, which treats it as plain text. Prefer:

- return mcp.NewToolResultText(string(jsonData)), nil
+ return mcp.NewToolResultJSON(output), nil

to send structured JSON results.


140-176: Refine required_if tag syntax
Validator tags require a comma between field and value. Update:

- Content   string `json:"content" validate:"required_if=Operation write"`
+ Content   string `json:"content" validate:"required_if=Operation,write"`

to ensure the rule is recognized.


361-402: Unify middleware signature for consistency
RateLimitMiddleware.ToolMiddleware uses server.ToolHandler but LoggingMiddleware uses server.ToolHandlerFunc. Standardize on server.ToolHandlerFunc to keep handler chaining consistent.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec7f2ab and 1db5bf1.

📒 Files selected for processing (3)
  • www/docs/pages/servers/advanced.mdx (1 hunks)
  • www/docs/pages/servers/prompts.mdx (1 hunks)
  • www/docs/pages/transports/stdio.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
www/docs/pages/servers/advanced.mdx

[uncategorized] ~358-~358: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... return result, err } } ### Rate Limiting Middleware go type RateLimitMiddlew...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (5)
www/docs/pages/servers/prompts.mdx (3)

11-24: Well-structured basic prompt example
The “Basic Prompt Structure” snippet cleanly demonstrates creating a prompt with arguments. Looks good.


30-37: Imports are correctly shown for the code review example
The import block includes both standard and MCP packages, making the subsequent snippets reproducible.


175-230: Flexible parameter handling helpers are clear
The getStringArg and getStringSliceArg functions correctly handle defaults and type assertions.

www/docs/pages/transports/stdio.mdx (1)

27-131: Basic STDIO server example is accurate
Imports, tool/resource registration, path validation, and error-result patterns are well demonstrated.

www/docs/pages/servers/advanced.mdx (1)

12-23: Typed tool setup is clear and complete
Import declarations and tool registration demonstrate compile-time safety properly.

ezynda3 and others added 2 commits June 7, 2025 20:40
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@ezynda3 ezynda3 merged commit 709e19d into main Jun 7, 2025
4 checks passed
@kpumuk
Copy link

kpumuk commented Jun 13, 2025

@ezynda3 did it hallucinate mcp.NewToolResultJSON? Sounds like a very useful helper, which is not (yet?) implemented.

@karngyan
Copy link
Contributor

Also hallucinated server.AddMCPRoutes ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants