Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<!-- Autogenerated by weave; DO NOT EDIT -->
# MCP Go SDK v0.8.0
# MCP Go SDK

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/modelcontextprotocol/go-sdk)

***BREAKING CHANGES***

This version contains minor breaking changes.
See the [release notes](
https://github.com/modelcontextprotocol/go-sdk/releases/tag/v0.8.0) for details.

[![PkgGoDev](https://pkg.go.dev/badge/github.com/modelcontextprotocol/go-sdk)](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk)

This repository contains an implementation of the official Go software
development kit (SDK) for the Model Context Protocol (MCP).

> [!IMPORTANT]
> The SDK is in release-candidate state, and is going to be tagged v1.0.0
> soon (see https://github.com/modelcontextprotocol/go-sdk/issues/328).
> We do not anticipate significant API changes or instability. Please use it
> and [file issues](https://github.com/modelcontextprotocol/go-sdk/issues/new/choose).

## Package / Feature documentation

The SDK consists of several importable packages:
Expand Down
10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ protocol.
1. [Authorization](protocol.md#authorization)
1. [Security](protocol.md#security)
1. [Utilities](protocol.md#utilities)
1. [Cancellation](utilities.md#cancellation)
1. [Ping](utilities.md#ping)
1. [Progress](utilities.md#progress)
1. [Cancellation](protocol.md#cancellation)
1. [Ping](protocol.md#ping)
1. [Progress](protocol.md#progress)

## Client Features

1. [Roots](client.md#roots)
1. [Sampling](client.md#sampling)
1. [Elicitation](clients.md#elicitation)
1. [Elicitation](client.md#elicitation)

## Server Features

1. [Prompts](server.md#prompts)
1. [Resources](server.md#resources)
1. [Tools](tools.md)
1. [Tools](server.md#tools)
1. [Utilities](server.md#utilities)
1. [Completion](server.md#completion)
1. [Logging](server.md#logging)
Expand Down
10 changes: 5 additions & 5 deletions internal/docs/README.src.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ protocol.
1. [Authorization](protocol.md#authorization)
1. [Security](protocol.md#security)
1. [Utilities](protocol.md#utilities)
1. [Cancellation](utilities.md#cancellation)
1. [Ping](utilities.md#ping)
1. [Progress](utilities.md#progress)
1. [Cancellation](protocol.md#cancellation)
1. [Ping](protocol.md#ping)
1. [Progress](protocol.md#progress)

## Client Features

1. [Roots](client.md#roots)
1. [Sampling](client.md#sampling)
1. [Elicitation](clients.md#elicitation)
1. [Elicitation](client.md#elicitation)

## Server Features

1. [Prompts](server.md#prompts)
1. [Resources](server.md#resources)
1. [Tools](tools.md)
1. [Tools](server.md#tools)
1. [Utilities](server.md#utilities)
1. [Completion](server.md#completion)
1. [Logging](server.md#logging)
Expand Down
73 changes: 73 additions & 0 deletions internal/oauthex/oauth2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,76 @@ func (h *fakeResourceHandler) installHandlers(serverURL string) {
}
}))
}

func Test_checkURLScheme(t *testing.T) {
tests := []struct {
name string
u string
wantErr bool
}{
{
name: "empty url",
u: "",
wantErr: false,
},
{
name: "valid http",
u: "http://example.com",
wantErr: false,
},
{
name: "valid https",
u: "https://example.com",
wantErr: false,
},
{
name: "valid https with uppercase scheme",
u: "HTTPS://example.com",
wantErr: false,
},
{
name: "url with no scheme",
u: "example.com",
wantErr: false,
},
{
name: "disallowed javascript scheme",
u: "javascript:alert('XSS')",
wantErr: true,
},
{
name: "disallowed javascript scheme with uppercase",
u: "Javascript:alert('XSS')",
wantErr: true,
},
{
name: "disallowed data scheme",
u: "data:text/html,<html>",
wantErr: true,
},
{
name: "disallowed vbscript scheme",
u: "vbscript:msgbox(\"XSS\")",
wantErr: true,
},
{
name: "invalid url format",
u: "://invalid-url",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotErr := checkURLScheme(tt.u)
if gotErr != nil {
if !tt.wantErr {
t.Errorf("checkURLScheme() failed: %v", gotErr)
}
return
}
if tt.wantErr {
t.Fatal("checkURLScheme() succeeded unexpectedly")
}
})
}
}
Loading