Skip to main content

Test MCP Authentication

Used to test MCP (Model Context Protocol) server authentication. This endpoint validates that the authentication configuration is working correctly by attempting to connect to the MCP server, discover available tools, and return a success or failure status.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/tools/{tool_id}/test-mcp-auth

What This Endpoint Does

The test authentication process performs the following checks:

  1. Connect to MCP Server: Attempts to establish a connection using the configured authentication
  2. Discover Available Tools: Queries the server for available tools and resources
  3. Return Status: Provides detailed success or failure information

This is particularly useful for validating OAuth tokens, bearer tokens, or API keys.

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/tools/{tool_id}/test-mcp-auth?project_key=YOUR_PROJECT_KEY' \
-H 'accept: application/json'

Path Parameters

FieldTypeRequiredDescription
tool_idstringYesThe unique identifier of the MCP server tool.

Query Parameters

FieldTypeRequiredDescription
project_keystringNoThe project key for your project.

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
note

Authentication Test Details

  • This endpoint requires no request body
  • The test uses the currently configured authentication credentials
  • Connection timeout is typically set to 10-30 seconds
  • Tool discovery is limited to basic metadata retrieval
  • Does not modify any server state or data
tip

When to use this endpoint:

  • After configuring or updating OAuth credentials
  • After completing OAuth flow to verify tokens work
  • When troubleshooting authentication issues
  • Before deploying MCP server integration to production
  • Periodically to monitor authentication health
  • After token refresh to confirm new tokens are valid

The system will:

  • Use the stored authentication configuration (OAuth tokens, API keys, etc.)
  • Attempt to establish a secure connection to the MCP server
  • Make a lightweight request to discover available tools
  • Validate response format and authentication success
  • Return detailed error information if authentication fails
  • Log authentication attempts for security monitoring

Response

Success Response (200 OK)

Returns an object containing the authentication test results.

{
"is_authenticated": true,
"connection_status": "connected",
"tools_discovered": 15,
"server_version": "1.2.0",
"message": "Authentication successful. MCP server is accessible.",
"test_timestamp": "2026-01-12T07:28:51.601Z"
}

Response Fields

FieldTypeDescription
is_authenticatedbooleanIndicates whether authentication was successful.
connection_statusstringStatus of the connection (e.g., "connected", "failed").
tools_discoveredintegerNumber of tools discovered on the MCP server.
server_versionstringVersion of the MCP server (if available).
messagestringHuman-readable status message.
test_timestampstringISO 8601 timestamp when the test was performed.

Failed Authentication Response

Returns details when authentication fails.

{
"is_authenticated": false,
"connection_status": "authentication_failed",
"error_type": "invalid_token",
"message": "Authentication failed: Access token has expired",
"test_timestamp": "2026-01-12T07:28:51.601Z",
"suggestions": [
"Refresh the OAuth access token",
"Re-authenticate using the OAuth flow",
"Verify token expiration time"
]
}

Failed Authentication Fields

FieldTypeDescription
is_authenticatedbooleanAlways false for failed authentication.
connection_statusstringReason for failure (e.g., "authentication_failed", "connection_timeout").
error_typestringSpecific error type (e.g., "invalid_token", "expired_credentials").
messagestringDetailed error message.
test_timestampstringISO 8601 timestamp when the test was performed.
suggestionsarrayList of suggested actions to resolve the issue.

Error Response (422 Unprocessable Entity)

Returns validation error details when the request parameters are invalid.

{
"detail": [
{
"loc": [
"path",
"tool_id"
],
"msg": "MCP server tool not found",
"type": "value_error.notfound"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., path, query).
msgstringHuman-readable error message.
typestringError type identifier.

Common Test Results

StatusDescriptionRecommended Action
SuccessAuthentication working correctlyNo action needed
Expired TokenOAuth access token has expiredUse refresh token or re-authenticate
Invalid CredentialsAPI key or token is invalidUpdate authentication configuration
Connection TimeoutCannot reach MCP serverCheck server URL and network connectivity
Server ErrorMCP server returned an errorCheck MCP server logs and status

Error Codes

Status CodeDescriptionResponse Type
200Test Completed - Check response for auth statusSuccess
400Bad Request - Invalid test parametersBad Request
404Not Found - MCP server tool does not existNot Found
422Validation Error - Invalid request parametersUnprocessable Entity
503Service Unavailable - Cannot connect to MCP serverService Unavailable