MayaMan has a mechanism for blending RenderMan Shading Language (SL) and Maya shading networks, this mechanism is the SLCodeNode, a repository for SL code that can be embedded into a shading network, the magic shaders mechanism will insert your code and connect any inputs/outputs.
First, create inputs, use the controls in the 'Add Parameter' section to create inputs by selecting data type, parameter name and default value, then press the 'Create' button. A new value will be placed in the 'Extra Attributes' for each input. These inputs can be connected to other nodes in the same manner as any input of any maya shading node.
Second, create outputs, this procedure is the same as input creation except that you turn on the 'Output' checkbox. When an output parameter is created a declaration is added to the SL code. Due to a maya limitation output variables appear in the Extra Attributes panel, manipulating these values will have no effect on the result and they should be ignored... a good reason to create them all at once after the inputs.
Third, write the SL code. Write SL code as you normally would, don't declare any variables outside the curly braces that are automatically inserted. To refer to a input or output parameter put '$' in front of the name. The execution environment for the code will have several handy values pre-defined.... for example, for code to be used in surface or displacement shaders the PS variable contains the current point in shader space and Nf contains the normalized forward facing normal at the point (in current space) with the effect of any downstream bumping rolled in.