Team Foundation API is wide open and straight forward you can do everything you do through the Team Explorer and command line using the API. I'll post some examples using this API using Visual Studio 2005 and C#.
Creating a Team Foundation server
You should add reference to: Microsoft.TeamFoundation.Client.dll
Team Foundation assemblies are located under: C:\Program Files\Microsoft Visual Studio 8\common\IDE\PrivateAssemblies.
On the using clause add:
// Create the server object and connect to the server.
TeamFoundationServer teamServer = TeamFoundationServerFactory.GetServer(serverName);
// Check the connection
Now you have a Team Foundation Server object to work with. Check out the TeamFoundationServer class using Reflector or ObjectExplorer to see other members of the class.