for example, 30 events during 10000 person-years, the cumulative incidence rate is 3 per 1000 person-years, how to calculate its 95% CI?
Use a Poisson GLM to do maximum likelihood under the assumption of independent interarrival times:
n <- 30 d <- 10000 fit <- glm(n ~ offset(log(d)), family=poisson) exp(confint(fit))
> exp(confint(fit)) Waiting for profiling to be done... 2.5 % 97.5 % 0.002050488 0.004205138
The assumption would be violated when there are discrepant intervals between incidence and recurrence in the cohort, such as cases of herpes sores. Here infected persons have a shorter interval between outbreaks, than would be expected in a time-to-event analysis inspecting incidence in a cohort of persons uninfected with the disease.
This is more precise than normal approximations to the crude rate since it is not the natural parameterization for rates. This method is the same as @JamesKirkbride's answer below. The GLM is nice to familiarize yourself with because it extends to many other methods like aggregating ecological data and stratifying.
This sounds like an incidence rate not cumulative incidence, which is a risk (number of cases divided by original disease-free population). Presumably the 95% CI for cumulative incidence is the same as that for any proportion. If you are after the 95% confidence interval for a rate it is given by:
ln(95%CI) = ln(rate)+/-1.96SE 
SE is defined by
d is the numerator size.
Exponentiate  to give you the lower and upper bounds.