github-mcp 0.1.3

GitHub v3 REST API MCP server, generated by mcpify.
Documentation
// GitHub v3 REST API MCP server — generated by mcpify. Do not hand-edit.

use async_trait::async_trait;

use super::super::auth_strategy::{AuthConfig, AuthStrategy, Credentials};

/// No-op fallback strategy — the safe default when the target API requires
/// no authentication, or before `github-mcp setup` has configured a
/// real scheme. Always present so `AuthManager` never has to special-case a
/// missing strategy.
#[derive(Debug, Default)]
pub struct StubAuthStrategy;

#[async_trait]
impl AuthStrategy for StubAuthStrategy {
    async fn authenticate(&self, _config: &AuthConfig) -> anyhow::Result<Credentials> {
        Ok(Credentials::new())
    }

    fn validate_credentials(&self, _credentials: &Credentials) -> bool {
        true
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[tokio::test]
    async fn always_authenticates_with_empty_credentials() {
        let strategy = StubAuthStrategy;
        let credentials = strategy.authenticate(&AuthConfig::new()).await.unwrap();
        assert!(credentials.is_empty());
    }

    #[test]
    fn always_validates() {
        let strategy = StubAuthStrategy;
        assert!(strategy.validate_credentials(&Credentials::new()));
    }
}