-
Notifications
You must be signed in to change notification settings - Fork 401
feat: Add Support for mkdocs #883
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
+624
−42
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| go.sdk.modelcontextprotocol.io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| --8<-- "CONTRIBUTING.md" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maciej-kisiel marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| <!-- Autogenerated by weave; DO NOT EDIT --> | ||
| # Quick Start | ||
|
|
||
| 1. [Installation](#installation) | ||
| 1. [Getting started](#getting-started) | ||
|
|
||
| ## Installation | ||
|
|
||
| ``` | ||
| go get github.com/modelcontextprotocol/go-sdk | ||
| ``` | ||
|
|
||
| ## Getting started | ||
|
|
||
| To get started creating an MCP server, create an `mcp.Server` instance, add | ||
| features to it, and then run it over an `mcp.Transport`. For example, this | ||
| server adds a single simple tool, and then connects it to clients over | ||
| stdin/stdout: | ||
|
|
||
| ```go | ||
maciej-kisiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "log" | ||
|
|
||
| "github.com/modelcontextprotocol/go-sdk/mcp" | ||
| ) | ||
|
|
||
| type Input struct { | ||
| Name string `json:"name" jsonschema:"the name of the person to greet"` | ||
| } | ||
|
|
||
| type Output struct { | ||
| Greeting string `json:"greeting" jsonschema:"the greeting to tell to the user"` | ||
| } | ||
|
|
||
| func SayHi(ctx context.Context, req *mcp.CallToolRequest, input Input) ( | ||
| *mcp.CallToolResult, | ||
| Output, | ||
| error, | ||
| ) { | ||
| return nil, Output{Greeting: "Hi " + input.Name}, nil | ||
| } | ||
|
|
||
| func main() { | ||
| // Create a server with a single tool. | ||
| server := mcp.NewServer(&mcp.Implementation{Name: "greeter", Version: "v1.0.0"}, nil) | ||
| mcp.AddTool(server, &mcp.Tool{Name: "greet", Description: "say hi"}, SayHi) | ||
| // Run the server over stdin/stdout, until the client disconnects. | ||
| if err := server.Run(context.Background(), &mcp.StdioTransport{}); err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| To communicate with that server, create an `mcp.Client` and connect it to the | ||
| corresponding server, by running the server command and communicating over its | ||
| stdin/stdout: | ||
|
|
||
| ```go | ||
maciej-kisiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "log" | ||
| "os/exec" | ||
|
|
||
| "github.com/modelcontextprotocol/go-sdk/mcp" | ||
| ) | ||
|
|
||
| func main() { | ||
| ctx := context.Background() | ||
|
|
||
| // Create a new client, with no features. | ||
| client := mcp.NewClient(&mcp.Implementation{Name: "mcp-client", Version: "v1.0.0"}, nil) | ||
|
|
||
| // Connect to a server over stdin/stdout. | ||
| transport := &mcp.CommandTransport{Command: exec.Command("myserver")} | ||
| session, err := client.Connect(ctx, transport, nil) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| defer session.Close() | ||
|
|
||
| // Call a tool on the server. | ||
| params := &mcp.CallToolParams{ | ||
| Name: "greet", | ||
| Arguments: map[string]any{"name": "you"}, | ||
| } | ||
| res, err := session.CallTool(ctx, params) | ||
| if err != nil { | ||
| log.Fatalf("CallTool failed: %v", err) | ||
| } | ||
| if res.IsError { | ||
| log.Fatal("tool failed") | ||
| } | ||
| for _, c := range res.Content { | ||
| log.Print(c.(*mcp.TextContent).Text) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| The [`examples/`](https://github.com/modelcontextprotocol/go-sdk/tree/main/examples) directory contains more example clients and | ||
| servers. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.