You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add API token authentication and restructure MCP server (#18)
* - partially revise code structure
- added tests: unit and end-to-end
- updated all libraries used by the server
- added the ability to access the server using a Globalping API token
* spelling and logic fixes according to coderabbit review
* Restore global fetch after tests to avoid side effects
* client limit set to default if below 1
* removed integration and oauth flow tests
* - rewritten using the official ts client
- tests have been rewritten as well. Cloudflare workers only allow integration and unit tests.
* format fix
* fixes according coderabbit
* fixes according coderrabit
* fixes according coderabbit
* Add GitHub Actions workflow for testing and update integration tests
- Created a new workflow file for running tests on every commit
- Updated tsconfig to correct the path for worker configuration.
- Changed isolatedStorage setting in vitest configuration to false.
* workflow fix
* workflow fix
* Improve API token request error handling and validation
* Fix API token request authorization check to handle missing type
* Add mcptotal.io to exception hosts list
* Add imports for AuthRequest and PKCECodePair in layout.ts
* Update configuration and dependencies; add new API route and improve token handling
Copy file name to clipboardExpand all lines: README.md
+63-7Lines changed: 63 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@
24
24
25
25
The Globalping MCP Server implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io), allowing AI models like OpenAI's GPT and Anthropic's Claude to interact with Globalping's network measurement capabilities through natural language.
26
26
27
-
It also supports oAuth authentication, which offers a secure way to interact with our API and benefits from higher rate limits associated with your account.
27
+
It also supports two authentication methods: OAuth and API token authentication. Both methods offer a secure way to interact with our API and provide higher rate limits associated with your account.
28
28
29
29
### Key Features
30
30
@@ -33,7 +33,7 @@ It also supports oAuth authentication, which offers a secure way to interact wit
33
33
- 📊 **Comprehensive Measurements**: Support for ping, traceroute, DNS, MTR, and HTTP tests
34
34
- 🔍 **Smart Context Handling**: Provides detailed parameter descriptions for AI clients to intelligently select measurement types and options
35
35
- 🔄 **Comparative Analysis**: Allows to compare network performance between different targets
36
-
- 🔑 **oAuth Support**: Use your own Globalping account for higher rate limits
36
+
- 🔑 **Authentication Support**: Use OAuth or API token with your Globalping account for higher rate limits
37
37
38
38
39
39
## Installation
@@ -129,6 +129,58 @@ Legacy SSE transport:
129
129
}
130
130
```
131
131
5. Click "Save" and restart Cursor
132
+
## Authentication
133
+
134
+
The Globalping MCP server supports two authentication methods:
135
+
-**OAuth Authentication**: Automatically handled by the server for secure access
136
+
-**API Token Authentication**: Manual token configuration via Authorization header
137
+
138
+
Both methods provide higher rate limits and priority access to the probe network.
139
+
140
+
### Using Globalping API Token
141
+
142
+
The server automatically detects when an API token is provided in the Authorization header and uses it for authentication instead of OAuth.
143
+
144
+
#### Getting Your API Token
145
+
146
+
1. Visit [globalping.io](https://globalping.io)
147
+
2. Sign in to your account
148
+
3. Navigate to your account settings to generate an API token
149
+
150
+
#### Configuration with Authentication
151
+
152
+
Streamable HTTP transport:
153
+
```json
154
+
{
155
+
"mcpServers": {
156
+
"globalping": {
157
+
"command": "npx",
158
+
"args": [
159
+
"mcp-remote",
160
+
"https://mcp.globalping.dev/mcp",
161
+
"--header",
162
+
"Authorization: Bearer YOUR_GLOBALPING_API_TOKEN"
163
+
]
164
+
}
165
+
}
166
+
}
167
+
```
168
+
Legacy SSE transport:
169
+
```json
170
+
{
171
+
"mcpServers": {
172
+
"globalping": {
173
+
"command": "npx",
174
+
"args": [
175
+
"mcp-remote",
176
+
"https://mcp.globalping.dev/sse",
177
+
"--header",
178
+
"Authorization: Bearer YOUR_GLOBALPING_API_TOKEN"
179
+
]
180
+
}
181
+
}
182
+
}
183
+
```
132
184
133
185
## Connecting AI Assistants
134
186
@@ -200,10 +252,14 @@ You can also combine these with a plus sign for more specific targeting: "London
200
252
The codebase is organized into modules:
201
253
202
254
-`src/index.ts` - Main entry point and MCP agent definition
203
-
-`src/globalping/types.ts` - TypeScript interfaces for the Globalping API
204
-
-`src/globalping/api.ts` - API wrapper functions for Globalping
0 commit comments