For an example of how to write shader header and source code, see Maya2014/mentalray/devkit. Maya2014/mentalray/shaders/include contains base.mi, contour.mi and physics.mi that declares basic shaders.
As a part of devkit, Microsoft Visual Studio project files are shipped. You can open base.dsw, contour.dsw, physics.dsw and compile them yourself.
If apply is not provided in the shader declaration, you will find the shader node in Miscellaneous section of the Create Render Node window (or bar in the Hypershade).
To place the node into a different category, use the apply keyword in the shader declaration. For example, for mib_texture_vector (base.mi). mib_texture_vector node is under Textures section:
declare shader vector "mib_texture_vector" ( integer "select", integer "selspace", integer "vertex", integer "project" ) version 2 *apply texture* end declare
Click your shader node. The shader has blank icon and the Script Editor will have a warning message, unless you provided render_myshader.xpm.
Check out the Attribute Editor of the shader. If the shader had any parameters, you should be able to see corresponding fields in the Attribute Editor.
You can create your own Attribute Editor Template file to provide better look of the attribute editor.
If the shader is called myShader, create a file called AEmyShaderTemplate.mel, and place it in Maya2014/scripts/AETemplates.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License