How to use Monobehaviour with an Interface

I’d like to instantiate a prefab and then check later if it has a firing script that makes it shoot at a designated target. But I’d like to pass it the target at runtime. Because Interfaces can’t inherit from MonoBehaviour, I obviously can’t do this:

public interface ICanFireAtTarget {
    public AddTarget(GameObject target);
    public FireAtTarget();
}

How can I achieve this behaviour then? How can check if an object has a script that can receive another gameObject as a target?

First off, your interface declaration is wrong:

using UnityEngine;
public interface ICanFireAtTarget {
     void AddTarget(GameObject target);
     void FireAtTarget();
 }

This will get you passed the compiler error.

Then your class can implement the interface:

public class MyClass : MonoBehaviour, ICanFireAtTarget
{
     public void AddTarget(GameObject target){}
     public void FireAtTarget(){}
}

and finally, since some Unity 5, interfaces can be found with GetComponent

void OtherMethod(GameObject obj)
{
      ICanFireAtTarget  temp = obj.GetComponent<ICanFireAtTarget >();
      if(temp != null) { temp.AddTarget(someObject); }
}