TeamCity comes bundled with a Development Package that can be used to start developing TeamCity plugins.

To get the package use .tar.gz or .exe. distribution.
Upon installation, <TeamCity Home Directory> will have a devPackage directory which contains TeamCity open API binaries, javadoc, sources and archive with a sample plugin.

devPackage directory description

There are mainly two types of plugins in TeamCity: server-side plugin and agent-side plugin.
To develop agent-side plugin you need the following part of Open API:

Correspondingly for the server-side plugin, you need:

Note that sometimes a part of agent side plugin has to work in the same JVM where the build tool is executing. For example, some custom test runner can be executed in the JVM where the tests are running. runtime directory of devPackage contains some jars that can be used in this case.

devPackage also contains some base classes for tests under the tests directory.

Sample Plugin

Building and deploying sample plugin

Building plugin with Apache Ant

Building sample plugin in IntelliJ IDEA

Running the server with plugin from IDEA

If you use Ultimate edition of IntelliJ IDEA, you can start TeamCity's Tomcat right form the IDE:

If you use Community edition, see #Building plugin with Apache Ant - you can run "deploy" Ant build target right from Ant Build IDEA tool window and then start TeamCity manually.

Sample Plugin Functionality

The sample plugin adds "Click me!" button in the bottom of "Projects" page. Click it to navigate to the plugin description page.